[Openvpn-devel,v2] ssl_openssl: fix -Wsign-conversion in tls_ctx_set_tls_groups()

Message ID 20261117172524.11381-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v2] ssl_openssl: fix -Wsign-conversion in tls_ctx_set_tls_groups() |

Commit Message

Gert Doering Nov. 17, 2026, 5:25 p.m. UTC
  From: Razvan Cojocaru <razvanc@mailbox.org>

Since 7d46ff17 dropped the -Wsign-conversion pragma, LibreSSL and
AWS-LC CI builds fail: their SSL_CTX_set1_groups() takes a size_t
length, but glistlen is an int.

The buildbot LibreSSL builds pass because the headers also define
SSL_CTX_set1_groups as a macro, and clang suppresses warnings in
expansions of system header macros. CI includes the libraries with
plain -I, so their headers aren't system headers and the warning fires.

OpenSSL 1.1.1's macro passes the length to SSL_CTX_ctrl() as a long,
so add openssl_groups_len_t to pick the type per library.

Change-Id: I33123fe621512376410765031fc9ae68cdd91a6c
Signed-off-by: Razvan Cojocaru <razvanc@mailbox.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2214
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2214
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <frank@lichtenheld.com>
  

Comments

Gert Doering Nov. 17, 2026, 5:47 p.m. UTC | #1
Thanks... verified in a private GHA run.  All green and no fail mails!

Your patch has been applied to the master branch.

commit c19bdda311b56048c2de66d827c09eb3a255019e
Author: Razvan Cojocaru
Date:   Tue Nov 17 18:25:18 2026 +0100

     ssl_openssl: fix -Wsign-conversion in tls_ctx_set_tls_groups()

     Signed-off-by: Razvan Cojocaru <razvanc@mailbox.org>
     Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2214
     Message-Id: <20261117172524.11381-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg41565.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
  

Patch

diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h
index 8309cee..ae182d2 100644
--- a/src/openvpn/openssl_compat.h
+++ b/src/openvpn/openssl_compat.h
@@ -61,6 +61,14 @@ 
 typedef uint64_t openssl_opt_t;
 #endif
 
+/* SSL_CTX_set1_groups() length: size_t in LibreSSL and AWS-LC, passed to
+ * SSL_CTX_ctrl() as long by OpenSSL 1.1.1's macro */
+#if defined(LIBRESSL_VERSION_NUMBER) || defined(OPENSSL_IS_AWSLC)
+typedef size_t openssl_groups_len_t;
+#else
+typedef long openssl_groups_len_t;
+#endif
+
 
 /* Functionality missing in LibreSSL before 3.5 */
 #if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x3050000fL
diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
index 30ef383..b95de8e 100644
--- a/src/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -535,7 +535,7 @@ 
     ALLOC_ARRAY_CLEAR_GC(glist, int, groups_count, &gc);
 
     /* Parse allowed ciphers, getting IDs */
-    int glistlen = 0;
+    openssl_groups_len_t glistlen = 0;
     char *tmp_groups = string_alloc(groups, &gc);
 
     const char *token;