From: "MaxF (Code Review)" Date: Tue, 20 May 2025 13:06:25 +0000 References: Reply-To: max@...2606..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="wq/lCk/BcOs="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: mbedtls: Allow TLS 1.3 if available List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --wq/lCk/BcOs= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1042?usp=3Demail to review the following change. Change subject: mbedtls: Allow TLS 1.3 if available ...................................................................... mbedtls: Allow TLS 1.3 if available We need mbedtls_ssl_export_keying_material() to support TLS 1.3. The workaround we use for TLS 1.2 does not work for TLS 1.3. Change-Id: If5e832866b312a2f8a1ce6b4e00d40e3dcf63681 Signed-off-by: Max Fillinger --- M README.mbedtls M src/openvpn/ssl_mbedtls.c 2 files changed, 13 insertions(+), 6 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/1042/1 diff --git a/README.mbedtls b/README.mbedtls index c4f3924..a1012e9 100644 --- a/README.mbedtls +++ b/README.mbedtls @@ -26,5 +26,9 @@ ************************************************************************* -Mbed TLS 3 has implemented (parts of) the TLS 1.3 protocol, but we have di= sabled -support in OpenVPN because the TLS-Exporter function is not yet implemente= d. +Mbed TLS 3 has implemented TLS 1.3, but support in OpenVPN requires the +function mbedtls_ssl_export_keying_material() which is currently not in +any released version. It is available when building mbed TLS from source +(mbedtls-3.6 or development branch). + +Without this function, only TLS 1.2 is available. diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c index ab4b20c..e159afb 100644 --- a/src/openvpn/ssl_mbedtls.c +++ b/src/openvpn/ssl_mbedtls.c @@ -1061,11 +1061,14 @@ int tls_version_max(void) { -#if defined(MBEDTLS_SSL_PROTO_TLS1_2) + /* We need mbedtls_ssl_export_keying_material() to support TLS 1.3. */ +#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && HAVE_MBEDTLS_SSL_EXPORT_KEYING_MA= TERIAL + return TLS_VER_1_3; +#elif defined(MBEDTLS_SSL_PROTO_TLS1_2) return TLS_VER_1_2; -#else /* defined(MBEDTLS_SSL_PROTO_TLS1_2) */ - #error "mbedtls is compiled without support for TLS 1.2." -#endif /* defined(MBEDTLS_SSL_PROTO_TLS1_2) */ +#else + #error "mbedtls is compiled without support for TLS 1.2 or 1.3" +#endif } /** -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1042?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: If5e832866b312a2f8a1ce6b4e00d40e3dcf63681 Gerrit-Change-Number: 1042 Gerrit-PatchSet: 1 Gerrit-Owner: MaxF Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --wq/lCk/BcOs= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

MaxF would like plaisthos and flichtenheld to review th= is change.

V= iew Change

mbedtls: Allow TLS 1.3 if available

We need mbedtls_s= sl_export_keying_material() to support TLS 1.3. The
workaround we use fo= r TLS 1.2 does not work for TLS 1.3.

Change-Id: If5e832866b312a2f8a1= ce6b4e00d40e3dcf63681
Signed-off-by: Max Fillinger <maximilian.fillin= ger@...2507...>
---
M README.mbedtls
M src/openvpn/ssl_mbedtls.= c
2 files changed, 13 insertions(+), 6 deletions(-)

git pull s=
sh://gerrit.openvpn.net:29418/openvpn refs/changes/42/1042/1
diff -=
-git a/README.mbedtls b/README.mbedtls
index c4f3924..a1012= e9 100644
--- a/README.mbedtls
+++ b/README= .mbedtls
@@ -26,5 +26,9 @@

************************************************************************= *

-Mb= ed TLS 3 has implemented (parts of) the TLS 1.3 protocol, but we have disab= led
-support in OpenVPN= because the TLS-Exporter function is not yet implemented.
+Mbed TLS 3 has implemented TLS 1.3, = but support in OpenVPN requires the
+function mbedtls_ssl_export_keying_material() which is curr= ently not in
+any rel= eased version. It is available when building mbed TLS from source+(mbedtls-3.6 or development b= ranch).
+
<= span style=3D"color: hsl(120, 100%, 40%);">+Without this function, only TLS= 1.2 is available.
diff --git a/src/openvpn/ssl_mbedtls.c b= /src/openvpn/ssl_mbedtls.c
index ab4b20c..e159afb 100644
--- a/src/openvpn/ssl_mbedtls.c
+++ b/src/ope= nvpn/ssl_mbedtls.c
@@ -1061,11 +1061,14 @@
= int
tls_version_max(void)
{
-#if defined(MBEDTLS_SSL_PROTO_TLS1= _2)

+ /* We need m= bedtls_ssl_export_keying_material() to support TLS 1.3. */
+#if defined(MBEDTLS_SSL_PROTO_TLS1_3= ) && HAVE_MBEDTLS_SSL_EXPORT_KEYING_MATERIAL
+ return TLS_VER_1_3;
+#elif defined(MBEDTLS_SSL_PROTO_TLS1_= 2)
return TLS_VER_1_2;
-#else /* defined(MBEDTLS_SSL_PROTO_TLS1_2) */<= br>- #error "mbedtls is c= ompiled without support for TLS 1.2."
-#endif /* defined(MBEDTLS_SSL_PROTO_TLS1_2) */<= br>+#else
+ #error "mbedtls is compiled with= out support for TLS 1.2 or 1.3"
+#endif
}

/**

To view, visit change 1042. To unsub= scribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If5e832866b312a2f8a1ce6b4e00= d40e3dcf63681
Gerrit-Change-Number: 1042
Gerrit-PatchSet: 1
Gerrit-Owner: MaxF <max@...2606...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
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-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--wq/lCk/BcOs=--