]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix compatibility with mbedTLS 2.28.10+ and 3.6.3+
authorFrank Lichtenheld <frank@lichtenheld.com>
Thu, 27 Mar 2025 11:33:50 +0000 (12:33 +0100)
committerGert Doering <gert@greenie.muc.de>
Thu, 27 Mar 2025 11:50:09 +0000 (12:50 +0100)
From release notes:
In TLS clients, if mbedtls_ssl_set_hostname() has not been called,
mbedtls_ssl_handshake() now fails with
MBEDTLS_ERR_SSL_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME
if certificate-based authentication of the server is attempted.
This is because authenticating a server without knowing what name
to expect is usually insecure. To restore the old behavior, either
call mbedtls_ssl_set_hostname() with NULL as the hostname [...]

Change-Id: I8bbb6ffdac7d0029dbf3c13e62c11b61813c15ef
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Message-Id: <20250327113356.11233-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31262.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/ssl_mbedtls.c

index 92b52fe82755d3f2d8477e1a8389ebc39d0a15c4..e15c39180d11693ee7d44b40d42076c906bc586c 100644 (file)
@@ -1246,6 +1246,10 @@ key_state_ssl_init(struct key_state_ssl *ks_ssl,
     ALLOC_OBJ_CLEAR(ks_ssl->ctx, mbedtls_ssl_context);
     mbedtls_ssl_init(ks_ssl->ctx);
     mbed_ok(mbedtls_ssl_setup(ks_ssl->ctx, ks_ssl->ssl_config));
+    /* We do verification in our own callback depending on the
+     * exact configuration. We do not rely on the default hostname
+     * verification. */
+    ASSERT(mbed_ok(mbedtls_ssl_set_hostname(ks_ssl->ctx, NULL)));
 
 #if HAVE_MBEDTLS_SSL_SET_EXPORT_KEYS_CB
     /* Initialize keying material exporter, new style. */