From: "MaxF (Code Review)" Date: Wed, 28 Jan 2026 16:59:26 +0000 In-Reply-To: References: Reply-To: max@...2606..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <0c19a724ed7ce38ca5f22fd9582be5d19290c865-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="oz4wIH1kPUg="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Mbed TLS 4: Add more algorithms List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --oz4wIH1kPUg= 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 reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/1500?usp=3Demail to look at the new patch set (#2). Change subject: Mbed TLS 4: Add more algorithms ...................................................................... Mbed TLS 4: Add more algorithms Expand the tables of hash functions and elliptic curve groups, and also check if they are compiled in. Change-Id: I740991f22b728fe2f5a48bc18d5ca4b62f56f399 Signed-off-by: Max Fillinger --- M src/openvpn/crypto_mbedtls.c M src/openvpn/ssl_mbedtls.c 2 files changed, 67 insertions(+), 3 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/00/1500/2 diff --git a/src/openvpn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c index 5418df9..02735cd 100644 --- a/src/openvpn/crypto_mbedtls.c +++ b/src/openvpn/crypto_mbedtls.c @@ -605,10 +605,36 @@ } static const md_info_t md_info_table[] =3D { - /* TODO: Fill out table. */ +#if defined(PSA_WANT_ALG_MD5) { "MD5", PSA_ALG_MD5 }, +#endif +#if defined(PSA_WANT_ALG_SHA_1) { "SHA1", PSA_ALG_SHA_1 }, +#endif +#if defined(PSA_WANT_ALG_SHA_224) + { "SHA224", PSA_ALG_SHA_224 }, +#endif +#if defined(PSA_WANT_ALG_SHA_256) { "SHA256", PSA_ALG_SHA_256 }, +#endif +#if defined(PSA_WANT_ALG_SHA_384) + { "SHA384", PSA_ALG_SHA_384 }, +#endif +#if defined(PSA_WANT_ALG_SHA_512) + { "SHA512", PSA_ALG_SHA_512 }, +#endif +#if defined(PSA_WANT_ALG_SHA3_224) + { "SHA3-224", PSA_ALG_SHA3_224 }, +#endif +#if defined(PSA_WANT_ALG_SHA3_256) + { "SHA3-256", PSA_ALG_SHA3_256 }, +#endif +#if defined(PSA_WANT_ALG_SHA3_384) + { "SHA3-384", PSA_ALG_SHA3_384 }, +#endif +#if defined(PSA_WANT_ALG_SHA3_512) + { "SHA3-512", PSA_ALG_SHA3_512 }, +#endif }; const size_t md_info_table_entries =3D sizeof(md_info_table) / sizeof(md_i= nfo_t); diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c index 3e1698f..eee4962 100644 --- a/src/openvpn/ssl_mbedtls.c +++ b/src/openvpn/ssl_mbedtls.c @@ -356,15 +356,49 @@ #if MBEDTLS_VERSION_NUMBER >=3D 0x04000000 static const mbedtls_ecp_curve_info ecp_curve_info_table[] =3D { - /* TODO: Fill out the table. */ +/* secp curves. */ +#if defined(PSA_WANT_ECC_SECP_R1_256) { "secp256r1", MBEDTLS_SSL_IANA_TLS_GROUP_SECP256R1 }, +#endif +#if defined(PSA_WANT_ECC_SECP_R1_384) { "secp384r1", MBEDTLS_SSL_IANA_TLS_GROUP_SECP384R1 }, +#endif +#if defined(PSA_WANT_ECC_SECP_R1_521) + { "secp521r1", MBEDTLS_SSL_IANA_TLS_GROUP_SECP521R1 }, +#endif + +/* Curve25519. */ +#if defined(PSA_WANT_ECC_MONTGOMERY_255) { "X25519", MBEDTLS_SSL_IANA_TLS_GROUP_X25519 }, +#endif + +/* Brainpool curves. */ +#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256) + { "brainpoolP256r1", MBEDTLS_SSL_IANA_TLS_GROUP_BP256R1 }, +#endif +#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384) + { "brainpoolP384r1", MBEDTLS_SSL_IANA_TLS_GROUP_BP384R1 }, +#endif +#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512) + { "brainpoolP512r1", MBEDTLS_SSL_IANA_TLS_GROUP_BP512R1 }, +#endif + +/* Named Diffie-Hellman groups. */ +#if defined(PSA_WANT_DH_RFC7919_2048) { "ffdhe2048", MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE2048 }, +#endif +#if defined(PSA_WANT_DH_RFC7919_3072) { "ffdhe3072", MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE3072 }, +#endif +#if defined(PSA_WANT_DH_RFC7919_4096) { "ffdhe4096", MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE4096 }, +#endif +#if defined(PSA_WANT_DH_RFC7919_6144) { "ffdhe6144", MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE6144 }, +#endif +#if defined(PSA_WANT_DH_RFC7919_8192) { "ffdhe8192", MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE8192 }, +#endif }; static const size_t ecp_curve_info_table_items =3D sizeof(ecp_curve_info_t= able) / sizeof(mbedtls_ecp_curve_info); @@ -1523,7 +1557,11 @@ pcurve++; } #else - msg(M_FATAL, "Mbed TLS 4 has no mechanism to list supported curves."); + printf("Available elliptic curves:\n\n"); + for (size_t i =3D 0; i < ecp_curve_info_table_items; i++) + { + printf("%s\n", ecp_curve_info_table[i].name); + } #endif /* MBEDTLS_VERSION_NUMBER < 0x04000000 */ } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1500?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I740991f22b728fe2f5a48bc18d5ca4b62f56f399 Gerrit-Change-Number: 1500 Gerrit-PatchSet: 2 Gerrit-Owner: MaxF Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --oz4wIH1kPUg= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

MaxF uploaded patch set #2 to this change.

View Change

Mbed TLS 4: Add more algorithms

Expand the tables= of hash functions and elliptic curve groups, and also
check if they are= compiled in.

Change-Id: I740991f22b728fe2f5a48bc18d5ca4b62f56f399Signed-off-by: Max Fillinger <maximilian.fillinger@...2918...>
-= --
M src/openvpn/crypto_mbedtls.c
M src/openvpn/ssl_mbedtls.c
2 fi= les changed, 67 insertions(+), 3 deletions(-)

gi=
t pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/00/1500/2
<= pre style=3D"font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/openvpn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c<= /span>
index 5418df9..02735cd 100644
--- a/src/ope= nvpn/crypto_mbedtls.c
+++ b/src/openvpn/crypto_mbedtls.c
@@ -605,10 +605,36 @@
}

static const md_info_t md_info_table[] =3D {
- /* TODO: Fill out table. */
+#if defined(PSA_WANT_ALG_= MD5)
{ "MD5", PSA_ALG_MD5 },
+#endif

+#if defined(PSA_WANT_ALG_SHA_1)
= { "SHA1", PSA_ALG_SHA_1 },
+#endif
+#if defined(PSA_WANT_ALG_SHA_224)
+ { "SHA224", PSA_ALG_SHA_224 },<= br>+#endif
+#if defined(PSA_WANT_ALG_SHA_256)=
{ "SHA256", PSA_ALG_SHA_256 },
+#endif
+#if defined(PSA_WANT_ALG_SHA_384)
+ { "SHA384", PSA_ALG_SHA_= 384 },
+#endif=
+#if defined(PSA_WANT_ALG_S= HA_512)
+ { "= SHA512", PSA_ALG_SHA_512 },
+#endif
+= #if defined(PSA_WANT_ALG_SHA3_224)
+ { "SHA3-224", PSA_ALG_SHA3_224 },
+#endif

+#if defined(PSA_WANT_ALG_SHA3_256)
= + { "SHA3-256", PS= A_ALG_SHA3_256 },
+#e= ndif
+#if defined(PSA= _WANT_ALG_SHA3_384)
+= { "SHA3-384", PSA_ALG_SHA3_384 },
+#endif
+#if defined(PSA_WANT_ALG_SHA3_512)
+ { "SHA3-512", PSA_ALG_SHA3_512 = },
+#endif
= };
const size_t md_info_table_entries =3D sizeof(md= _info_table) / sizeof(md_info_t);

diff --= git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c
index 3e1698f..eee4962 100644
--- a/src/openvpn/ssl_mbedtl= s.c
+++ b/src/openvpn/ssl_mbedtls.c
@@ -356= ,15 +356,49 @@

#if MBEDTLS_VERSION_NUMBE= R >=3D 0x04000000
static const mbedtls_ecp_curve_info e= cp_curve_info_table[] =3D {
- /* TODO: Fill out the table. */
+/* secp curves. */
+#if defined(PSA_WANT_ECC_SECP_R1_256)
= { "secp256r1", MBEDTLS_SSL_IANA_TLS_GROUP_SECP256R1 },

+#endif
+#if defined(PSA_WANT_ECC_SECP_R1_384)<= /span>
{ "secp384r1", MBEDTLS_SSL_IANA_TLS_GROUP_SE= CP384R1 },
+#endif
+#if defined(PSA_WANT_E= CC_SECP_R1_521)
+ = { "secp521r1", MBEDTLS_SSL_IANA_TLS_GROUP_SECP521R1 },
= +#endif
+
+/* Curve25519. */
+#if defined(PSA_WANT_ECC_MONTGOMERY_255)
= { "X25519", MBEDTLS_SSL_IANA_TLS_GROUP_X25519 },
+#endif
+
+/* Brainpool curves. */
+#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256)
+ { "brainpoolP256r1", MBED= TLS_SSL_IANA_TLS_GROUP_BP256R1 },
+#endif
= +#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384)
+ { "brainpoolP384r1", MBEDTLS_SSL_IA= NA_TLS_GROUP_BP384R1 },
+#endif
+#if defin= ed(PSA_WANT_ECC_BRAINPOOL_P_R1_512)
+ { "brainpoolP512r1", MBEDTLS_SSL_IANA_TLS_GRO= UP_BP512R1 },
+#endif=
+
+/* Named Diffie-Hellman groups. */
+#if defined(PSA_WANT_DH= _RFC7919_2048)
{ "ffdhe2048", MBEDTLS_SSL_IA= NA_TLS_GROUP_FFDHE2048 },
+#endif
+#if def= ined(PSA_WANT_DH_RFC7919_3072)
{ "ffdhe3072"= , MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE3072 },
+#endif
+#if defined(PSA_WANT_DH_RFC7919_4096)
{ "= ;ffdhe4096", MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE4096 },
+#endif
+#if defined(PSA_WANT_DH_RFC7919_6144)
{ "ffdhe6144", MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE6144 },
+#endif
+#if defined(PSA_WANT_DH_RFC7919_81= 92)

{ "ffdhe8192", MBEDTLS_SSL_IANA_TLS_GROU= P_FFDHE8192 },
+#endi= f
};
static const size_t ecp_curve_info_t= able_items =3D sizeof(ecp_curve_info_table) / sizeof(mbedtls_ecp_curve_info= );

@@ -1523,7 +1557,11 @@
pcurve++;

}
#else- msg(M_FATAL, "Mbed TLS= 4 has no mechanism to list supported curves.");
+ printf("Available elliptic curve= s:\n\n");
+ f= or (size_t i =3D 0; i < ecp_curve_info_table_items; i++)
+ {

+ printf("%s\n", ecp_curve_info_t= able[i].name);
+ }=
#endif /* MBEDTLS_VERSION_NUMBER < 0x04000000 */
}


To view= , visit = change 1500. To unsubscribe, or for help writing mail filters, visit settings.

<= div itemscope itemtype=3D"http://schema.org/EmailMessage">
<= meta itemprop=3D"name" content=3D"View Change"/>
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I740991f22b728fe2f5a48bc18d5= ca4b62f56f399
Gerrit-Change-Number: 1500
Gerrit-PatchSet: 2
Gerrit-Owner: MaxF <max@...2606...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --oz4wIH1kPUg=--