From ddb8bbc6367491bb78eaa55b0454f0b1e1b2413e Mon Sep 17 00:00:00 2001 From: Levi Brown Date: Wed, 15 Sep 2021 16:31:28 -0600 Subject: [PATCH] Download GPG signature from archive location This addresses an issue wher the downloaded signature would not match the archive, if an older version of the archive is downloaded. --- build-libssl.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build-libssl.sh b/build-libssl.sh index b0c7c64..3ca609f 100755 --- a/build-libssl.sh +++ b/build-libssl.sh @@ -463,18 +463,18 @@ echo # Download OpenSSL when not present OPENSSL_ARCHIVE_BASE_NAME="openssl-${VERSION}" OPENSSL_ARCHIVE_FILE_NAME="${OPENSSL_ARCHIVE_BASE_NAME}.tar.gz" -OPENSSL_ARCHIVE_SIGNATURE_FILE_NAME="${OPENSSL_ARCHIVE_FILE_NAME}.asc" +OPENSSL_ARCHIVE_SIGNATURE_FILE_EXT=".asc" +OPENSSL_ARCHIVE_SIGNATURE_FILE_NAME="${OPENSSL_ARCHIVE_FILE_NAME}${OPENSSL_ARCHIVE_SIGNATURE_FILE_EXT}" if [ ! -e ${OPENSSL_ARCHIVE_FILE_NAME} ]; then echo "Downloading ${OPENSSL_ARCHIVE_FILE_NAME}..." OPENSSL_ARCHIVE_BASE_URL="https://www.openssl.org/source" OPENSSL_ARCHIVE_URL="${OPENSSL_ARCHIVE_BASE_URL}/${OPENSSL_ARCHIVE_FILE_NAME}" - OPENSSL_ARCHIVE_SIGNATURE_URL="${OPENSSL_ARCHIVE_BASE_URL}/${OPENSSL_ARCHIVE_SIGNATURE_FILE_NAME}" # Check whether file exists here (this is the location of the latest version for each branch) # -s be silent, -f return non-zero exit status on failure, -I get header (do not download) curl ${CURL_OPTIONS} -sfI "${OPENSSL_ARCHIVE_URL}" > /dev/null - # If unsuccessful, try the archive + # If unsuccessful, update the URL for older versions and try again. if [ $? -ne 0 ]; then BRANCH=$(echo "${VERSION}" | grep -Eo '^[0-9]\.[0-9]\.[0-9]') OPENSSL_ARCHIVE_URL="https://www.openssl.org/source/old/${BRANCH}/${OPENSSL_ARCHIVE_FILE_NAME}" @@ -492,7 +492,8 @@ if [ ! -e ${OPENSSL_ARCHIVE_FILE_NAME} ]; then # Archive was found, so proceed with download. # -O Use server-specified filename for download curl ${CURL_OPTIONS} -O "${OPENSSL_ARCHIVE_URL}" - curl ${CURL_OPTIONS} -O "${OPENSSL_ARCHIVE_SIGNATURE_URL}" + # also download the gpg signature from the same location + curl ${CURL_OPTIONS} -O "${OPENSSL_ARCHIVE_URL}${OPENSSL_ARCHIVE_SIGNATURE_FILE_EXT}" else echo "Using ${OPENSSL_ARCHIVE_FILE_NAME}"