Skip to content

Commit 1192ae0

Browse files
committed
SSLv3 patch option for curl 7.77.0+
1 parent f0491b5 commit 1192ae0

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

curl/libcurl-build.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ if [ -z "${MACOS_ARM64_VERSION}" ]; then
5757
MACOS_ARM64_VERSION=$(sw_vers -productVersion)
5858
fi
5959

60+
# Semantic Version Comparison
61+
version_lte() {
62+
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
63+
}
64+
65+
# Usage Instructions
6066
usage ()
6167
{
6268
echo
@@ -507,11 +513,16 @@ echo "Unpacking curl"
507513
tar xfz "${CURL_VERSION}.tar.gz"
508514

509515
if [ ${FORCE_SSLV3} == 'yes' ]; then
510-
# for library
511-
sed -i '' '/version == CURL_SSLVERSION_SSLv3/d' "${CURL_VERSION}/lib/setopt.c"
512-
patch "${CURL_VERSION}/lib/vtls/openssl.c" sslv3.patch
513-
# for command line
514-
sed -i '' -e 's/warnf(global, \"Ignores instruction to use SSLv3\\n\");/config->ssl_version = CURL_SSLVERSION_SSLv3;/g' "${CURL_VERSION}/src/tool_getparam.c"
516+
if version_lte ${CURL_VERSION} "curl-7.76.1"; then
517+
echo "SSLv3 Requested: No patch needed for ${CURL_VERSION}."
518+
else
519+
echo "SSLv3 Requested: This requires a patch for 7.77.0 and above - mileage may vary."
520+
# for library
521+
sed -i '' '/version == CURL_SSLVERSION_SSLv3/d' "${CURL_VERSION}/lib/setopt.c"
522+
patch -N "${CURL_VERSION}/lib/vtls/openssl.c" sslv3.patch || true
523+
# for command line
524+
sed -i '' -e 's/warnf(global, \"Ignores instruction to use SSLv3\\n\");/config->ssl_version = CURL_SSLVERSION_SSLv3;/g' "${CURL_VERSION}/src/tool_getparam.c"
525+
fi
515526
fi
516527

517528
echo -e "${bold}Building Mac libraries${dim}"

0 commit comments

Comments
 (0)