tls: fix compile issues on old-linux CI

Follow-up to 3210101088
Closes #13325
This commit is contained in:
Stefan Eissing 2024-04-09 09:53:26 +02:00 committed by Daniel Stenberg
parent b6a4f9aa1e
commit e7de80e8ce
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 10 additions and 4 deletions

View File

@ -753,7 +753,7 @@ CURLcode Curl_gtls_ctx_init(struct gtls_ctx *gctx,
/* convert the ALPN string from our arguments to a list of strings /* convert the ALPN string from our arguments to a list of strings
* that gnutls wants and will convert internally back to this very * that gnutls wants and will convert internally back to this very
* string for sending to the server. nice. */ * string for sending to the server. nice. */
if(alpn) { if(alpn && alpn_len) {
gnutls_datum_t alpns[5]; gnutls_datum_t alpns[5];
size_t i, alen = alpn_len; size_t i, alen = alpn_len;
unsigned char *s = (unsigned char *)alpn; unsigned char *s = (unsigned char *)alpn;

View File

@ -3552,8 +3552,10 @@ CURLcode Curl_ossl_ctx_init(struct ossl_ctx *octx,
} }
#ifdef USE_OPENSSL_QUIC #ifdef USE_OPENSSL_QUIC
req_method = OSSL_QUIC_client_method(); req_method = OSSL_QUIC_client_method();
#else #elif (OPENSSL_VERSION_NUMBER >= 0x10100000L)
req_method = TLS_method(); req_method = TLS_method();
#else
req_method = SSLv23_client_method();
#endif #endif
break; break;
default: default:
@ -3677,7 +3679,7 @@ CURLcode Curl_ossl_ctx_init(struct ossl_ctx *octx,
SSL_CTX_set_options(octx->ssl_ctx, ctx_options); SSL_CTX_set_options(octx->ssl_ctx, ctx_options);
#ifdef HAS_ALPN #ifdef HAS_ALPN
if(alpn) { if(alpn && alpn_len) {
if(SSL_CTX_set_alpn_protos(octx->ssl_ctx, alpn, (int)alpn_len)) { if(SSL_CTX_set_alpn_protos(octx->ssl_ctx, alpn, (int)alpn_len)) {
failf(data, "Error setting ALPN"); failf(data, "Error setting ALPN");
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
@ -3914,10 +3916,12 @@ static CURLcode ossl_connect_step1(struct Curl_cfilter *cf,
SSL_set_bio(octx->ssl, bio, bio); SSL_set_bio(octx->ssl, bio, bio);
#endif #endif
#ifdef HAS_ALPN
if(connssl->alpn) { if(connssl->alpn) {
Curl_alpn_to_proto_str(&proto, connssl->alpn); Curl_alpn_to_proto_str(&proto, connssl->alpn);
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, proto.data); infof(data, VTLS_INFOF_ALPN_OFFER_1STR, proto.data);
} }
#endif
connssl->connecting_state = ssl_connect_2; connssl->connecting_state = ssl_connect_2;
return CURLE_OK; return CURLE_OK;
} }
@ -3952,7 +3956,9 @@ static CURLcode ossl_connect_step2(struct Curl_cfilter *cf,
/* If key logging is enabled, wait for the handshake to complete and then /* If key logging is enabled, wait for the handshake to complete and then
* proceed with logging secrets (for TLS 1.2 or older). * proceed with logging secrets (for TLS 1.2 or older).
*/ */
ossl_log_tls12_secret(octx->ssl, &octx->keylog_done); bool done = FALSE;
ossl_log_tls12_secret(octx->ssl, &done);
octx->keylog_done = done;
} }
#endif #endif