Skip to content

Commit 9aa3d6c

Browse files
committed
Reapply "[noup] zephyr: mbedtls: Fix certificate verification failure"
This reverts commit 6086dea. Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
1 parent f5708c5 commit 9aa3d6c

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

src/crypto/tls_mbedtls_alt.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,25 +2073,16 @@ struct wpabuf *tls_connection_handshake(void *tls_ctx,
20732073
mbedtls_ssl_conf_session_tickets_cb(&conn->tls_conf->conf, tls_mbedtls_ssl_ticket_write,
20742074
tls_mbedtls_ssl_ticket_parse, conn);
20752075
#endif
2076-
int ret = 0;
20772076

2078-
if (conn->tls_conf->domain_match != NULL) {
2079-
ret = mbedtls_ssl_set_hostname(&conn->ssl, conn->tls_conf->domain_match);
2080-
if (ret != 0) {
2081-
wpa_printf(MSG_ERROR, "Failed to set hostname from domain match");
2082-
return NULL;
2083-
}
2084-
} else if (conn->tls_conf->suffix_match != NULL) {
2085-
ret = mbedtls_ssl_set_hostname(&conn->ssl, conn->tls_conf->suffix_match);
2086-
if (ret != 0) {
2087-
wpa_printf(MSG_ERROR, "Failed to set hostname from suffix match");
2088-
return NULL;
2089-
}
2090-
} else {
2091-
mbedtls_ssl_set_hostname(&conn->ssl, NULL);
2092-
}
2077+
#ifdef MBEDTLS_X509_CRT_PARSE_C
2078+
/* This is insecure, but backwards as conf doesn't have hostname and
2079+
* for backwards compatible with MbedTLS version 3.6.3, disable
2080+
* hostname check. */
2081+
mbedtls_ssl_set_hostname(&conn->ssl, NULL);
2082+
#endif
20932083

20942084
#if MBEDTLS_VERSION_NUMBER >= 0x03020000 /* mbedtls 3.2.0 */
2085+
int ret = 0;
20952086
if (conn->ssl.MBEDTLS_PRIVATE(state) == MBEDTLS_SSL_HANDSHAKE_OVER &&
20962087
conn->ssl.MBEDTLS_PRIVATE(tls_version) == MBEDTLS_SSL_VERSION_TLS1_3)
20972088
{

0 commit comments

Comments
 (0)