From: "comododragon (Code Review)" Date: Wed, 18 Jun 2025 08:27:39 +0000 References: Reply-To: rein.vanbaaren@...1435..., 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="tFOjIir21tU="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Added PQE to WolfSSL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --tFOjIir21tU= 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/+/1046?usp=3Demail to review the following change. Change subject: Added PQE to WolfSSL ...................................................................... Added PQE to WolfSSL Change-Id: Ie0529c2074964b3be034f01e0ef53090a6edbd35 --- M README.wolfssl M src/openvpn/ssl_openssl.c A src/openvpn/wolfssl_compat.h 3 files changed, 92 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/46/1046/1 diff --git a/README.wolfssl b/README.wolfssl index a5dfe31..27b9087 100644 --- a/README.wolfssl +++ b/README.wolfssl @@ -28,3 +28,40 @@ * blowfish support (BF-CBC), you must use something like cipher AES-128-CBC to avoid trying to use BF-CBC * Windows CryptoAPI support + +************************************************************************* +To build WolfSSL with these PQE, you'll want to configure it like this: + +```bash +./configure --enable-openvpn --enable-kyber --enable-mlkem --enable-curve2= 5519 +``` + +WolfSSL supports the following Quantum Safe algorithms by specifying them = using the `tls-groups` +option in a config. + +``` +ML_KEM_512 +ML_KEM_768 +ML_KEM_1024 +P256_ML_KEM_512 +P384_ML_KEM_768 +P256_ML_KEM_768 +P521_ML_KEM_1024 +P384_ML_KEM_1024 +X25519_ML_KEM_512 +X448_ML_KEM_768 +X25519_ML_KEM_768 + +KYBER_LEVEL1 +KYBER_LEVEL3 +KYBER_LEVEL5 + +P256_KYBER_LEVEL1 +P384_KYBER_LEVEL3 +P256_KYBER_LEVEL3 +P521_KYBER_LEVEL5 + +X25519_KYBER_LEVEL1 +X448_KYBER_LEVEL3 +X25519_KYBER_LEVEL3 +``` diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index 2fc77d8..29aa502 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -76,6 +76,8 @@ #include #endif +#include "wolfssl_compat.h" + OSSL_LIB_CTX *tls_libctx; /* Global */ static void unload_xkey_provider(void); @@ -588,7 +590,12 @@ { token =3D "prime256v1"; } + +#ifdef ENABLE_CRYPTO_WOLFSSL + int nid =3D wolfssl_OBJ_sn2nid(token); +#else int nid =3D OBJ_sn2nid(token); +#endif if (nid =3D=3D 0) { diff --git a/src/openvpn/wolfssl_compat.h b/src/openvpn/wolfssl_compat.h new file mode 100644 index 0000000..a25e5c3 --- /dev/null +++ b/src/openvpn/wolfssl_compat.h @@ -0,0 +1,48 @@ +#pragma once + +/* + * OpenVPN -- An application to securely tunnel IP networks + * over a single TCP/UDP port, with support for SSL/TLS-based + * session authentication and key exchange, + * packet encryption, packet authentication, and + * packet compression. + * + * Copyright (C) 2023 Fox Crypto B.V. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + * @file + * wolfssl compatibility stub. + * This file provide compatibility stubs for the wolfssl libraries + */ + +#ifdef ENABLE_CRYPTO_WOLFSSL + +int +wolfssl_OBJ_sn2nid(const char *sn) +{ + + int nid =3D OBJ_sn2nid(sn); + + if (nid =3D=3D WC_NID_undef) + { + return wolfSSL_EC_curve_nist2nid(sn); + } + + return WC_NID_undef; +} + +#endif -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1046?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: Ie0529c2074964b3be034f01e0ef53090a6edbd35 Gerrit-Change-Number: 1046 Gerrit-PatchSet: 1 Gerrit-Owner: comododragon Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --tFOjIir21tU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

comododragon would like plaisthos and flichtenheld to review this change.

V= iew Change

Added PQE to WolfSSL

Change-Id: Ie0529c2074964b3be034= f01e0ef53090a6edbd35
---
M README.wolfssl
M src/openvpn/ssl_openss= l.c
A src/openvpn/wolfssl_compat.h
3 files changed, 92 insertions(+),= 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn r=
efs/changes/46/1046/1
diff --git a/README.wolfssl b/README.wolfssl<=
/span>
index a5dfe31..27b9087 100644
--- a/README.= wolfssl
+++ b/README.wolfssl
@@ -28,3 +28,4= 0 @@
* blowfish support (BF-CBC), you must use something = like
cipher AES-128-CBC to avoid trying to use BF-CBC
* Windows CryptoAPI support
+
+*********************************************************************= ****
+To build WolfSS= L with these PQE, you'll want to configure it like this:
+

+```bash
+./configure --enable-openvpn --enable-kyber --enable-mlkem --enab= le-curve25519
+```
+
+WolfSSL supports the following Quantum Sa= fe algorithms by specifying them using the `tls-groups`
+option in a config.
+
+```
+ML_KEM_512
+ML_KEM_= 768
+ML_KEM_1024
+P256_ML_KEM_512+P384_ML_KEM_768
+P256_ML_KEM_768

+P521_ML_KEM_1024
+P384_ML_KEM_1024
+X25519_ML_KEM_512
+X448_ML_KEM_768
+X25519_ML_KEM_768
+
+KYBER_LEVEL1
+KYBER_LEVEL3
+KYBER= _LEVEL5
+
<= span style=3D"color: hsl(120, 100%, 40%);">+P256_KYBER_LEVEL1

+P384_KYBER_LEVEL3

+P256_KYBER_LEVEL3
+P521_KYBER_LEVEL5
+
+X25519_KYBER_LEVEL1
+X448_KYBER_LEVEL3
+X25519_KYBER_LEVEL3
+```
diff --git a/src/openvpn/ssl_openssl.c b= /src/openvpn/ssl_openssl.c
index 2fc77d8..29aa502 100644
--- a/src/openvpn/ssl_openssl.c
+++ b/src/ope= nvpn/ssl_openssl.c
@@ -76,6 +76,8 @@
#incl= ude <openssl/applink.c>
#endif

+#include "wolfssl_= compat.h"
+
OSSL_LIB_CTX *tls_libctx; /* Global */

static void unload_xkey_provider(void);
@@ -588= ,7 +590,12 @@
{
token= =3D "prime256v1";
}
+
+#ifdef ENABLE_CRYPTO_WOLFSSL
+ int nid =3D wolfssl_OBJ_sn2nid(token);
+#else
= int nid =3D OBJ_sn2nid(token);
+#endif

if (n= id =3D=3D 0)
{
diff --git a/src/op= envpn/wolfssl_compat.h b/src/openvpn/wolfssl_compat.h
new f= ile mode 100644
index 0000000..a25e5c3
--- = /dev/null
+++ b/src/openvpn/wolfssl_compat.h
@@ -0,0 +1,48 @@

+#= pragma once
+<= br>+/*
+ * OpenVPN -- An application to securely tu= nnel IP networks
+ * = over a single TCP/UDP port, with support for SSL/TLS-based
+ * session a= uthentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet = compression.
+ *
+ * Copyright (C) 2023 F= ox Crypto B.V. <openvpn@...2507...>
+ *
+ * This program is free software; you can redistribute it and/or modi= fy
+ * it under the = terms of the GNU General Public License version 2
+ * as published by the Free Software Foundat= ion.
+ *
+ * This program is distributed = in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warr= anty of
+ * MERCHANT= ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more d= etails.
+ *+ * You should have received = a copy of the GNU General Public License along
+ * with this program; if not, write to the Free= Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/**
= + * @file
+ * wolfssl= compatibility stub.
= + * This file provide compatibility stubs for the wolfssl libraries<= br>+ */
+
+#ifdef ENABLE_CRYPTO_WOLFSSL
+
+int
+wolfssl_OBJ= _sn2nid(const char *sn)
+{
+
+ int nid =3D OBJ_sn2nid(sn);
+
+ if (nid =3D=3D WC_NID_undef)
<= span style=3D"color: hsl(120, 100%, 40%);">+ {

+ return wolfSSL_EC_curve_nist2nid(sn);+ }
+
+ return WC_NID_undef;
+}
+
+#endif
<= /span>

To view, visit change 1046. To unsubscribe, or for help writ= ing mail filters, visit sett= ings.

<= link itemprop=3D"url" href=3D"http://gerrit.openvpn.net/c/openvpn/+/1046?us= p=3Demail"/>
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie0529c2074964b3be034f01e0ef= 53090a6edbd35
Gerrit-Change-Number: 1046
Gerrit-PatchSet: 1
Gerrit-Owner: comododragon <rein.vanbaaren@= ...1435...>
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
--tFOjIir21tU=--