mirror of
https://github.com/curl/curl.git
synced 2026-08-26 08:13:32 +03:00
vtls/vquic, keep peer name information together
- add `struct ssl_peer` to keep hostname, dispname and sni for a filter - allocate `sni` for use in VTLS backend - eliminate `Curl_ssl_snihost()` and its use of the download buffer - use ssl_peer in SSL and QUIC filters Closes #12349
This commit is contained in:
parent
a9fd0d0083
commit
fa714830e9
18 changed files with 190 additions and 273 deletions
|
|
@ -609,24 +609,12 @@ wolfssl_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
SSL_VERIFY_NONE, NULL);
|
||||
|
||||
#ifdef HAVE_SNI
|
||||
if(sni) {
|
||||
struct in_addr addr4;
|
||||
#ifdef ENABLE_IPV6
|
||||
struct in6_addr addr6;
|
||||
#endif
|
||||
size_t hostname_len = strlen(connssl->hostname);
|
||||
|
||||
if((hostname_len < USHRT_MAX) &&
|
||||
!Curl_inet_pton(AF_INET, connssl->hostname, &addr4)
|
||||
#ifdef ENABLE_IPV6
|
||||
&& !Curl_inet_pton(AF_INET6, connssl->hostname, &addr6)
|
||||
#endif
|
||||
) {
|
||||
size_t snilen;
|
||||
char *snihost = Curl_ssl_snihost(data, connssl->hostname, &snilen);
|
||||
if(!snihost ||
|
||||
wolfSSL_CTX_UseSNI(backend->ctx, WOLFSSL_SNI_HOST_NAME, snihost,
|
||||
(unsigned short)snilen) != 1) {
|
||||
if(sni && connssl->peer.sni) {
|
||||
size_t sni_len = strlen(connssl->peer.sni);
|
||||
if((sni_len < USHRT_MAX)) {
|
||||
if(wolfSSL_CTX_UseSNI(backend->ctx, WOLFSSL_SNI_HOST_NAME,
|
||||
connssl->peer.sni,
|
||||
(unsigned short)sni_len) != 1) {
|
||||
failf(data, "Failed to set SNI");
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
|
|
@ -764,9 +752,9 @@ wolfssl_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
|
||||
/* Enable RFC2818 checks */
|
||||
if(conn_config->verifyhost) {
|
||||
char *snihost = Curl_ssl_snihost(data, connssl->hostname, NULL);
|
||||
if(!snihost ||
|
||||
(wolfSSL_check_domain_name(backend->handle, snihost) == SSL_FAILURE))
|
||||
char *snihost = connssl->peer.sni?
|
||||
connssl->peer.sni : connssl->peer.hostname;
|
||||
if(wolfSSL_check_domain_name(backend->handle, snihost) == SSL_FAILURE)
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -814,7 +802,7 @@ wolfssl_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
else if(DOMAIN_NAME_MISMATCH == detail) {
|
||||
#if 1
|
||||
failf(data, " subject alt name(s) or common name do not match \"%s\"",
|
||||
connssl->dispname);
|
||||
connssl->peer.dispname);
|
||||
return CURLE_PEER_FAILED_VERIFICATION;
|
||||
#else
|
||||
/* When the wolfssl_check_domain_name() is used and you desire to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue