From: "cron2 (Code Review)" Date: Thu, 5 Mar 2026 08:29:41 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., antonio@...2726... Message-ID: <1562f09d13d2d7dcb28aa49beb8229b023b7296b-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="kmnbtdPRv/k="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: cryptoapi: Change signature of parse_hexstring to match code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --kmnbtdPRv/k= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#6) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1492?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by ordex Change subject: cryptoapi: Change signature of parse_hexstring to match code ...................................................................... cryptoapi: Change signature of parse_hexstring to match code parse_hexdigest is a function that is used in exactly one place (not counting tests). So change the types in a way that they match what the caller actually wants (DWORD) and so we do not have any unnecessary conversions. Change-Id: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed Signed-off-by: Frank Lichtenheld Acked-by: Antonio Quartulli Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1492 Message-Id: <20260304164502.15449-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 901.html Signed-off-by: Gert Doering --- M src/openvpn/cryptoapi.c M tests/unit_tests/openvpn/test_cryptoapi.c 2 files changed, 6 insertions(+), 15 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/92/1492/6 diff --git a/src/openvpn/cryptoapi.c b/src/openvpn/cryptoapi.c index b74320d..e17936a 100644 --- a/src/openvpn/cryptoapi.c +++ b/src/openvpn/cryptoapi.c @@ -61,7 +61,7 @@ return 0; } -#else /* HAVE_XKEY_PROVIDER */ +#else /* HAVE_XKEY_PROVIDER */ static XKEY_EXTERNAL_SIGN_fn xkey_cng_sign; @@ -145,11 +145,6 @@ free(cd); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif - /** * Parse a hex string with optional embedded spaces into * a byte array. @@ -158,10 +153,10 @@ * @param capacity capacity of the byte array arr * @returns the number of bytes parsed or 0 on error */ -int -parse_hexstring(const char *p, unsigned char *arr, size_t capacity) +static DWORD +parse_hexstring(const char *p, unsigned char *arr, DWORD capacity) { - int i =3D 0; + DWORD i =3D 0; for (; *p && i < capacity; p +=3D 2) { /* skip spaces */ @@ -182,10 +177,6 @@ return i; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - static void * decode_object(struct gc_arena *gc, LPCSTR struct_type, const CRYPT_OBJID_B= LOB *val, DWORD flags, DWORD *cb) diff --git a/tests/unit_tests/openvpn/test_cryptoapi.c b/tests/unit_tests/o= penvpn/test_cryptoapi.c index ce527d7..59a356d 100644 --- a/tests/unit_tests/openvpn/test_cryptoapi.c +++ b/tests/unit_tests/openvpn/test_cryptoapi.c @@ -469,7 +469,7 @@ for (size_t i =3D 0; i < _countof(valid_str); i++) { - int len =3D parse_hexstring(valid_str[i], hash, _countof(hash)); + DWORD len =3D parse_hexstring(valid_str[i], hash, _countof(hash)); assert_int_equal(len, sizeof(test_hash)); assert_memory_equal(hash, test_hash, sizeof(test_hash)); memset(hash, 0, _countof(hash)); @@ -477,7 +477,7 @@ for (size_t i =3D 0; i < _countof(invalid_str); i++) { - int len =3D parse_hexstring(invalid_str[i], hash, _countof(hash)); + DWORD len =3D parse_hexstring(invalid_str[i], hash, _countof(hash)= ); assert_int_equal(len, 0); } } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1492?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: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed Gerrit-Change-Number: 1492 Gerrit-PatchSet: 6 Gerrit-Owner: flichtenheld Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --kmnbtdPRv/k= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

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

View Change

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

cryptoapi: Change signature of pars=
e_hexstring to match code

parse_hexdigest is a function that is used= in
exactly one place (not counting tests). So
change the types in a = way that they match what
the caller actually wants (DWORD) and so we
= do not have any unnecessary conversions.

Change-Id: I525a5b1b9b6f173= cdf12341aefc44d58f0d43aed
Signed-off-by: Frank Lichtenheld <frank@...493...= 2641...>
Acked-by: Antonio Quartulli <antonio@...2726...>
Ge= rrit URL: https://gerrit.openvpn.net/c/openvpn/+/1492
Message-Id: <20= 260304164502.15449-1-gert@...1296...>
URL: https://www.mail-archive.c= om/openvpn-devel@lists.sourceforge.net/msg35901.html
Signed-off-by: Gert= Doering <gert@...1296...>
---
M src/openvpn/cryptoapi.c
M t= ests/unit_tests/openvpn/test_cryptoapi.c
2 files changed, 6 insertions(+= ), 15 deletions(-)

git pull ssh://gerrit.openvpn=
.net:29418/openvpn refs/changes/92/1492/6
diff --git a/src/openvpn/=
cryptoapi.c b/src/openvpn/cryptoapi.c
index b74320d..e17936= a 100644
--- a/src/openvpn/cryptoapi.c
+++ = b/src/openvpn/cryptoapi.c
@@ -61,7 +61,7 @@
return 0;
}

-#else /* HAVE_XKEY_PROVIDER */
+#else /* HAVE_XKEY_PROVIDER */<= /span>

static XKEY_EXTERNAL_SIGN_fn xkey_cng_si= gn;

@@ -145,11 +145,6 @@
= free(cd);
}

-#if defined(__GNUC__) || defined(__clang__)=
-#pragma GCC diagnosti= c push
-#pragma GCC dia= gnostic ignored "-Wsign-compare"
-#endif
-
/**
* Parse a hex string with opt= ional embedded spaces into
* a byte array.
@@ -158,10 +153,10 @@
* @param capacity capacity of th= e byte array arr
* @returns the number of bytes parsed or= 0 on error
*/
-int
-parse_h= exstring(const char *p, unsigned char *arr, size_t capacity)
+static DWORD
+parse_hexstring(const char *p, unsigned c= har *arr, DWORD capacity)
{
- int i =3D 0;
+ DWORD i =3D 0;
for (; *p &= & i < capacity; p +=3D 2)
{
= /* skip spaces */
@@ -182,10 +177,6 @@
return i;
}

-#if defined(__GNUC__) || defined(__clang__)=
-#pragma GCC diagnosti= c pop
-#endif-
static void *=
decode_object(struct gc_arena *gc, LPCSTR struct_type, co= nst CRYPT_OBJID_BLOB *val, DWORD flags,
DWOR= D *cb)
diff --git a/tests/unit_tests/openvpn/test_cryptoapi= .c b/tests/unit_tests/openvpn/test_cryptoapi.c
index ce527d= 7..59a356d 100644
--- a/tests/unit_tests/openvpn/test_crypt= oapi.c
+++ b/tests/unit_tests/openvpn/test_cryptoapi.c

@@ -469,7 +469,7 @@

for = (size_t i =3D 0; i < _countof(valid_str); i++)
{

- int len =3D pars= e_hexstring(valid_str[i], hash, _countof(hash));
+ DWORD len =3D parse_hexstring(valid_st= r[i], hash, _countof(hash));
assert_int_equal(len,= sizeof(test_hash));
assert_memory_equal(hash, tes= t_hash, sizeof(test_hash));
memset(hash, 0, _count= of(hash));
@@ -477,7 +477,7 @@

= for (size_t i =3D 0; i < _countof(invalid_str); i++) {
- = int len =3D parse_hexstring(invalid_str[i], hash, _countof(hash));<= br>+ DWORD len =3D parse= _hexstring(invalid_str[i], hash, _countof(hash));
= assert_int_equal(len, 0);
}
}<= br>

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I525a5b1b9b6f173cdf12341aefc= 44d58f0d43aed
Gerrit-Change-Number: 1492
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --kmnbtdPRv/k=--