From: "flichtenheld (Code Review)" Date: Wed, 26 Mar 2025 12:40:54 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="YqNLiXv+iT0="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Fix compatibility with mbedTLS 2.28.10+ and 3.6.3+ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --YqNLiXv+iT0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/918?usp=3Demail to review the following change. Change subject: Fix compatibility with mbedTLS 2.28.10+ and 3.6.3+ ...................................................................... Fix compatibility with mbedTLS 2.28.10+ and 3.6.3+ 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 --- M src/openvpn/ssl_mbedtls.c 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/18/918/1 diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c index 92b52fe..a79c8db 100644 --- a/src/openvpn/ssl_mbedtls.c +++ b/src/openvpn/ssl_mbedtls.c @@ -1246,6 +1246,8 @@ 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)); + /* Tell mbedTLS that we generally do not care about the hostname */ + mbedtls_ssl_set_hostname(ks_ssl->ctx, NULL); #if HAVE_MBEDTLS_SSL_SET_EXPORT_KEYS_CB /* Initialize keying material exporter, new style. */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/918?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I8bbb6ffdac7d0029dbf3c13e62c11b61813c15ef Gerrit-Change-Number: 918 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newchange --YqNLiXv+iT0= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

Vi= ew Change

Fix compatibility with mbedTLS 2.28.10+ and 3.6.3+

Fro= m release notes:
In TLS clients, if mbedtls_ssl_set_hostname() has not b= een called,
mbedtls_ssl_handshake() now fails with
MBEDTLS_ERR_SSL_CE= RTIFICATE_VERIFICATION_WITHOUT_HOSTNAME
if certificate-based authenticat= ion 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 ho= stname [...]

Change-Id: I8bbb6ffdac7d0029dbf3c13e62c11b61813c15efSigned-off-by: Frank Lichtenheld <frank@...2641...>
---
M src/= openvpn/ssl_mbedtls.c
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/18/918=
/1
diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls=
.c
index 92b52fe..a79c8db 100644
--- a/src/= openvpn/ssl_mbedtls.c
+++ b/src/openvpn/ssl_mbedtls.c
@@ -1246,6 +1246,8 @@
ALLOC_OBJ_CLEAR(ks_ss= l->ctx, mbedtls_ssl_context);
mbedtls_ssl_init(ks_s= sl->ctx);
mbed_ok(mbedtls_ssl_setup(ks_ssl->ctx,= ks_ssl->ssl_config));
+ /* Tell mbedTLS that we generally do not care about the hostname = */
+ mbedtls_ssl_s= et_hostname(ks_ssl->ctx, NULL);

#if H= AVE_MBEDTLS_SSL_SET_EXPORT_KEYS_CB
/* Initialize keyin= g material exporter, new style. */

To v= iew, visit change 918. To unsubscribe, or for help writing mail filters, visit <= a href=3D"http://gerrit.openvpn.net/settings">settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I8bbb6ffdac7d0029dbf3c13e62c= 11b61813c15ef
Gerrit-Change-Number: 918
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-MessageType: newchange
--YqNLiXv+iT0=--