From e0d4c4c4d58a7cfd5e6f4fbc9e2e72830a1e43ad Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Sat, 30 Mar 2024 11:22:29 -0700 Subject: [PATCH] Fix SSLv3 support and warning #70 --- archive/release-template.md | 16 ++++++++----- build.sh | 11 +++++++-- curl/libcurl-build.sh | 3 ++- curl/sslv3.patch | 2 +- .../iOS Test App/Base.lproj/Main.storyboard | 24 ++++++++++++++----- example/iOS Test App/include/curl/curl.h | 3 ++- example/iOS Test App/include/curl/curlver.h | 10 ++++---- .../include/openssl/configuration.h | 6 ----- 8 files changed, 47 insertions(+), 28 deletions(-) diff --git a/archive/release-template.md b/archive/release-template.md index 5d05afa..4991b52 100644 --- a/archive/release-template.md +++ b/archive/release-template.md @@ -63,18 +63,22 @@ This directory contains the curl and openssl headers (in the `include` folder), |__ tvos-arm64/ |__ tvos-arm64_x86_64-simulator/ +## Usage + ## Usage 1. Copy headers to your project. - 2. Import appropriate libraries: "libssl.a", "libcrypto.a", "libcurl.a", "libnghttp2.a" *or* - **XCFrameworks Alternative**: Import appropriate *xcframework* folders into your project in Xcode. + 2. Import **XCFrameworks**: Import appropriate *xcframework* folders into your project in Xcode. + Alternative: Import appropriate libraries: "libssl.a", "libcrypto.a", "libcurl.a", "libnghttp2.a" 3. Reference Headers. - 4. Specifying the flag "-lz" in "Other Linker Flags" (OTHER_LDFLAGS) setting in the "Linking" section in the Build settings of the target. + 4. If required, specify the flag "-lz" in "Other Linker Flags" (OTHER_LDFLAGS) setting in the "Linking" section in the Build settings of the target. 5. Initialize curl in your code: +```cpp #include - - (void)foo { + (void)foo { CURL* cURL = curl_easy_init(); - ... - } \ No newline at end of file + // ... + } +``` diff --git a/build.sh b/build.sh index f6cfed1..623b8fe 100755 --- a/build.sh +++ b/build.sh @@ -15,7 +15,7 @@ set -e #OPENSSL="1.1.1u" # https://www.openssl.org/source/ OPENSSL="3.0.13" # https://www.openssl.org/source/ -LIBCURL="8.6.0" # https://curl.haxx.se/download.html +LIBCURL="8.7.1" # https://curl.haxx.se/download.html NGHTTP2="1.60.0" # https://nghttp2.org/ ################################################ @@ -124,7 +124,14 @@ while getopts "o:c:n:u:s:t:i:a:debm3xh\?" o; do CATALYST_IOS="${OPTARG}" ;; 3) - sslv3="-3" + echo "WARNING: SSLv3 is requested. SSLv3 is not secure and has been deprecated." + echo "If you proceed, builds may fail as SSLv3 is not supported by recent curl version." + read -p "Do you want to continue (y/N)? " choice + case "$choice" in + y|Y ) echo "Continuing with SSLv3 build"; echo "";; + * ) echo "Exiting"; exit 1;; + esac + sslv3="-3" ;; s) IOS_MIN_SDK_VERSION="${OPTARG}" diff --git a/curl/libcurl-build.sh b/curl/libcurl-build.sh index 48d6544..e663267 100755 --- a/curl/libcurl-build.sh +++ b/curl/libcurl-build.sh @@ -538,7 +538,7 @@ if [ ! -e ${CURL_VERSION}.tar.gz ]; then echo -e "${dim}Downloading ${CURL_VERSION}.tar.gz" curl -LOs https://curl.haxx.se/download/${CURL_VERSION}.tar.gz else - echo -e"${dim}Using ${CURL_VERSION}.tar.gz" + echo -e "${dim}Using ${CURL_VERSION}.tar.gz" fi echo -e "${dim}Unpacking curl" @@ -553,6 +553,7 @@ if [ ${FORCE_SSLV3} == 'yes' ]; then sed -i '' '/version == CURL_SSLVERSION_SSLv3/d' "${CURL_VERSION}/lib/setopt.c" patch --ignore-whitespace -N "${CURL_VERSION}/lib/vtls/openssl.c" sslv3.patch || true # for command line + sed -i '' -e 's/warnf(global, \"Ignores instruction to use SSLv3\");/config->ssl_version = CURL_SSLVERSION_SSLv3;/g' "${CURL_VERSION}/src/tool_getparam.c" 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" fi fi diff --git a/curl/sslv3.patch b/curl/sslv3.patch index 7e40baf..7bacf4e 100644 --- a/curl/sslv3.patch +++ b/curl/sslv3.patch @@ -7,7 +7,7 @@ - failf(data, "No SSLv3 support"); - return CURLE_NOT_BUILT_IN; + req_method = SSLv3_client_method(); -+ use_sni(FALSE); ++ /* use_sni(FALSE); */ + break; default: failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION"); diff --git a/example/iOS Test App/iOS Test App/Base.lproj/Main.storyboard b/example/iOS Test App/iOS Test App/Base.lproj/Main.storyboard index 721de28..722bde0 100644 --- a/example/iOS Test App/iOS Test App/Base.lproj/Main.storyboard +++ b/example/iOS Test App/iOS Test App/Base.lproj/Main.storyboard @@ -1,9 +1,10 @@ - + - + + @@ -32,11 +33,11 @@ -