openssl: remove code handling default version

Since it is no longer actually kept as default internally, that's just
dead code.

Follow-up to 9d8998c994
Closes #19354
This commit is contained in:
Daniel Stenberg 2025-11-04 10:17:28 +01:00
parent 33e7745eef
commit a8bef39036
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -2904,6 +2904,8 @@ ossl_set_ssl_version_min_max(struct Curl_cfilter *cf, SSL_CTX *ctx,
long ossl_ssl_version_min = 0;
long ossl_ssl_version_max = 0;
#endif
/* it cannot be default here */
DEBUGASSERT(curl_ssl_version_min != CURL_SSLVERSION_DEFAULT);
switch(curl_ssl_version_min) {
case CURL_SSLVERSION_TLSv1: /* TLS 1.x */
case CURL_SSLVERSION_TLSv1_0:
@ -2924,18 +2926,6 @@ ossl_set_ssl_version_min_max(struct Curl_cfilter *cf, SSL_CTX *ctx,
#endif
}
/* CURL_SSLVERSION_DEFAULT means that no option was selected.
We do not want to pass 0 to SSL_CTX_set_min_proto_version as
it would enable all versions down to the lowest supported by
the library.
So we skip this, and stay with the library default
*/
if(curl_ssl_version_min != CURL_SSLVERSION_DEFAULT) {
if(!SSL_CTX_set_min_proto_version(ctx, ossl_ssl_version_min)) {
return CURLE_SSL_CONNECT_ERROR;
}
}
/* ... then, TLS max version */
curl_ssl_version_max = (long)conn_config->version_max;
@ -2965,9 +2955,9 @@ ossl_set_ssl_version_min_max(struct Curl_cfilter *cf, SSL_CTX *ctx,
break;
}
if(!SSL_CTX_set_max_proto_version(ctx, ossl_ssl_version_max)) {
if(!SSL_CTX_set_min_proto_version(ctx, ossl_ssl_version_min) ||
!SSL_CTX_set_max_proto_version(ctx, ossl_ssl_version_max))
return CURLE_SSL_CONNECT_ERROR;
}
return CURLE_OK;
}