Skip to contentSkip to conversation

Change in openvpn[master]: Add compatibility functions for mbedtls 2.X.Y

Openvpn-devel MaxF (Code Review) 1 participant 7 messages Oct 17, 2023 – Oct 18, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1697562354000.I143ca14c27c0c378b5e6b4184e80890d2c0e225e@...2715...

#1 lore raw

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/+/371?usp=email

to review the following change.

Change subject: Add compatibility functions for mbedtls 2.X.Y
......................................................................

Add compatibility functions for mbedtls 2.X.Y

Change-Id I143ca14c27c0c378b5e6b4184e80890d2c0e225e

---
M configure.ac
M src/openvpn/crypto_mbedtls.c
A src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_verify_mbedtls.c

5 files changed, 211 insertions(+), 36 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/371/1

configure.ac +6 -0
index 2072e8c..6658485 100644
@@ -1025,6 +1025,12 @@
 		[AC_MSG_ERROR([mbed TLS version >= 2.16.12 or >= 3.2.1 required])]
 	)
 
+    AC_CHECK_HEADER(
+        psa/crypto.h,
+        [AC_DEFINE([MBEDTLS_HAVE_PSA_CRYPTO_H], [1], [yes])],
+        [AC_DEFINE([MBEDTLS_HAVE_PSA_CRYPTO_H], [0], [no])]
+    )
+
 	AC_CHECK_FUNCS(
 		[ \
 			mbedtls_cipher_write_tag \
src/openvpn/crypto_mbedtls.c +1 -0
index e85e4de..f244863 100644
@@ -41,6 +41,7 @@
 #include "integer.h"
 #include "crypto_backend.h"
 #include "otime.h"
+#include "mbedtls_compat.h"
 #include "misc.h"
 
 #include <mbedtls/base64.h>
src/openvpn/mbedtls_compat.h new file +151 -0

151 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +52 -36

167 lines not on this page · raw message

src/openvpn/ssl_verify_mbedtls.c +1 -0
index 33c3769..ce21324 100644
@@ -35,6 +35,7 @@
 #if defined(ENABLE_CRYPTO_MBEDTLS)
 
 #include "crypto_mbedtls.h"
+#include "mbedtls_compat.h"
 #include "ssl_verify.h"
 #include <mbedtls/asn1.h>
 #include <mbedtls/error.h>

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/371?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I143ca14c27c0c378b5e6b4184e80890d2c0e225e
Gerrit-Change-Number: 371
Gerrit-PatchSet: 1
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/371?usp=email

to look at the new patch set (#2).

Change subject: Add compatibility functions for mbedtls 2.X.Y
......................................................................

Add compatibility functions for mbedtls 2.X.Y

Change-Id I143ca14c27c0c378b5e6b4184e80890d2c0e225e

---
M configure.ac
M src/openvpn/crypto_mbedtls.c
A src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_verify_mbedtls.c

5 files changed, 220 insertions(+), 37 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/371/2

configure.ac +6 -0
index 2072e8c..6658485 100644
@@ -1025,6 +1025,12 @@
 		[AC_MSG_ERROR([mbed TLS version >= 2.16.12 or >= 3.2.1 required])]
 	)
 
+    AC_CHECK_HEADER(
+        psa/crypto.h,
+        [AC_DEFINE([MBEDTLS_HAVE_PSA_CRYPTO_H], [1], [yes])],
+        [AC_DEFINE([MBEDTLS_HAVE_PSA_CRYPTO_H], [0], [no])]
+    )
+
 	AC_CHECK_FUNCS(
 		[ \
 			mbedtls_cipher_write_tag \
src/openvpn/crypto_mbedtls.c +1 -0
index e85e4de..f244863 100644
@@ -41,6 +41,7 @@
 #include "integer.h"
 #include "crypto_backend.h"
 #include "otime.h"
+#include "mbedtls_compat.h"
 #include "misc.h"
 
 #include <mbedtls/base64.h>
src/openvpn/mbedtls_compat.h new file +162 -0

162 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +50 -37

166 lines not on this page · raw message

src/openvpn/ssl_verify_mbedtls.c +1 -0
index 33c3769..ce21324 100644
@@ -35,6 +35,7 @@
 #if defined(ENABLE_CRYPTO_MBEDTLS)
 
 #include "crypto_mbedtls.h"
+#include "mbedtls_compat.h"
 #include "ssl_verify.h"
 #include <mbedtls/asn1.h>
 #include <mbedtls/error.h>

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/371?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I143ca14c27c0c378b5e6b4184e80890d2c0e225e
Gerrit-Change-Number: 371
Gerrit-PatchSet: 2
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, flichtenheld.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/371?usp=email )

Change subject: Add compatibility functions for mbedtls 2.X.Y
......................................................................

Patch Set 2:

(1 comment)

Patchset:

PS2:
I tried compiling against 2.28.5 and got this error:

ssl_mbedtls.c: In function ‘external_pkcs1_sign’:
ssl_mbedtls.c:607:16: error: ‘MBEDTLS_RSA_BAD_INPUT_DATA’ undeclared (first use in this function); did you mean ‘MBEDTLS_ERR_RSA_BAD_INPUT_DATA’?

  607 |         return MBEDTLS_RSA_BAD_INPUT_DATA;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                MBEDTLS_ERR_RSA_BAD_INPUT_DATA

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/371?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I143ca14c27c0c378b5e6b4184e80890d2c0e225e
Gerrit-Change-Number: 371
Gerrit-PatchSet: 2
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Wed, 18 Oct 2023 10:42:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, flichtenheld.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/371?usp=email )

Change subject: Add compatibility functions for mbedtls 2.X.Y
......................................................................

Patch Set 2:

(1 comment)

Patchset:

PS2:
The actions for Ubuntu 20.04 and older mbed TLS versions are not workign anymore. We either need to remove those or extend compatibility.

I have commit for adding testing the current mbed TLS versions already: https://github.com/schwabe/openvpn/commit/1da7e15984a3c7b1e926f1ce3370f733826c74b4

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/371?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I143ca14c27c0c378b5e6b4184e80890d2c0e225e
Gerrit-Change-Number: 371
Gerrit-PatchSet: 2
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Wed, 18 Oct 2023 10:49:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/371?usp=email )

Change subject: Add compatibility functions for mbedtls 2.X.Y
......................................................................

Patch Set 2: Code-Review-1

(1 comment)

Patchset:

PS2:
As I mentioned in the mbedTLS 3 support commit I would prefer to make this commit the first, so that compat with mbedTLS 2 is not broken.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/371?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I143ca14c27c0c378b5e6b4184e80890d2c0e225e
Gerrit-Change-Number: 371
Gerrit-PatchSet: 2
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Wed, 18 Oct 2023 10:56:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#6 lore raw
In reply to a message not in the archive

MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/371?usp=email )

Change subject: Add compatibility functions for mbedtls 2.X.Y
......................................................................

Patch Set 2:

(1 comment)

Patchset:

PS2:
Abandoning this, because I added the changes to my other commit.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/371?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I143ca14c27c0c378b5e6b4184e80890d2c0e225e
Gerrit-Change-Number: 371
Gerrit-PatchSet: 2
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Comment-Date: Wed, 18 Oct 2023 16:59:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#7 lore raw
In reply to a message not in the archive

MaxF has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/371?usp=email )

Change subject: Add compatibility functions for mbedtls 2.X.Y
......................................................................

Abandoned

Changes were added to the patch that implements mbedtls 3 support.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/371?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I143ca14c27c0c378b5e6b4184e80890d2c0e225e
Gerrit-Change-Number: 371
Gerrit-PatchSet: 2
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon