From: "flichtenheld (Code Review)" Date: Wed, 17 Dec 2025 14:25:27 +0000 In-Reply-To: References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="xyaBlrZWBb8="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: crypto_openssl: Fix various conversion warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --xyaBlrZWBb8= 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/+/1446?usp=3Demail to look at the new patch set (#2). Change subject: crypto_openssl: Fix various conversion warnings ...................................................................... crypto_openssl: Fix various conversion warnings EVP_CIPHER_CTX_flags is documented to output int in OpenSSL, but is actually unsigned long in OpenSSL 3. In libressl it is correctly documented to output unsigned long. Change-Id: I99bc4692526f9143a913e29b266a1816295dfd51 Signed-off-by: Frank Lichtenheld --- M src/openvpn/crypto_openssl.c 1 file changed, 4 insertions(+), 13 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/46/1446/2 diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c index ec0269c..19359f3 100644 --- a/src/openvpn/crypto_openssl.c +++ b/src/openvpn/crypto_openssl.c @@ -896,11 +896,6 @@ return EVP_CIPHER_CTX_mode(ctx); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - bool cipher_ctx_mode_cbc(const cipher_ctx_t *ctx) { @@ -909,7 +904,7 @@ return false; } - int flags =3D EVP_CIPHER_CTX_flags(ctx); + unsigned long flags =3D EVP_CIPHER_CTX_flags(ctx); int mode =3D EVP_CIPHER_CTX_mode(ctx); return mode =3D=3D EVP_CIPH_CBC_MODE @@ -940,7 +935,7 @@ { if (ctx) { - int flags =3D EVP_CIPHER_CTX_flags(ctx); + unsigned long flags =3D EVP_CIPHER_CTX_flags(ctx); if (flags & EVP_CIPH_FLAG_AEAD_CIPHER) { return true; @@ -995,8 +990,8 @@ cipher_ctx_final_check_tag(EVP_CIPHER_CTX *ctx, uint8_t *dst, int *dst_len= , uint8_t *tag, size_t tag_len) { - ASSERT(tag_len < SIZE_MAX); - if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tag_len, tag)) + ASSERT(tag_len < INT_MAX); + if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, (int)tag_len, tag= )) { return 0; } @@ -1004,10 +999,6 @@ return cipher_ctx_final(ctx, dst, dst_len); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - /* * * Generic message digest information functions -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1446?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: I99bc4692526f9143a913e29b266a1816295dfd51 Gerrit-Change-Number: 1446 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --xyaBlrZWBb8= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld uploaded patch set #2 to this change.

<= p>View C= hange

crypto_openssl: Fix various conversion warnings<=
br>
EVP_CIPHER_CTX_flags is documented to output
int in OpenSSL, but = is actually unsigned long
in OpenSSL 3.
In libressl it is correctly d= ocumented to output
unsigned long.

Change-Id: I99bc4692526f9143a9= 13e29b266a1816295dfd51
Signed-off-by: Frank Lichtenheld <frank@...2716...= 1...>
---
M src/openvpn/crypto_openssl.c
1 file changed, 4 inse= rtions(+), 13 deletions(-)

git pull ssh://gerrit=
.openvpn.net:29418/openvpn refs/changes/46/1446/2
diff --git a/src/=
openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
ind= ex ec0269c..19359f3 100644
--- a/src/openvpn/crypto_openssl= .c
+++ b/src/openvpn/crypto_openssl.c
@@ -8= 96,11 +896,6 @@
return EVP_CIPHER_CTX_mode(ctx);
}

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "= -Wconversion"

-#en= dif
-
= bool
cipher_ctx_mode_cbc(const cipher_ctx_t *ctx) {
@@ -909,7 +904,7 @@
ret= urn false;
}

- int flags =3D EVP_CIPHER_CTX_flags(ctx)= ;
+ unsigned long = flags =3D EVP_CIPHER_CTX_flags(ctx);
int mode =3D EVP_= CIPHER_CTX_mode(ctx);

return mode = =3D=3D EVP_CIPH_CBC_MODE
@@ -940,7 +935,7 @@
{
if (ctx)
{
- int flags =3D EVP_CIPHER_CTX_fl= ags(ctx);
+ un= signed long flags =3D EVP_CIPHER_CTX_flags(ctx);
i= f (flags & EVP_CIPH_FLAG_AEAD_CIPHER)
{=
return true;
@@ -995,8 +990,8 @@
cipher_ctx_final_check_tag(EVP_CIPHER_CTX *ctx, uint8_t *dst,= int *dst_len, uint8_t *tag,
si= ze_t tag_len)
{
- ASSERT(tag_len < SIZE_MAX);
- if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET= _TAG, tag_len, tag))
= + ASSERT(tag_len < INT_MAX);
+ if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, (in= t)tag_len, tag))
{
return 0;<= /span>
}
@@ -1004,10 +999,6 @@
return cipher_ctx_final(ctx, dst, dst_len);

}

-#if defin= ed(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
change 1446. To unsubscribe, or for help writing mail filters, visit = settings.
=
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I99bc4692526f9143a913e29b266= a1816295dfd51
Gerrit-Change-Number: 1446
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --xyaBlrZWBb8=--