From: "cron2 (Code Review)" Date: Mon, 16 Feb 2026 15:31:56 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <5a9e9003dfa0434d2cf1957e1ec6e57474001987-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="1ORjPH40Pqs="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: Improve signature of md_full to avoid conversions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --1ORjPH40Pqs= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1512?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: crypto_backend: Improve signature of md_full to avoid conve= rsions ...................................................................... crypto_backend: Improve signature of md_full to avoid conversions Change-Id: I201abb9ef013c061fb568823098edcca32cb2df3 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1512 Message-Id: <20260216150711.16130-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 657.html Signed-off-by: Gert Doering --- M src/openvpn/crypto_backend.h M src/openvpn/crypto_mbedtls.c M src/openvpn/crypto_mbedtls_legacy.c M src/openvpn/crypto_openssl.c 4 files changed, 13 insertions(+), 13 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/12/1512/2 diff --git a/src/openvpn/crypto_backend.h b/src/openvpn/crypto_backend.h index 5248614..7f5507a 100644 --- a/src/openvpn/crypto_backend.h +++ b/src/openvpn/crypto_backend.h @@ -557,9 +557,9 @@ * @param src_len The length of the incoming buffer. * @param dst Buffer to write the message digest to. May not be = NULL. * - * @return \c 1 on success, \c 0 on failure + * @return true on success, false on failure */ -int md_full(const char *mdname, const uint8_t *src, int src_len, uint8_t *= dst); +bool md_full(const char *mdname, const uint8_t *src, size_t src_len, uint8= _t *dst); /* * Allocate a new message digest context diff --git a/src/openvpn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c index 02735cd..cba6bb5 100644 --- a/src/openvpn/crypto_mbedtls.c +++ b/src/openvpn/crypto_mbedtls.c @@ -696,13 +696,13 @@ return ctx; } -int -md_full(const char *mdname, const uint8_t *src, int src_len, uint8_t *dst) +bool +md_full(const char *mdname, const uint8_t *src, size_t src_len, uint8_t *d= st) { const md_info_t *md =3D md_get(mdname); if (md =3D=3D NULL || src_len < 0) { - return 0; + return false; } /* We depend on the caller to ensure that dst has enough room for the = hash, @@ -710,12 +710,12 @@ size_t dst_size =3D PSA_HASH_LENGTH(md->psa_alg); size_t hash_length =3D 0; - psa_status_t status =3D psa_hash_compute(md->psa_alg, src, (size_t)src= _len, dst, dst_size, &hash_length); + psa_status_t status =3D psa_hash_compute(md->psa_alg, src, src_len, ds= t, dst_size, &hash_length); if (status !=3D PSA_SUCCESS || hash_length !=3D dst_size) { - return 0; + return false; } - return 1; + return true; } void diff --git a/src/openvpn/crypto_mbedtls_legacy.c b/src/openvpn/crypto_mbedt= ls_legacy.c index b8e7d6a..00fe542 100644 --- a/src/openvpn/crypto_mbedtls_legacy.c +++ b/src/openvpn/crypto_mbedtls_legacy.c @@ -825,8 +825,8 @@ * */ -int -md_full(const char *mdname, const uint8_t *src, int src_len, uint8_t *dst) +bool +md_full(const char *mdname, const uint8_t *src, size_t src_len, uint8_t *d= st) { const mbedtls_md_info_t *kt =3D md_get(mdname); return 0 =3D=3D mbedtls_md(kt, src, src_len, dst); diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c index ed39efa..0c6de18 100644 --- a/src/openvpn/crypto_openssl.c +++ b/src/openvpn/crypto_openssl.c @@ -1104,15 +1104,15 @@ * */ -int -md_full(const char *mdname, const uint8_t *src, int src_len, uint8_t *dst) +bool +md_full(const char *mdname, const uint8_t *src, size_t src_len, uint8_t *d= st) { unsigned int in_md_len =3D 0; evp_md_type *kt =3D md_get(mdname); int ret =3D EVP_Digest(src, src_len, dst, &in_md_len, kt, NULL); EVP_MD_free(kt); - return ret; + return ret =3D=3D 1; } EVP_MD_CTX * -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1512?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: I201abb9ef013c061fb568823098edcca32cb2df3 Gerrit-Change-Number: 1512 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --1ORjPH40Pqs= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #2 to the change originally created by flichtenhel= d.

View Change

The following approvals got outdated and were remove= d: Code-Review+2 by cron2

crypto_backend: Improve signature o=
f md_full to avoid conversions

Change-Id: I201abb9ef013c061fb5688230= 98edcca32cb2df3
Signed-off-by: Frank Lichtenheld <frank@...2641...>= ;
Acked-by: Gert Doering <gert@...1296...>
Gerrit URL: https://= gerrit.openvpn.net/c/openvpn/+/1512
Message-Id: <20260216150711.16130= -1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@...465...= ists.sourceforge.net/msg35657.html
Signed-off-by: Gert Doering <gert@= ...1296...>
---
M src/openvpn/crypto_backend.h
M src/openvpn/cr= ypto_mbedtls.c
M src/openvpn/crypto_mbedtls_legacy.c
M src/openvpn/cr= ypto_openssl.c
4 files changed, 13 insertions(+), 13 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/c=
hanges/12/1512/2
diff --git a/src/openvpn/crypto_backend.h b/src/op=
envpn/crypto_backend.h
index 5248614..7f5507a 100644=
--- a/src/openvpn/crypto_backend.h
+++ b/src/open= vpn/crypto_backend.h
@@ -557,9 +557,9 @@
= * @param src_len The length of the incoming buffer.
= * @param dst Buffer to write the message digest to. May not be N= ULL.
*
+ * @return true on suc= cess, false on failure
*/
-int md_full(const char *mdname, const uint8_t *src, i= nt src_len, uint8_t *dst);
+bool md_full(const char *mdname, const uint8_t *src, size_t src_len,= uint8_t *dst);

/*
* A= llocate a new message digest context
diff --git a/src/openv= pn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c
index 02= 735cd..cba6bb5 100644
--- a/src/openvpn/crypto_mbedtls.c
+++ b/src/openvpn/crypto_mbedtls.c
@@ -696,13= +696,13 @@
return ctx;
}
<= span>

-int
<= span style=3D"color: hsl(0, 100%, 40%);">-md_full(const char *mdname, const= uint8_t *src, int src_len, uint8_t *dst)
+bool
+md_full(const char *mdname, const uint8_t *src, size_t src_len, uint= 8_t *dst)
{
const md_info_t *md =3D m= d_get(mdname);
if (md =3D=3D NULL || src_len < 0)
{
-= return 0;
+ = return false;
}

/* We depend on the caller to ensure that dst has enough room for th= e hash,

@@ -710,12 +710,12 @@
size_t d= st_size =3D PSA_HASH_LENGTH(md->psa_alg);
size_t ha= sh_length =3D 0;

- psa_status_t status =3D psa_hash_compute(md->psa_alg, s= rc, (size_t)src_len, dst, dst_size, &hash_length);
+ psa_status_t status =3D psa_hash_com= pute(md->psa_alg, src, src_len, dst, dst_size, &hash_length);=
if (status !=3D PSA_SUCCESS || hash_length !=3D dst_size)
{
- = return 0;
+ = return false;
}
- return 1;
+ return true;
}
<= br> void
diff --git a/src/openvpn/crypto_mbedtls_lega= cy.c b/src/openvpn/crypto_mbedtls_legacy.c
index b8e7d6a..0= 0fe542 100644
--- a/src/openvpn/crypto_mbedtls_legacy.c
+++ b/src/openvpn/crypto_mbedtls_legacy.c
@@ -= 825,8 +825,8 @@
*
*/
<= /span>
-int
-md_full(const char *mdname, const uint8_= t *src, int src_len, uint8_t *dst)
+bool
+= md_full(const char *mdname, const uint8_t *src, size_t src_len, uint8_t *ds= t)
{
const mbedtls_md_info_t *kt =3D = md_get(mdname);
return 0 =3D=3D mbedtls_md(kt, src, sr= c_len, dst);
diff --git a/src/openvpn/crypto_openssl.c b/sr= c/openvpn/crypto_openssl.c
index ed39efa..0c6de18 100644
--- a/src/openvpn/crypto_openssl.c
+++ b/src/= openvpn/crypto_openssl.c
@@ -1104,15 +1104,15 @@
= *
*/

-int
-md_full(const char *mdname, const uint8_t *src, int src_len, uint8= _t *dst)
+bool=
+md_full(const char *mdname= , const uint8_t *src, size_t src_len, uint8_t *dst)
{
unsigned int in_md_len =3D 0;
evp_md_= type *kt =3D md_get(mdname);

int ret= =3D EVP_Digest(src, src_len, dst, &in_md_len, kt, NULL);
EVP_MD_free(kt);

+ = return ret =3D=3D 1;
}

EVP_MD_CTX *


To view, visit change 1512= . To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I201abb9ef013c061fb568823098= edcca32cb2df3
Gerrit-Change-Number: 1512
Gerrit-PatchSet: 2
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>
= --1ORjPH40Pqs=--