From 132d23c96452ca1eb1471b4bb0abbe0bcc862b8b Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Fri, 12 Feb 2021 10:41:27 +0100 Subject: [PATCH] scripts: verify hash length To make sure we've actually calculated the hash correctly, we make sure it's 64 characters long. --- scripts/verify-install.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/verify-install.sh b/scripts/verify-install.sh index 30248cb0..cf5f9ad3 100755 --- a/scripts/verify-install.sh +++ b/scripts/verify-install.sh @@ -81,6 +81,16 @@ if [[ ! "$LND_VERSION" =~ $version_regex ]]; then exit 1 fi +# Make sure the hash was actually calculated by looking at its length. +if [[ ${#LND_SUM} -ne 64 ]]; then + echo "ERROR: Invalid hash for lnd: $LND_SUM!" + exit 1 +fi +if [[ ${#LNCLI_SUM} -ne 64 ]]; then + echo "ERROR: Invalid hash for lncli: $LNCLI_SUM!" + exit 1 +fi + # If we're inside the docker image, there should be a shasums.txt file in the # root directory. If that's the case, we first want to make sure we still have # the same hash as we did when building the image.