From: "flichtenheld (Code Review)"
Date: Tue, 10 Feb 2026 14:55:07 +0000
In-Reply-To:
References:
Reply-To: frank@...2641..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net, antonio@...2726...
Message-ID: <897b94c19011390d1d261d2f5379dfe343adcbbc-EmailReplacePatchSet-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="CZ5acOVKjGo="; 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: plaisthos
Cc: openvpn-devel
--CZ5acOVKjGo=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
Hello ordex, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1492?usp=3Demail
to look at the new patch set (#4).
The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied=
now.
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
---
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/4
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;
}
=20
-#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: 4
Gerrit-Owner: flichtenheld
Gerrit-Reviewer: ordex
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-Attention: flichtenheld
--CZ5acOVKjGo=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is cur=
rently required from: flichtenheld, plaisthos.
flichtenheld uploaded patch set #4 to this change.
<=
p>View C=
hange
The change is no longer submittable: checks~ChecksSubmitRul=
e is unsatisfied now.
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 w=
ay that they match what
the caller actually wants (DWORD) and so we
d=
o not have any unnecessary conversions.
Change-Id: I525a5b1b9b6f173c=
df12341aefc44d58f0d43aed
Signed-off-by: Frank Lichtenheld <frank@...1665...=
641...>
---
M src/openvpn/cryptoapi.c
M tests/unit_tests/openvp=
n/test_cryptoapi.c
2 files changed, 6 insertions(+), 15 deletions(-)
=
git pull ssh://gerrit.openvpn.net:29418/openvpn ref=
s/changes/92/1492/4
diff --git a/src/openvpn/cryptoapi.c b/src/open=
vpn/cryptoapi.c
index b74320d..e17936a 100644
--- a/src/openvpn/cryptoapi.c
+++ b/src/openvpn/cryptoap=
i.c
@@ -61,7 +61,7 @@
return 0;=
}
-#else /* HAVE_XKEY_PROVIDER */
+#else /* HAVE_XKEY_PROVIDER */
static XKEY_EXTERNAL_SIGN_fn xkey_cng_sign;
=
span>
@@ -145,11 +145,6 @@
free(cd); }
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Ws=
ign-compare"
-#end=
if
-
/=
**
* Parse a hex string with optional embedded spaces int=
o
* a byte array.
@@ -158,10 +153,10 @@=
span>
* @param capacity capacity of the byte array arr * @returns the number of bytes parsed or 0 on error
*/
-int
=
-parse_hexstring(const char *p, u=
nsigned char *arr, size_t capacity)
+static DWORD
+parse_hexstring(const char *p, unsigned char *arr, DWORD capacity)=
{
- =
int i =3D 0;
+ D=
WORD i =3D 0;
for (; *p && i < capacity; p =
+=3D 2)
{
/* skip spaces */=
span>
@@ -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_BLOB *val=
, DWORD flags,
DWORD *cb)
di=
ff --git a/tests/unit_tests/openvpn/test_cryptoapi.c b/tests/unit_tests/ope=
nvpn/test_cryptoapi.c
index ce527d7..59a356d 100644<=
br>--- a/tests/unit_tests/openvpn/test_cryptoapi.c
++=
+ b/tests/unit_tests/openvpn/test_cryptoapi.c
@@ -469,7 +46=
9,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_hexstr=
ing(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 change 1492. To unsubscribe, or for help writing mail filter=
s, visit setting=
s.
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I525a5b1b9b6f173cdf12341aefc=
44d58f0d43aed
Gerrit-Change-Number: 1492
Gerrit-PatchSet: 4
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>
Gerrit-Attention: plaisthos <arne-openvpn@...220...=
..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...=
41...>
=
--CZ5acOVKjGo=--