From 3d03ccc56ab8f702bfa0790c9df79306e46427e7 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Tue, 12 May 2020 12:38:20 +0200 Subject: [PATCH] Normalize OpenSSL version for App Store --- create-openssl-framework.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/create-openssl-framework.sh b/create-openssl-framework.sh index 35c63ee..e6ce8bd 100755 --- a/create-openssl-framework.sh +++ b/create-openssl-framework.sh @@ -91,9 +91,26 @@ function get_min_sdk() { # # else # # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2u 20 Dec 2019" # # endif +# +# For App Store validation purposes, replace trailing letter with +# 2-digit offset from 'a' (ASCII 97), plus 1 for 1-based +# +# 1.0.2u +# 'u' = 117 -> 20 + 1 = 21 +# 1.0.221 +# +# 1.1.1g +# 'g' = 103 -> 6 + 1 = 07 (zero-padded) +# 1.1.107 +# function get_openssl_version() { local opensslv=$1 - awk '/define OPENSSL_VERSION_TEXT/ && !/-fips/ {print $5}' "$opensslv" + local std_version=$(awk '/define OPENSSL_VERSION_TEXT/ && !/-fips/ {print $5}' "$opensslv") + local generic_version=${std_version%?} + local subpatch=${std_version: -1} + local subpatch_number=$(($(printf '%d' \'$subpatch) - 97 + 1)) + local normalized_version="${generic_version}$(printf '%02d' $subpatch_number)" + echo $normalized_version } if [ $FWTYPE == "dynamic" ]; then