Skip to content

Commit 4c46e27

Browse files
julek-wolfsslbagder
authored andcommitted
vquic-tls: use correct cert name check API for wolfSSL
wolfSSL_X509_check_host checks the peer name against the alt names and the common name. Fixes curl#13487 Closes curl#13680
1 parent 9e2bd56 commit 4c46e27

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

docs/TODO

-6
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@
126126
13.13 Make sure we forbid TLS 1.3 post-handshake authentication
127127
13.14 Support the clienthello extension
128128
13.15 Select signature algorithms
129-
13.16 QUIC peer verification with wolfSSL
130129

131130
14. GnuTLS
132131
14.2 check connection
@@ -922,11 +921,6 @@
922921

923922
https://github.com/curl/curl/issues/12982
924923

925-
13.16 QUIC peer verification with wolfSSL
926-
927-
Peer certificate verification is missing in the QUIC (ngtcp2) implementation
928-
using wolfSSL.
929-
930924
14. GnuTLS
931925

932926
14.2 check connection

lib/vquic/vquic-tls.c

+9-7
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,15 @@ CURLcode Curl_vquic_tls_verify_peer(struct curl_tls_ctx *ctx,
324324
#elif defined(USE_WOLFSSL)
325325
(void)data;
326326
if(conn_config->verifyhost) {
327-
/* TODO: this does not really verify the peer certificate.
328-
* On TCP connection this works as it is wired into the wolfSSL
329-
* connect() implementation and gives a special return code on
330-
* such a fail. */
331-
if(peer->sni &&
332-
wolfSSL_check_domain_name(ctx->ssl, peer->sni) == SSL_FAILURE)
333-
return CURLE_PEER_FAILED_VERIFICATION;
327+
if(peer->sni) {
328+
WOLFSSL_X509* cert = wolfSSL_get_peer_certificate(ctx->ssl);
329+
if(wolfSSL_X509_check_host(cert, peer->sni, strlen(peer->sni), 0, NULL)
330+
== WOLFSSL_FAILURE) {
331+
result = CURLE_PEER_FAILED_VERIFICATION;
332+
}
333+
wolfSSL_X509_free(cert);
334+
}
335+
334336
}
335337
#endif
336338
return result;

0 commit comments

Comments
 (0)