Skip to contentSkip to conversation

Change in openvpn[master]: openssl_compat: Avoid conversion warning for SSL_get_negotiated_group

Openvpn-devel In review flichtenheld (Code Review) 2 participants 7 messages Nov 7, 2025 – Nov 12, 2025 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.1762529900000.I31024f93d9d9d0f678fb39d4758a7e870bf00873@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

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

to review the following change.

Change subject: openssl_compat: Avoid conversion warning for SSL_get_negotiated_group
......................................................................

openssl_compat: Avoid conversion warning for SSL_get_negotiated_group

SSL_get_negotiated_group is documented to return int and SSL_group_to_name definitely expects an int.

But SSL_get_negotiated_group is actually a macro implemented by SSL_ctrl, which does return a long. So to avoid the conversion warning we need the cast.

Change-Id I31024f93d9d9d0f678fb39d4758a7e870bf00873

---
M src/openvpn/openssl_compat.h

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/1359/1

src/openvpn/openssl_compat.h +1 -10
index fb3c9b1..b9af132 100644
@@ -194,21 +194,12 @@
           LIBRESSL_VERSION_NUMBER > 0x3050400fL) */
 
 #if OPENSSL_VERSION_NUMBER < 0x30200000L && OPENSSL_VERSION_NUMBER >= 0x30000000L
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static inline const char *
 SSL_get0_group_name(SSL *s)
 {
-    int nid = SSL_get_negotiated_group(s);
+    int nid = (int)SSL_get_negotiated_group(s);
     return SSL_group_to_name(s, nid);
 }
-
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
 #endif
 
 /* Introduced in OpenSSL 3.6.0 */

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

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

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

Attention is currently required from: flichtenheld.

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

Change subject: openssl_compat: Avoid conversion warning for SSL_get_negotiated_group
......................................................................

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I31024f93d9d9d0f678fb39d4758a7e870bf00873
Gerrit-Change-Number: 1359
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 11 Nov 2025 10:59:25 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

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

Attention is currently required from: flichtenheld.

Hello plaisthos,

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

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

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

The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied now.

Change subject: openssl_compat: Avoid conversion warning for SSL_get_negotiated_group
......................................................................

openssl_compat: Avoid conversion warning for SSL_get_negotiated_group

SSL_get_negotiated_group is documented to return int and SSL_group_to_name definitely expects an int.

But SSL_get_negotiated_group is actually a macro implemented by SSL_ctrl, which does return a long. So to avoid the conversion warning we need the cast.

Change-Id I31024f93d9d9d0f678fb39d4758a7e870bf00873

---
M src/openvpn/openssl_compat.h

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/1359/2

src/openvpn/openssl_compat.h +1 -10
index fb3c9b1..b9af132 100644
@@ -194,21 +194,12 @@
           LIBRESSL_VERSION_NUMBER > 0x3050400fL) */
 
 #if OPENSSL_VERSION_NUMBER < 0x30200000L && OPENSSL_VERSION_NUMBER >= 0x30000000L
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static inline const char *
 SSL_get0_group_name(SSL *s)
 {
-    int nid = SSL_get_negotiated_group(s);
+    int nid = (int)SSL_get_negotiated_group(s);
     return SSL_group_to_name(s, nid);
 }
-
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
 #endif
 
 /* Introduced in OpenSSL 3.6.0 */

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

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

#4 lore raw

PATCH v2 1/1 openssl_compat: Avoid conversion warning for SSL_get_negotiated_group

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

SSL_get_negotiated_group is documented to return int and SSL_group_to_name definitely expects an int.

But SSL_get_negotiated_group is actually a macro implemented by SSL_ctrl, which does return a long. So to avoid the conversion warning we need the cast.

Change-Id I31024f93d9d9d0f678fb39d4758a7e870bf00873

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1359
---

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/+/1359
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>

src/openvpn/openssl_compat.h +1 -10
index fb3c9b1..b9af132 100644
@@ -194,21 +194,12 @@
           LIBRESSL_VERSION_NUMBER > 0x3050400fL) */
 
 #if OPENSSL_VERSION_NUMBER < 0x30200000L && OPENSSL_VERSION_NUMBER >= 0x30000000L
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static inline const char *
 SSL_get0_group_name(SSL *s)
 {
-    int nid = SSL_get_negotiated_group(s);
+    int nid = (int)SSL_get_negotiated_group(s);
     return SSL_group_to_name(s, nid);
 }
-
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
 #endif
 
 /* Introduced in OpenSSL 3.6.0 */
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: openssl_compat: Avoid conversion warning for SSL_get_negotiated_group

Patch looks reasonable, has an ACK from Arne, and BB is all green...

.. and one set of #pragma's gone, hooray.

Your patch has been applied to the master branch.

commit 4fa8539a088e490633e0f7114c21e03d61871dd6

Author: Frank Lichtenheld
Date:   Tue Nov 11 16:32:24 2025 +0100
     openssl_compat: Avoid conversion warning for SSL_get_negotiated_group

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1359
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg34316.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

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

cron2 has uploaded a new patch set (#3) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1359?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by plaisthos

Change subject: openssl_compat: Avoid conversion warning for SSL_get_negotiated_group
......................................................................

openssl_compat: Avoid conversion warning for SSL_get_negotiated_group

SSL_get_negotiated_group is documented to return int and SSL_group_to_name definitely expects an int.

But SSL_get_negotiated_group is actually a macro implemented by SSL_ctrl, which does return a long. So to avoid the conversion warning we need the cast.

Change-Id I31024f93d9d9d0f678fb39d4758a7e870bf00873

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1359
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34316.html

---
M src/openvpn/openssl_compat.h

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/1359/3

src/openvpn/openssl_compat.h +1 -10
index fb3c9b1..b9af132 100644
@@ -194,21 +194,12 @@
           LIBRESSL_VERSION_NUMBER > 0x3050400fL) */
 
 #if OPENSSL_VERSION_NUMBER < 0x30200000L && OPENSSL_VERSION_NUMBER >= 0x30000000L
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static inline const char *
 SSL_get0_group_name(SSL *s)
 {
-    int nid = SSL_get_negotiated_group(s);
+    int nid = (int)SSL_get_negotiated_group(s);
     return SSL_group_to_name(s, nid);
 }
-
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
 #endif
 
 /* Introduced in OpenSSL 3.6.0 */

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I31024f93d9d9d0f678fb39d4758a7e870bf00873
Gerrit-Change-Number: 1359
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

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

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1359?usp=email )

Change subject: openssl_compat: Avoid conversion warning for SSL_get_negotiated_group
......................................................................

openssl_compat: Avoid conversion warning for SSL_get_negotiated_group

SSL_get_negotiated_group is documented to return int and SSL_group_to_name definitely expects an int.

But SSL_get_negotiated_group is actually a macro implemented by SSL_ctrl, which does return a long. So to avoid the conversion warning we need the cast.

Change-Id I31024f93d9d9d0f678fb39d4758a7e870bf00873

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1359
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34316.html

---
M src/openvpn/openssl_compat.h

1 file changed, 1 insertion(+), 10 deletions(-)
src/openvpn/openssl_compat.h +1 -10
index fb3c9b1..b9af132 100644
@@ -194,21 +194,12 @@
           LIBRESSL_VERSION_NUMBER > 0x3050400fL) */
 
 #if OPENSSL_VERSION_NUMBER < 0x30200000L && OPENSSL_VERSION_NUMBER >= 0x30000000L
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static inline const char *
 SSL_get0_group_name(SSL *s)
 {
-    int nid = SSL_get_negotiated_group(s);
+    int nid = (int)SSL_get_negotiated_group(s);
     return SSL_group_to_name(s, nid);
 }
-
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
 #endif
 
 /* Introduced in OpenSSL 3.6.0 */

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

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I31024f93d9d9d0f678fb39d4758a7e870bf00873
Gerrit-Change-Number: 1359
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>