Skip to contentSkip to conversation

Enable usage of TLS groups not identified by a NID in OpenSSL 3

PATCH In review Michael Baentsch 3 participants 5 messages Mar 29, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Enable usage of TLS groups not identified by a NID in OpenSSL 3

From: Michael <[email protected]...>

OpenSSL3 prefers to specify groups (including EC groups) with names instead of NID to allow also groups provided by providers. This commit also removes the mapping of secp256r1 to prime256v1 for the OpenSSL3 code path as OpenSSL 3.0 recognises secp256r1.1

---
 src/openvpn/ssl_openssl.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
src/openvpn/ssl_openssl.c +10 -1
index b8595174..af97dabc 100644
@@ -572,13 +572,15 @@ void
 tls_ctx_set_tls_groups(struct tls_root_ctx *ctx, const char *groups)
 {
     ASSERT(ctx);
+#if OPENSSL_VERSION_NUMBER < 0x30000000L
     struct gc_arena gc = gc_new();
     /* This method could be as easy as
      *  SSL_CTX_set1_groups_list(ctx->ctx, groups)
-     * but OpenSSL does not like the name secp256r1 for prime256v1
+     * but OpenSSL (< 3.0) does not like the name secp256r1 for prime256v1
      * This is one of the important curves.
      * To support the same name for OpenSSL and mbedTLS, we do
      * this dance.
+     * Also note that the code is wrong in the presence of OpenSSL3 providers.
      */
 
     int groups_count = get_num_elements(groups, ':');
@@ -617,6 +619,13 @@ tls_ctx_set_tls_groups(struct tls_root_ctx *ctx, const char *groups)
                    groups);
     }
     gc_free(&gc);
+#else
+    if (!SSL_CTX_set1_groups_list(ctx->ctx, groups))
+    {
+        crypto_msg(M_FATAL, "Failed to set allowed TLS group list: %s",
+                   groups);
+    }
+#endif
 }
 
 void
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw

Am 29.03.22 um 07:37 schrieb Michael Baentsch:

Quoted 6 lines

From: Michael <[email protected]...>

OpenSSL3 prefers to specify groups (including EC groups) with names instead of NID to allow also groups provided by providers. This commit also removes the mapping of secp256r1 to prime256v1 for the OpenSSL3 code path as OpenSSL 3.0 recognises secp256r1.

#2 lore raw
In reply to Michael Baentsch

Hi,

Quoted 7 lines · Michael Baentsch

From: Michael <[email protected]...>

OpenSSL3 prefers to specify groups (including EC groups) with names instead of NID to allow also groups provided by providers. This commit also removes the mapping of secp256r1 to prime256v1 for the OpenSSL3 code path as OpenSSL 3.0 recognises secp256r1.1
---

If Arne is fine with the actual change, I think the commit message is good to go. The "From:" line (which is what git recorded as author) is a bit weird - if you're fine with that, I'll use your e-mail From:
instead, also for the "signed-off-by:" header.

(The exact meaning of the signed-off-by: is a bit fuzzy to me - our developer docs say "patch is ready to be applied", but they also say "if it is missing, the value of From: is used". Some other voices interpret it as "yes, I've read the project guidelines and license, and agree to them"...)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#3 lore raw

Am 29.03.22 um 12:28 schrieb Gert Doering:

Quoted 10 lines

Hi,

Quoted 7 lines · Michael Baentsch

From: Michael <[email protected]...>

OpenSSL3 prefers to specify groups (including EC groups) with names instead of NID to allow also groups provided by providers. This commit also removes the mapping of secp256r1 to prime256v1 for the OpenSSL3 code path as OpenSSL 3.0 recognises secp256r1.1
---

Quoted 4 lines

If Arne is fine with the actual change, I think the commit message is good to go. The "From:" line (which is what git recorded as author) is a bit weird - if you're fine with that, I'll use your e-mail From:
instead, also for the "signed-off-by:" header.

What do you consider weird in there? My name is Michael and I prefer to not use a real email address in git commit messages:

<[email protected]...> is the ID github assigned to my "baentsch" github ID .

But then again, OpenVPN is not using github, so linking to that ID won't work anyway...

So, OK, go ahead and use "Michael Baentsch ([email protected]...)" as From:

Quoted 8 lines

(The exact meaning of the signed-off-by: is a bit fuzzy to me - our developer docs say "patch is ready to be applied", but they also say "if it is missing, the value of From: is used". Some other voices interpret it as "yes, I've read the project guidelines and license, and agree to them"...)

gert

Thanks in advance,

--Michael

#4 lore raw
In reply to Michael Baentsch

Your patch has been applied to the master branch.

Thanks :-)

commit 711a4044a095e83bb70f4620310d385d6f5c7282

Author: Michael Baentsch
Date:   Tue Mar 29 07:37:09 2022 +0200
     Enable usage of TLS groups not identified by a NID in OpenSSL 3

     Signed-off-by: Michael Baentsch <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg24012.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering