From: "cron2 (Code Review)" Date: Tue, 23 Sep 2025 10:06:26 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <2948eed7fba97f1a5abb56e4bcadc8697a72559c-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="2zq4FEuMzME="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Handle return type of EVP_MD_size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --2zq4FEuMzME= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#9) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1133?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: Handle return type of EVP_MD_size ...................................................................... Handle return type of EVP_MD_size Return type is int, but we often use it in contexts where we expect size_t. So just cast it. Nothing else to do really. Change-Id: I22b93c807f1be99fab450708f686fce4aa6d5cef Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1133 Message-Id: <20250922204059.23226-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59237213/ Signed-off-by: Gert Doering --- M src/openvpn/crypto_openssl.c M src/openvpn/ssl_verify_openssl.c M src/openvpn/xkey_helper.c 3 files changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/33/1133/9 diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c index 1f95fba..2d0265a 100644 --- a/src/openvpn/crypto_openssl.c +++ b/src/openvpn/crypto_openssl.c @@ -1273,7 +1273,7 @@ /* We need to make a copy of the key since the OSSL parameters * only reference it */ - memcpy(ctx->key, key, EVP_MD_size(kt)); + memcpy(ctx->key, key, (size_t)EVP_MD_size(kt)); /* Lookup/setting of parameters in OpenSSL 3.0 are string based * @@ -1282,7 +1282,7 @@ * the constness away here. */ ctx->params[0] =3D OSSL_PARAM_construct_utf8_string("digest", (char *)= EVP_MD_get0_name(kt), 0); - ctx->params[1] =3D OSSL_PARAM_construct_octet_string("key", ctx->key, = EVP_MD_size(kt)); + ctx->params[1] =3D OSSL_PARAM_construct_octet_string("key", ctx->key, = (size_t)EVP_MD_size(kt)); ctx->params[2] =3D OSSL_PARAM_construct_end(); if (!EVP_MAC_init(ctx->ctx, NULL, 0, ctx->params)) diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/ssl_verify_open= ssl.c index 7a7b21e..f1b8902 100644 --- a/src/openvpn/ssl_verify_openssl.c +++ b/src/openvpn/ssl_verify_openssl.c @@ -341,7 +341,7 @@ x509_get_sha1_fingerprint(X509 *cert, struct gc_arena *gc) { const EVP_MD *sha1 =3D EVP_sha1(); - struct buffer hash =3D alloc_buf_gc(EVP_MD_size(sha1), gc); + struct buffer hash =3D alloc_buf_gc((size_t)EVP_MD_size(sha1), gc); X509_digest(cert, EVP_sha1(), BPTR(&hash), NULL); ASSERT(buf_inc_len(&hash, EVP_MD_size(sha1))); return hash; @@ -351,7 +351,7 @@ x509_get_sha256_fingerprint(X509 *cert, struct gc_arena *gc) { const EVP_MD *sha256 =3D EVP_sha256(); - struct buffer hash =3D alloc_buf_gc(EVP_MD_size(sha256), gc); + struct buffer hash =3D alloc_buf_gc((size_t)EVP_MD_size(sha256), gc); X509_digest(cert, EVP_sha256(), BPTR(&hash), NULL); ASSERT(buf_inc_len(&hash, EVP_MD_size(sha256))); return hash; diff --git a/src/openvpn/xkey_helper.c b/src/openvpn/xkey_helper.c index 72a24b5..29208a0 100644 --- a/src/openvpn/xkey_helper.c +++ b/src/openvpn/xkey_helper.c @@ -351,7 +351,7 @@ } } - if (tbslen !=3D EVP_MD_size(EVP_get_digestbyname(mdname))) + if (tbslen !=3D (size_t)EVP_MD_size(EVP_get_digestbyname(mdname))) { msg(M_WARN, "Error: encode_pkcs11: invalid input length <%zu>", tb= slen); goto done; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1133?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I22b93c807f1be99fab450708f686fce4aa6d5cef Gerrit-Change-Number: 1133 Gerrit-PatchSet: 9 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --2zq4FEuMzME= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #9 to the change originally cr= eated by flichtenheld.

View Change

The following approvals got outd= ated and were removed: Code-Review+2 by cron2

Handle return type of EVP_MD_size

Return type= is int, but we often use it in contexts
where we expect size_t. So just= cast it. Nothing else
to do really.

Change-Id: I22b93c807f1be99f= ab450708f686fce4aa6d5cef
Signed-off-by: Frank Lichtenheld <frank@...1665...= 641...>
Acked-by: Gert Doering <gert@...1296...>
Gerrit URL:= https://gerrit.openvpn.net/c/openvpn/+/1133
Message-Id: <20250922204= 059.23226-1-gert@...1296...>
URL: https://sourceforge.net/p/openvpn/m= ailman/message/59237213/
Signed-off-by: Gert Doering <gert@...1296...= >
---
M src/openvpn/crypto_openssl.c
M src/openvpn/ssl_verify_o= penssl.c
M src/openvpn/xkey_helper.c
3 files changed, 5 insertions(+)= , 5 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn =
refs/changes/33/1133/9
diff --git a/src/openvpn/crypto_openssl.c b/=
src/openvpn/crypto_openssl.c
index 1f95fba..2d0265a 100644<= /span>
--- a/src/openvpn/crypto_openssl.c
+++ b/sr= c/openvpn/crypto_openssl.c
@@ -1273,7 +1273,7 @@
=
/* We need to make a copy of the key since the= OSSL parameters
* only reference it */
- memcpy(ctx->key, key, EVP_MD= _size(kt));

+ memc= py(ctx->key, key, (size_t)EVP_MD_size(kt));

= /* Lookup/setting of parameters in OpenSSL 3.0 are string based<= /span>
*
@@ -1282,7 +1282,7 @@
* the constness away here.

*/
ctx->params[0] =3D OSSL_PARAM_construct_utf8_string("digest&= quot;, (char *)EVP_MD_get0_name(kt), 0);
- ctx->params[1] =3D OSSL_PARAM_construct_octet_str= ing("key", ctx->key, EVP_MD_size(kt));
+ ctx->params[1] =3D OSSL_PARAM_cons= truct_octet_string("key", ctx->key, (size_t)EVP_MD_size(kt));<= /span>
ctx->params[2] =3D OSSL_PARAM_construct_end();


if (!EVP_MAC_init(ctx->ctx, NULL, 0, = ctx->params))
diff --git a/src/openvpn/ssl_verify_openss= l.c b/src/openvpn/ssl_verify_openssl.c
index 7a7b21e..f1b89= 02 100644
--- a/src/openvpn/ssl_verify_openssl.c
= +++ b/src/openvpn/ssl_verify_openssl.c
@@ -341,7 +341= ,7 @@
x509_get_sha1_fingerprint(X509 *cert, struct gc_aren= a *gc)
{
const EVP_MD *sha1 =3D EVP_s= ha1();
- struct buff= er hash =3D alloc_buf_gc(EVP_MD_size(sha1), gc);
+ struct buffer hash =3D alloc_buf_gc((size_= t)EVP_MD_size(sha1), gc);
X509_digest(cert, EVP_sha1()= , BPTR(&hash), NULL);
ASSERT(buf_inc_len(&hash= , EVP_MD_size(sha1)));
return hash;
@@= -351,7 +351,7 @@
x509_get_sha256_fingerprint(X509 *cert, = struct gc_arena *gc)
{
const EVP_MD *= sha256 =3D EVP_sha256();
+ struct buffer hash =3D= alloc_buf_gc((size_t)EVP_MD_size(sha256), gc);
X509_d= igest(cert, EVP_sha256(), BPTR(&hash), NULL);
ASSE= RT(buf_inc_len(&hash, EVP_MD_size(sha256)));
retur= n hash;
diff --git a/src/openvpn/xkey_helper.c b/src/openvp= n/xkey_helper.c
index 72a24b5..29208a0 100644
--- a/src/openvpn/xkey_helper.c
+++ b/src/openvpn/xkey_h= elper.c
@@ -351,7 +351,7 @@
}
}

- if (tbslen !=3D EVP_MD_size(EVP_get_digestbyname(mdname)= ))
+ if (tbslen != =3D (size_t)EVP_MD_size(EVP_get_digestbyname(mdname)))
= {
msg(M_WARN, "Error: encode_pkcs11: invalid= input length <%zu>", tbslen);
goto don= e;

To view, visit change 1133. To unsubscri= be, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I22b93c807f1be99fab450708f68= 6fce4aa6d5cef
Gerrit-Change-Number: 1133
Gerrit-PatchSet: 9
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--2zq4FEuMzME=--