Skip to content

Commit

Permalink
vquic-tls: use correct cert name check API for wolfSSL
Browse files Browse the repository at this point in the history
wolfSSL_X509_check_host checks the peer name against the alt names and
the common name.

Fixes #13487
Closes #13680
  • Loading branch information
julek-wolfssl authored and bagder committed May 16, 2024
1 parent 9e2bd56 commit 4c46e27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
6 changes: 0 additions & 6 deletions docs/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
13.13 Make sure we forbid TLS 1.3 post-handshake authentication
13.14 Support the clienthello extension
13.15 Select signature algorithms
13.16 QUIC peer verification with wolfSSL

14. GnuTLS
14.2 check connection
Expand Down Expand Up @@ -922,11 +921,6 @@

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

13.16 QUIC peer verification with wolfSSL

Peer certificate verification is missing in the QUIC (ngtcp2) implementation
using wolfSSL.

14. GnuTLS

14.2 check connection
Expand Down
16 changes: 9 additions & 7 deletions lib/vquic/vquic-tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,15 @@ CURLcode Curl_vquic_tls_verify_peer(struct curl_tls_ctx *ctx,
#elif defined(USE_WOLFSSL)
(void)data;
if(conn_config->verifyhost) {
/* TODO: this does not really verify the peer certificate.
* On TCP connection this works as it is wired into the wolfSSL
* connect() implementation and gives a special return code on
* such a fail. */
if(peer->sni &&
wolfSSL_check_domain_name(ctx->ssl, peer->sni) == SSL_FAILURE)
return CURLE_PEER_FAILED_VERIFICATION;
if(peer->sni) {
WOLFSSL_X509* cert = wolfSSL_get_peer_certificate(ctx->ssl);
if(wolfSSL_X509_check_host(cert, peer->sni, strlen(peer->sni), 0, NULL)
== WOLFSSL_FAILURE) {
result = CURLE_PEER_FAILED_VERIFICATION;
}
wolfSSL_X509_free(cert);
}

}
#endif
return result;
Expand Down

0 comments on commit 4c46e27

Please sign in to comment.