mirror of
https://github.com/curl/curl.git
synced 2026-08-24 22:43:38 +03:00
quic: implement CURLINFO_TLS_SSL_PTR
Replace the old Curl_ssl_get_internals() with a new connection filter query to retrieve the information. Implement that filter query for TCP and QUIC TLS filter types. Add tests in client tls_session_reuse to use the info option and check that pointers are returned. Reported-by: Larry Campbell Fixes #17801 Closes #17809
This commit is contained in:
parent
81693c77be
commit
2db8ae480f
13 changed files with 144 additions and 85 deletions
|
|
@ -2655,6 +2655,14 @@ static CURLcode cf_ngtcp2_query(struct Curl_cfilter *cf,
|
|||
case CF_QUERY_HTTP_VERSION:
|
||||
*pres1 = 30;
|
||||
return CURLE_OK;
|
||||
case CF_QUERY_SSL_INFO:
|
||||
case CF_QUERY_SSL_CTX_INFO: {
|
||||
struct curl_tlssessioninfo *info = pres2;
|
||||
if(Curl_vquic_tls_get_ssl_info(&ctx->tls,
|
||||
(query == CF_QUERY_SSL_INFO), info))
|
||||
return CURLE_OK;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2351,6 +2351,14 @@ static CURLcode cf_osslq_query(struct Curl_cfilter *cf,
|
|||
case CF_QUERY_HTTP_VERSION:
|
||||
*pres1 = 30;
|
||||
return CURLE_OK;
|
||||
case CF_QUERY_SSL_INFO:
|
||||
case CF_QUERY_SSL_CTX_INFO: {
|
||||
struct curl_tlssessioninfo *info = pres2;
|
||||
if(Curl_vquic_tls_get_ssl_info(&ctx->tls,
|
||||
(query == CF_QUERY_SSL_INFO), info))
|
||||
return CURLE_OK;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1553,6 +1553,14 @@ static CURLcode cf_quiche_query(struct Curl_cfilter *cf,
|
|||
case CF_QUERY_HTTP_VERSION:
|
||||
*pres1 = 30;
|
||||
return CURLE_OK;
|
||||
case CF_QUERY_SSL_INFO:
|
||||
case CF_QUERY_SSL_CTX_INFO: {
|
||||
struct curl_tlssessioninfo *info = pres2;
|
||||
if(Curl_vquic_tls_get_ssl_info(&ctx->tls,
|
||||
(query == CF_QUERY_SSL_INFO), info))
|
||||
return CURLE_OK;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1658,20 +1666,4 @@ out:
|
|||
return result;
|
||||
}
|
||||
|
||||
bool Curl_conn_is_quiche(const struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
int sockindex)
|
||||
{
|
||||
struct Curl_cfilter *cf = conn ? conn->cfilter[sockindex] : NULL;
|
||||
|
||||
(void)data;
|
||||
for(; cf; cf = cf->next) {
|
||||
if(cf->cft == &Curl_cft_http3)
|
||||
return TRUE;
|
||||
if(cf->cft->flags & CF_TYPE_IP_CONNECT)
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -41,10 +41,6 @@ CURLcode Curl_cf_quiche_create(struct Curl_cfilter **pcf,
|
|||
struct connectdata *conn,
|
||||
const struct Curl_addrinfo *ai);
|
||||
|
||||
bool Curl_conn_is_quiche(const struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
int sockindex);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CURL_VQUIC_CURL_QUICHE_H */
|
||||
|
|
|
|||
|
|
@ -197,4 +197,28 @@ CURLcode Curl_vquic_tls_verify_peer(struct curl_tls_ctx *ctx,
|
|||
}
|
||||
|
||||
|
||||
bool Curl_vquic_tls_get_ssl_info(struct curl_tls_ctx *ctx,
|
||||
bool give_ssl_ctx,
|
||||
struct curl_tlssessioninfo *info)
|
||||
{
|
||||
#ifdef USE_OPENSSL
|
||||
info->backend = CURLSSLBACKEND_OPENSSL;
|
||||
info->internals = give_ssl_ctx ?
|
||||
(void *)ctx->ossl.ssl_ctx : (void *)ctx->ossl.ssl;
|
||||
return TRUE;
|
||||
#elif defined(USE_GNUTLS)
|
||||
(void)give_ssl_ctx; /* gnutls always returns its session */
|
||||
info->backend = CURLSSLBACKEND_OPENSSL;
|
||||
info->internals = ctx->gtls.session;
|
||||
return TRUE;
|
||||
#elif defined(USE_WOLFSSL)
|
||||
info->backend = CURLSSLBACKEND_WOLFSSL;
|
||||
info->internals = give_ssl_ctx ?
|
||||
(void *)ctx->wssl.ssl_ctx : (void *)ctx->wssl.ssl;
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* !USE_HTTP3 && (USE_OPENSSL || USE_GNUTLS || USE_WOLFSSL) */
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
struct ssl_peer;
|
||||
struct Curl_ssl_session;
|
||||
struct curl_tlssessioninfo;
|
||||
|
||||
struct curl_tls_ctx {
|
||||
#ifdef USE_OPENSSL
|
||||
|
|
@ -106,6 +107,10 @@ CURLcode Curl_vquic_tls_verify_peer(struct curl_tls_ctx *ctx,
|
|||
struct Curl_easy *data,
|
||||
struct ssl_peer *peer);
|
||||
|
||||
bool Curl_vquic_tls_get_ssl_info(struct curl_tls_ctx *ctx,
|
||||
bool give_ssl_ctx,
|
||||
struct curl_tlssessioninfo *info);
|
||||
|
||||
#endif /* !USE_HTTP3 && (USE_OPENSSL || USE_GNUTLS || USE_WOLFSSL) */
|
||||
|
||||
#endif /* HEADER_CURL_VQUIC_TLS_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue