Skip to content

Commit 0422b2f

Browse files
authored
Merge pull request #82 from jasonacox/release-1.0.3
Release 1.0.3 - SSLv3 Support and Enhancements
2 parents 8b13c88 + 92649ba commit 0422b2f

File tree

7 files changed

+114
-17
lines changed

7 files changed

+114
-17
lines changed

RELEASE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# RELEASE NOTES
22

3+
## 1.0.3 - SSLv3 Support and Enhancements
4+
5+
* Added SSLv3 support for security testing with `-3` flag. This allows verification that servers properly reject SSLv3 connections. Includes compatibility updates for OpenSSL 3.x which removed the `SSLv3_client_method()` function.
6+
* Enhanced SSLv3 patch (`sslv3.patch`) to work with OpenSSL 3.x using `SSL_CTX_set_min_proto_version()` and `SSL_CTX_set_max_proto_version()` APIs.
7+
* Added automatic SSLv3 support verification in build script when `-3` flag is used.
8+
* Updated `iCurlHTTP.sh` script to copy all `.xcframework` folders from `archive/latest/xcframework` to support modern Xcode projects.
9+
* Fixed libcurl-build.sh SSLv3 patching for curl 8.17.0+ to properly handle the new command-line argument processing in tool_getparam.c.
10+
* Improved documentation with detailed patch file comments.
11+
312
## 1.0.2 - Removal of armv7
413

514
* Removal of armv7/armv7s architecture support: Apple officially stopped supporting the creation of binaries for armv7/armv7s architectures with the release of Xcode 14 in June 2022. This means that new installations of Xcode will not be able to compile armv7 targets, which will break the build script.

build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ BUILD_MACHINE=`uname -m`
2424
BUILD_CMD=$*
2525

2626
# Script Version
27-
SCRIPT_VERSION="1.0.2"
27+
SCRIPT_VERSION="1.0.3"
2828

2929
# Compile Cache - Optional
3030
# export CMAKE_CXX_COMPILER_LAUNCHER="ccache"
@@ -266,6 +266,10 @@ mkdir -p "$ARCHIVE/bin"
266266
mkdir -p "$ARCHIVE/framework"
267267
mkdir -p "$ARCHIVE/xcframework"
268268

269+
# Create a symlink of latest build
270+
rm -f archive/latest
271+
ln -s "libcurl-$LIBCURL-openssl-$OPENSSL-nghttp2-$NGHTTP2" archive/latest
272+
269273
# libraries for libcurl, libcrypto and libssl
270274
if [ "$BUILDFOR" == "ios" ] || [ "$BUILDFOR" == "all" ]; then
271275
# Copy iOS libraries

curl/libcurl-build.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,15 @@ buildMac()
274274
if [ $ARCH == ${BUILD_MACHINE} ]; then
275275
echo -e "Testing binary for ${BUILD_MACHINE}:"
276276
/tmp/curl -V
277+
# if user requested SSLv3, test it
278+
if [ ${FORCE_SSLV3} == 'yes' ]; then
279+
echo -e "Testing SSLv3 support..."
280+
if /tmp/curl --sslv3 -V 2>&1 | grep -q "Ignores instruction to use SSLv3"; then
281+
echo -e "${alert}ERROR: SSLv3 support not enabled in binary${normal}"
282+
else
283+
echo -e "${green}SUCCESS: SSLv3 support is enabled${normal}"
284+
fi
285+
fi
277286
fi
278287
}
279288

@@ -567,6 +576,19 @@ if [ ${FORCE_SSLV3} == 'yes' ]; then
567576
# for command line
568577
sed -i '' -e 's/warnf(global, \"Ignores instruction to use SSLv3\");/config->ssl_version = CURL_SSLVERSION_SSLv3;/g' "${CURL_VERSION}/src/tool_getparam.c"
569578
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"
579+
# fix sslv3 argument deprecated flag in tool_getparams.c
580+
sed -i '' '/{"sslv3",/ s/ARG_NONE|ARG_DEPR/ARG_NONE/' "${CURL_VERSION}/src/tool_getparam.c"
581+
# add C_SSLV3 case handler in opt_none() function - use value 99 as marker for SSLv3
582+
sed -i '' '/case C_IPV4:/i\
583+
case C_SSLV3: /* --sslv3 */\
584+
config->ssl_version = 99; /* special marker for SSLv3 */\
585+
break;
586+
' "${CURL_VERSION}/src/tool_getparam.c"
587+
# patch config2setopts.c to handle SSLv3 marker value before calling tlsversion()
588+
sed -i '' '/my_setopt_SSLVERSION(curl, CURLOPT_SSLVERSION,/,/);/{
589+
s/my_setopt_SSLVERSION(curl, CURLOPT_SSLVERSION,$/my_setopt_SSLVERSION(curl, CURLOPT_SSLVERSION,/
590+
s/tlsversion(config->ssl_version,$/config->ssl_version == 99 ? CURL_SSLVERSION_SSLv3 : tlsversion(config->ssl_version,/
591+
}' "${CURL_VERSION}/src/config2setopts.c"
570592
fi
571593
fi
572594

curl/sslv3.7.77.0.patch

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# SSLv3 Support Patch for curl 7.77.0 with OpenSSL 3.x
2+
# NOTE: Use this patch only for curl 7.77.0
3+
#
4+
# This patch enables SSLv3 protocol support for security testing purposes.
5+
# SSLv3 is an obsolete and insecure protocol (deprecated since 2015) but may
6+
# be needed to verify that servers properly reject SSLv3 connections.
7+
#
8+
# OpenSSL 3.x removed the SSLv3_client_method() function, so this patch uses
9+
# the modern SSL_CTX_set_min_proto_version() and SSL_CTX_set_max_proto_version()
10+
# API instead, which is compatible with OpenSSL 3.x.
11+
#
12+
# Changes:
13+
# 1. Remove "No SSLv3 support" error in method selection
14+
# 2. Add CURL_SSLVERSION_SSLv3 case handler that sets protocol version to SSL3
15+
# 3. Explicitly disable all other SSL/TLS protocol versions
16+
#
17+
# Usage: patch --ignore-whitespace -N lib/vtls/openssl.c sslv3.patch
18+
#
19+
--- openssl.c 2022-05-30 01:05:13.000000000 -0700
20+
+++ openssl.c.2 2022-05-30 01:25:52.000000000 -0700
21+
@@ -2709,8 +2709,9 @@
22+
failf(data, "No SSLv2 support");
23+
return CURLE_NOT_BUILT_IN;
24+
case CURL_SSLVERSION_SSLv3:
25+
- failf(data, "No SSLv3 support");
26+
- return CURLE_NOT_BUILT_IN;
27+
+ req_method = SSLv3_client_method();
28+
+ /* use_sni(FALSE); */
29+
+ break;
30+
default:
31+
failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION");
32+
return CURLE_SSL_CONNECT_ERROR;
33+
@@ -2798,9 +2799,18 @@
34+
35+
switch(ssl_version) {
36+
case CURL_SSLVERSION_SSLv2:
37+
- case CURL_SSLVERSION_SSLv3:
38+
return CURLE_NOT_BUILT_IN;
39+
40+
+ case CURL_SSLVERSION_SSLv3:
41+
+ SSL_CTX_set_min_proto_version(backend->ctx, SSL3_VERSION);
42+
+ SSL_CTX_set_max_proto_version(backend->ctx, SSL3_VERSION);
43+
+ ctx_options |= SSL_OP_NO_SSLv2;
44+
+ ctx_options |= SSL_OP_NO_TLSv1;
45+
+ ctx_options |= SSL_OP_NO_TLSv1_1;
46+
+ ctx_options |= SSL_OP_NO_TLSv1_2;
47+
+ ctx_options |= SSL_OP_NO_TLSv1_3;
48+
+ break;
49+
+
50+
/* "--tlsv<x.y>" options mean TLS >= version <x.y> */
51+
case CURL_SSLVERSION_DEFAULT:
52+
case CURL_SSLVERSION_TLSv1: /* TLS >= version 1.0 */

curl/sslv3.patch

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
1+
# SSLv3 Support Patch for curl > 7.77.0 with OpenSSL 3.x
2+
#
3+
# This patch enables SSLv3 protocol support for security testing purposes.
4+
# SSLv3 is an obsolete and insecure protocol (deprecated since 2015) but may
5+
# be needed to verify that servers properly reject SSLv3 connections.
6+
#
7+
# OpenSSL 3.x removed the SSLv3_client_method() function, so this patch uses
8+
# the modern SSL_CTX_set_min_proto_version() and SSL_CTX_set_max_proto_version()
9+
# API instead, which is compatible with OpenSSL 3.x.
10+
#
11+
# Changes:
12+
# 1. Remove "No SSLv3 support" error in method selection
13+
# 2. Add CURL_SSLVERSION_SSLv3 case handler that sets protocol version to SSL3
14+
# 3. Explicitly disable all other SSL/TLS protocol versions
15+
#
16+
# Usage: patch --ignore-whitespace -N lib/vtls/openssl.c sslv3.patch
17+
#
118
--- openssl.c 2022-05-30 01:05:13.000000000 -0700
219
+++ openssl.c.2 2022-05-30 01:25:52.000000000 -0700
3-
@@ -2709,8 +2709,9 @@
20+
@@ -2709,8 +2709,8 @@
421
failf(data, "No SSLv2 support");
522
return CURLE_NOT_BUILT_IN;
623
case CURL_SSLVERSION_SSLv3:
724
- failf(data, "No SSLv3 support");
825
- return CURLE_NOT_BUILT_IN;
9-
+ req_method = SSLv3_client_method();
10-
+ /* use_sni(FALSE); */
26+
+ /* SSLv3 handled in ossl_connect_step1 via SSL_CTX_set_min/max_proto_version */
1127
+ break;
1228
default:
1329
failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION");
1430
return CURLE_SSL_CONNECT_ERROR;
15-
@@ -2798,9 +2799,18 @@
31+
@@ -2798,9 +2798,18 @@
1632

1733
switch(ssl_version) {
1834
case CURL_SSLVERSION_SSLv2:
1935
- case CURL_SSLVERSION_SSLv3:
2036
return CURLE_NOT_BUILT_IN;
2137

2238
+ case CURL_SSLVERSION_SSLv3:
23-
+ SSL_CTX_set_min_proto_version(backend->ctx, SSL3_VERSION);
24-
+ SSL_CTX_set_max_proto_version(backend->ctx, SSL3_VERSION);
39+
+ SSL_CTX_set_min_proto_version(octx, SSL3_VERSION);
40+
+ SSL_CTX_set_max_proto_version(octx, SSL3_VERSION);
2541
+ ctx_options |= SSL_OP_NO_SSLv2;
2642
+ ctx_options |= SSL_OP_NO_TLSv1;
2743
+ ctx_options |= SSL_OP_NO_TLSv1_1;

example/iOS Test App/iOS Test App/ViewController.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ - (IBAction)Get:(id)sender
205205
curl_easy_setopt(_curl, CURLOPT_USERAGENT, curl_version()); // set a default user agent
206206
curl_easy_setopt(_curl, CURLOPT_VERBOSE, 1L); // turn on verbose
207207
curl_easy_setopt(_curl, CURLOPT_TIMEOUT, 60L); // seconds
208-
curl_easy_setopt(_curl, CURLOPT_MAXCONNECTS, 0L); // this should disallow connection sharing
208+
// curl_easy_setopt(_curl, CURLOPT_MAXCONNECTS, 0L); // REMOVED - 0 is invalid in curl 8.x
209209
curl_easy_setopt(_curl, CURLOPT_FORBID_REUSE, 1L); // enforce connection to be closed
210210
curl_easy_setopt(_curl, CURLOPT_DNS_CACHE_TIMEOUT, 0L); // Disable DNS cache
211211
curl_easy_setopt(_curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); // enable HTTP2 Protocol
@@ -227,8 +227,8 @@ - (IBAction)Get:(id)sender
227227
// PERFORM the Curl
228228
theResult = curl_easy_perform(_curl);
229229
if (theResult == CURLE_OK) {
230-
long http_code, http_ver;
231-
double total_time, total_size, total_speed, timing_ns, timing_tcp, timing_ssl, timing_fb;
230+
long http_code, http_ver, total_size, total_speed;
231+
double total_time, timing_ns, timing_tcp, timing_ssl, timing_fb;
232232
char *redirect_url2 = NULL;
233233
curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &http_code);
234234
curl_easy_getinfo(_curl, CURLINFO_TOTAL_TIME, &total_time);
@@ -256,7 +256,7 @@ - (IBAction)Get:(id)sender
256256
}
257257

258258
// timings
259-
_resultText.text = [_resultText.text stringByAppendingFormat:@"\n** Timing Details **\n-- \tName Lookup:\t%0.2fs\n-- \tTCP Connect: \t%0.2fs\n-- \tSSL Handshake: \t%0.2fs\n-- \tFirst Byte: \t\t%0.2fs\n-- \tTotal Download: \t%0.2fs\n-- Size: %0.0f bytes\n-- Speed: %0.0f bytes/sec\n-- Using: %@\n** RESULT CODE: %ld**",
259+
_resultText.text = [_resultText.text stringByAppendingFormat:@"\n** Timing Details **\n-- \tName Lookup:\t%0.2fs\n-- \tTCP Connect: \t%0.2fs\n-- \tSSL Handshake: \t%0.2fs\n-- \tFirst Byte: \t\t%0.2fs\n-- \tTotal Download: \t%0.2fs\n-- Size: %" CURL_FORMAT_CURL_OFF_T " bytes\n-- Speed: %" CURL_FORMAT_CURL_OFF_T " bytes/sec\n-- Using: %@\n** RESULT CODE: %ld**",
260260
timing_ns,timing_tcp,timing_ssl,timing_fb,
261261
total_time,total_size, total_speed, http_ver_s, http_code];
262262

example/iOS Test App/include/openssl/configuration.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ extern "C" {
9797
# ifndef OPENSSL_NO_SCTP
9898
# define OPENSSL_NO_SCTP
9999
# endif
100-
# ifndef OPENSSL_NO_SSL3
101-
# define OPENSSL_NO_SSL3
102-
# endif
103-
# ifndef OPENSSL_NO_SSL3_METHOD
104-
# define OPENSSL_NO_SSL3_METHOD
105-
# endif
106100
# ifndef OPENSSL_NO_TRACE
107101
# define OPENSSL_NO_TRACE
108102
# endif

0 commit comments

Comments
 (0)