Change in openvpn[master]: crypto_backend: Improve signature of md_full to avoid conversions
A message that is not in the archive (sent off-list or not yet received): gerrit.1770735307000.I201abb9ef013c061fb568823098edcca32cb2df3@...2715...
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/+/1512?usp=email
to review the following change.
Change subject: crypto_backend: Improve signature of md_full to avoid conversions
......................................................................
crypto_backend: Improve signature of md_full to avoid conversions
---
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/1
src/openvpn/crypto_backend.h +2 -2
@@ -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
src/openvpn/crypto_mbedtls.c +6 -6
@@ -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 *dst) {const md_info_t *md =md_get (mdname);if (md ==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 =PSA_HASH_LENGTH (md->psa_alg);size_t hash_length =0 ; -psa_status_t status =psa_hash_compute (md->psa_alg, src, (size_t )src_len, dst, dst_size, &hash_length); +psa_status_t status =psa_hash_compute (md->psa_alg, src, src_len, dst, dst_size, &hash_length);if (status !=PSA_SUCCESS || hash_length != dst_size) { -return 0 ; +return false; } -return 1 ; +return true; }void
src/openvpn/crypto_mbedtls_legacy.c +2 -2
@@ -835,8 +835,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 *dst) {const mbedtls_md_info_t *kt =md_get (mdname);return 0 ==mbedtls_md (kt, src, src_len, dst);
src/openvpn/crypto_openssl.c +3 -3
@@ -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 =0 ;evp_md_type *kt =md_get (mdname);int ret =EVP_Digest (src, src_len, dst, &in_md_len, kt,NULL );EVP_MD_free (kt); -return ret; +return ret ==1 ; } EVP_MD_CTX *
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1512?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: I201abb9ef013c061fb568823098edcca32cb2df3
Gerrit-Change-Number: 1512
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1512?usp=email )
Change subject: crypto_backend: Improve signature of md_full to avoid conversions
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1512?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: I201abb9ef013c061fb568823098edcca32cb2df3
Gerrit-Change-Number: 1512
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 16 Feb 2026 15:06:56 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH 1/1 crypto_backend: Improve signature of md_full to avoid conversions
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1512
---
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/+/1512
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/crypto_backend.h +2 -2
@@ -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
src/openvpn/crypto_mbedtls.c +6 -6
@@ -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 *dst) {const md_info_t *md =md_get (mdname);if (md ==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 =PSA_HASH_LENGTH (md->psa_alg);size_t hash_length =0 ; -psa_status_t status =psa_hash_compute (md->psa_alg, src, (size_t )src_len, dst, dst_size, &hash_length); +psa_status_t status =psa_hash_compute (md->psa_alg, src, src_len, dst, dst_size, &hash_length);if (status !=PSA_SUCCESS || hash_length != dst_size) { -return 0 ; +return false; } -return 1 ; +return true; }void
src/openvpn/crypto_mbedtls_legacy.c +2 -2
@@ -835,8 +835,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 *dst) {const mbedtls_md_info_t *kt =md_get (mdname);return 0 ==mbedtls_md (kt, src, src_len, dst);
src/openvpn/crypto_openssl.c +3 -3
@@ -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 =0 ;evp_md_type *kt =md_get (mdname);int ret =EVP_Digest (src, src_len, dst, &in_md_len, kt,NULL );EVP_MD_free (kt); -return ret; +return ret ==1 ; } EVP_MD_CTX *
[Openvpn-devel] [PATCH applied] Re: crypto_backend: Improve signature of md_full to avoid conversions
Stared-at-code, changes make sense, BB all green - into master, part of the "conversion warnings" cleanup effort.
Your patch has been applied to the master branch.
commit 74e88cf06685bd2834d2e7c392e4914c90f2034e
Author: Frank Lichtenheld Date: Mon Feb 16 16:07:05 2026 +0100
crypto_backend: Improve signature of md_full to avoid conversions
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1512
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35657.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1512?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: crypto_backend: Improve signature of md_full to avoid conversions
......................................................................
crypto_backend: Improve signature of md_full to avoid conversions
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1512
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35657.html
---
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
src/openvpn/crypto_backend.h +2 -2
@@ -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
src/openvpn/crypto_mbedtls.c +6 -6
@@ -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 *dst) {const md_info_t *md =md_get (mdname);if (md ==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 =PSA_HASH_LENGTH (md->psa_alg);size_t hash_length =0 ; -psa_status_t status =psa_hash_compute (md->psa_alg, src, (size_t )src_len, dst, dst_size, &hash_length); +psa_status_t status =psa_hash_compute (md->psa_alg, src, src_len, dst, dst_size, &hash_length);if (status !=PSA_SUCCESS || hash_length != dst_size) { -return 0 ; +return false; } -return 1 ; +return true; }void
src/openvpn/crypto_mbedtls_legacy.c +2 -2
@@ -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 *dst) {const mbedtls_md_info_t *kt =md_get (mdname);return 0 ==mbedtls_md (kt, src, src_len, dst);
src/openvpn/crypto_openssl.c +3 -3
@@ -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 =0 ;evp_md_type *kt =md_get (mdname);int ret =EVP_Digest (src, src_len, dst, &in_md_len, kt,NULL );EVP_MD_free (kt); -return ret; +return ret ==1 ; } EVP_MD_CTX *
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1512?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: I201abb9ef013c061fb568823098edcca32cb2df3
Gerrit-Change-Number: 1512
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1512?usp=email )
Change subject: crypto_backend: Improve signature of md_full to avoid conversions
......................................................................
crypto_backend: Improve signature of md_full to avoid conversions
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1512
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35657.html
---
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(-)
src/openvpn/crypto_backend.h +2 -2
@@ -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
src/openvpn/crypto_mbedtls.c +6 -6
@@ -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 *dst) {const md_info_t *md =md_get (mdname);if (md ==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 =PSA_HASH_LENGTH (md->psa_alg);size_t hash_length =0 ; -psa_status_t status =psa_hash_compute (md->psa_alg, src, (size_t )src_len, dst, dst_size, &hash_length); +psa_status_t status =psa_hash_compute (md->psa_alg, src, src_len, dst, dst_size, &hash_length);if (status !=PSA_SUCCESS || hash_length != dst_size) { -return 0 ; +return false; } -return 1 ; +return true; }void
src/openvpn/crypto_mbedtls_legacy.c +2 -2
@@ -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 *dst) {const mbedtls_md_info_t *kt =md_get (mdname);return 0 ==mbedtls_md (kt, src, src_len, dst);
src/openvpn/crypto_openssl.c +3 -3
@@ -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 =0 ;evp_md_type *kt =md_get (mdname);int ret =EVP_Digest (src, src_len, dst, &in_md_len, kt,NULL );EVP_MD_free (kt); -return ret; +return ret ==1 ; } EVP_MD_CTX *
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1512?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: I201abb9ef013c061fb568823098edcca32cb2df3
Gerrit-Change-Number: 1512
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>