Skip to contentSkip to conversation

Change in openvpn[master]: ssl_openssl: Use correct return type for RSA_size

Openvpn-devel In review flichtenheld (Code Review) 2 participants 7 messages Jan 27 – Mar 4 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.1769512571000.Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f@...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/+/1493?usp=email

to review the following change.

Change subject: ssl_openssl: Use correct return type for RSA_size
......................................................................

ssl_openssl: Use correct return type for RSA_size

It returns int, so use that. Avoids a sign-compare warning.

Change-Id Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f

---
M src/openvpn/ssl_openssl.c

1 file changed, 2 insertions(+), 12 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/93/1493/1

src/openvpn/ssl_openssl.c +2 -12
index c61e4b2..d8c4587 100644
@@ -1491,17 +1491,11 @@
     return len;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /* sign arbitrary data */
 static int
 rsa_priv_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
 {
-    unsigned int len = RSA_size(rsa);
-    int ret = -1;
+    int len = RSA_size(rsa);
 
     if (padding != RSA_PKCS1_PADDING && padding != RSA_NO_PADDING)
     {
@@ -1509,15 +1503,11 @@
         return -1;
     }
 
-    ret = get_sig_from_man(from, flen, to, len, get_rsa_padding_name(padding));
+    int ret = get_sig_from_man(from, flen, to, len, get_rsa_padding_name(padding));
 
     return (ret == len) ? ret : -1;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static int
 tls_ctx_use_external_rsa_key(struct tls_root_ctx *ctx, EVP_PKEY *pkey)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1493?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: Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f
Gerrit-Change-Number: 1493
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/+/1493?usp=email )

Change subject: ssl_openssl: Use correct return type for RSA_size
......................................................................

Patch Set 5: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1493?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: Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f
Gerrit-Change-Number: 1493
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 15:35:22 +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.

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

Change subject: ssl_openssl: Use correct return type for RSA_size
......................................................................

Patch Set 5: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1493?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: Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f
Gerrit-Change-Number: 1493
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 04 Mar 2026 14:40:14 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#4 lore raw

PATCH v5 1/1 ssl_openssl: Use correct return type for RSA_size

In reply to a message not in the archive

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

It returns int, so use that. Avoids a sign-compare warning.

Change-Id Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f

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

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

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

src/openvpn/ssl_openssl.c +2 -12
index c61e4b2..d8c4587 100644
@@ -1491,17 +1491,11 @@
     return len;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /* sign arbitrary data */
 static int
 rsa_priv_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
 {
-    unsigned int len = RSA_size(rsa);
-    int ret = -1;
+    int len = RSA_size(rsa);
 
     if (padding != RSA_PKCS1_PADDING && padding != RSA_NO_PADDING)
     {
@@ -1509,15 +1503,11 @@
         return -1;
     }
 
-    ret = get_sig_from_man(from, flen, to, len, get_rsa_padding_name(padding));
+    int ret = get_sig_from_man(from, flen, to, len, get_rsa_padding_name(padding));
 
     return (ret == len) ? ret : -1;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static int
 tls_ctx_use_external_rsa_key(struct tls_root_ctx *ctx, EVP_PKEY *pkey)
 {
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: ssl_openssl: Use correct return type for RSA_size

Trivially correct ;-) - and easier-to-understand logic while at it.

Your patch has been applied to the master branch.

commit 8289589a5afd63def246a5e1e7b87f12c4c2f15a

Author: Frank Lichtenheld
Date:   Wed Mar 4 15:40:21 2026 +0100
     ssl_openssl: Use correct return type for RSA_size

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1493
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg35890.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 (#6) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1493?usp=email )

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

Change subject: ssl_openssl: Use correct return type for RSA_size
......................................................................

ssl_openssl: Use correct return type for RSA_size

It returns int, so use that. Avoids a sign-compare warning.

Change-Id Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f

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

---
M src/openvpn/ssl_openssl.c

1 file changed, 2 insertions(+), 12 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/93/1493/6

src/openvpn/ssl_openssl.c +2 -12
index 095f893..840d9a0 100644
@@ -1491,17 +1491,11 @@
     return len;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /* sign arbitrary data */
 static int
 rsa_priv_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
 {
-    unsigned int len = RSA_size(rsa);
-    int ret = -1;
+    int len = RSA_size(rsa);
 
     if (padding != RSA_PKCS1_PADDING && padding != RSA_NO_PADDING)
     {
@@ -1509,15 +1503,11 @@
         return -1;
     }
 
-    ret = get_sig_from_man(from, flen, to, len, get_rsa_padding_name(padding));
+    int ret = get_sig_from_man(from, flen, to, len, get_rsa_padding_name(padding));
 
     return (ret == len) ? ret : -1;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static int
 tls_ctx_use_external_rsa_key(struct tls_root_ctx *ctx, EVP_PKEY *pkey)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1493?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: Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f
Gerrit-Change-Number: 1493
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[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/+/1493?usp=email )

Change subject: ssl_openssl: Use correct return type for RSA_size
......................................................................

ssl_openssl: Use correct return type for RSA_size

It returns int, so use that. Avoids a sign-compare warning.

Change-Id Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f

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

---
M src/openvpn/ssl_openssl.c

1 file changed, 2 insertions(+), 12 deletions(-)
src/openvpn/ssl_openssl.c +2 -12
index 095f893..840d9a0 100644
@@ -1491,17 +1491,11 @@
     return len;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /* sign arbitrary data */
 static int
 rsa_priv_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
 {
-    unsigned int len = RSA_size(rsa);
-    int ret = -1;
+    int len = RSA_size(rsa);
 
     if (padding != RSA_PKCS1_PADDING && padding != RSA_NO_PADDING)
     {
@@ -1509,15 +1503,11 @@
         return -1;
     }
 
-    ret = get_sig_from_man(from, flen, to, len, get_rsa_padding_name(padding));
+    int ret = get_sig_from_man(from, flen, to, len, get_rsa_padding_name(padding));
 
     return (ret == len) ? ret : -1;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 static int
 tls_ctx_use_external_rsa_key(struct tls_root_ctx *ctx, EVP_PKEY *pkey)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1493?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: Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f
Gerrit-Change-Number: 1493
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>