Change in openvpn[master]: cryptoapi: Change signature of parse_hexstring to match code
A message that is not in the archive (sent off-list or not yet received): gerrit.1769512571000.I525a5b1b9b6f173cdf12341aefc44d58f0d43aed@...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/+/1492?usp=email
to review the following change.
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.
---
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/1
src/openvpn/cryptoapi.c +4 -13
@@ -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 =0 ; +DWORD i =0 ;for (; *p && i < capacity; p +=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_BLOB *val,DWORD flags,DWORD *cb)
tests/unit_tests/openvpn/test_cryptoapi.c +2 -2
@@ -469,7 +469,7 @@for (size_t i =0 ; i <_countof (valid_str); i++) { -int len =parse_hexstring (valid_str[i], hash,_countof (hash)); +DWORD len =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 =0 ; i <_countof (invalid_str); i++) { -int len =parse_hexstring (invalid_str[i], hash,_countof (hash)); +DWORD len =parse_hexstring (invalid_str[i], hash,_countof (hash));assert_int_equal (len,0 ); } }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1492?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: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed
Gerrit-Change-Number: 1492
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.
ordex has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1492?usp=email )
Change subject: cryptoapi: Change signature of parse_hexstring to match code
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
Patchset:
PS1:
I don't like that we are adding a totally unrelated whitespace in a place we are not touching at all (moreover I am not sure why it is being added - it seems clang-format has "opinions").
But other than that the actual change looks good to me and more importantly is adding the "static" attribute which should have been there since the beginning.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1492?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: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed
Gerrit-Change-Number: 1492
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[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: Tue, 27 Jan 2026 11:41:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
PATCH 1/1 cryptoapi: Change signature of parse_hexstring to match code
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1492
---
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/+/1492
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Antonio Quartulli <[email protected]...>
src/openvpn/cryptoapi.c +4 -13
@@ -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 =0 ; +DWORD i =0 ;for (; *p && i < capacity; p +=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_BLOB *val,DWORD flags,DWORD *cb)
tests/unit_tests/openvpn/test_cryptoapi.c +2 -2
@@ -469,7 +469,7 @@for (size_t i =0 ; i <_countof (valid_str); i++) { -int len =parse_hexstring (valid_str[i], hash,_countof (hash)); +DWORD len =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 =0 ; i <_countof (invalid_str); i++) { -int len =parse_hexstring (invalid_str[i], hash,_countof (hash)); +DWORD len =parse_hexstring (invalid_str[i], hash,_countof (hash));assert_int_equal (len,0 ); } }
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=email
to look at the new patch set (#2).
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.
---
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/2
src/openvpn/cryptoapi.c +4 -13
@@ -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 =0 ; +DWORD i =0 ;for (; *p && i < capacity; p +=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_BLOB *val,DWORD flags,DWORD *cb)
tests/unit_tests/openvpn/test_cryptoapi.c +2 -2
@@ -469,7 +469,7 @@for (size_t i =0 ; i <_countof (valid_str); i++) { -int len =parse_hexstring (valid_str[i], hash,_countof (hash)); +DWORD len =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 =0 ; i <_countof (invalid_str); i++) { -int len =parse_hexstring (invalid_str[i], hash,_countof (hash)); +DWORD len =parse_hexstring (invalid_str[i], hash,_countof (hash));assert_int_equal (len,0 ); } }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1492?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: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed
Gerrit-Change-Number: 1492
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
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=email
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.
---
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
src/openvpn/cryptoapi.c +4 -13
@@ -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 =0 ; +DWORD i =0 ;for (; *p && i < capacity; p +=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_BLOB *val,DWORD flags,DWORD *cb)
tests/unit_tests/openvpn/test_cryptoapi.c +2 -2
@@ -469,7 +469,7 @@for (size_t i =0 ; i <_countof (valid_str); i++) { -int len =parse_hexstring (valid_str[i], hash,_countof (hash)); +DWORD len =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 =0 ; i <_countof (invalid_str); i++) { -int len =parse_hexstring (invalid_str[i], hash,_countof (hash)); +DWORD len =parse_hexstring (invalid_str[i], hash,_countof (hash));assert_int_equal (len,0 ); } }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1492?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: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed
Gerrit-Change-Number: 1492
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
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=email
to look at the new patch set (#5).
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.
---
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/5
src/openvpn/cryptoapi.c +4 -13
@@ -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 =0 ; +DWORD i =0 ;for (; *p && i < capacity; p +=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_BLOB *val,DWORD flags,DWORD *cb)
tests/unit_tests/openvpn/test_cryptoapi.c +2 -2
@@ -469,7 +469,7 @@for (size_t i =0 ; i <_countof (valid_str); i++) { -int len =parse_hexstring (valid_str[i], hash,_countof (hash)); +DWORD len =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 =0 ; i <_countof (invalid_str); i++) { -int len =parse_hexstring (invalid_str[i], hash,_countof (hash)); +DWORD len =parse_hexstring (invalid_str[i], hash,_countof (hash));assert_int_equal (len,0 ); } }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1492?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: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed
Gerrit-Change-Number: 1492
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
PATCH v5 1/1 cryptoapi: Change signature of parse_hexstring to match code
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1492
---
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/+/1492
This mail reflects revision 5 of this Change.
Acked-by according to Gerrit (reflected above):
Antonio Quartulli <[email protected]...>
src/openvpn/cryptoapi.c +4 -13
@@ -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 =0 ; +DWORD i =0 ;for (; *p && i < capacity; p +=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_BLOB *val,DWORD flags,DWORD *cb)
tests/unit_tests/openvpn/test_cryptoapi.c +2 -2
@@ -469,7 +469,7 @@for (size_t i =0 ; i <_countof (valid_str); i++) { -int len =parse_hexstring (valid_str[i], hash,_countof (hash)); +DWORD len =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 =0 ; i <_countof (invalid_str); i++) { -int len =parse_hexstring (invalid_str[i], hash,_countof (hash)); +DWORD len =parse_hexstring (invalid_str[i], hash,_countof (hash));assert_int_equal (len,0 ); } }
[Openvpn-devel] [PATCH applied] Re: cryptoapi: Change signature of parse_hexstring to match code
This has had an ACK quite a while ago, but the prerequisite patch that adds all these #pragmas-to-be-removed was not in yet... so here we go.
Change makes sense, BB happy, ACK from Antonio :-) - and unittest as well!
Your patch has been applied to the master branch.
commit 3451c18fe1a8afb288a55704295cc89c4eadce8b
Author: Frank Lichtenheld Date: Wed Mar 4 17:44:55 2026 +0100
cryptoapi: Change signature of parse_hexstring to match code
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Antonio Quartulli <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1492
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35901.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#6) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1492?usp=email )
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1492
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35901.html
---
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
src/openvpn/cryptoapi.c +4 -13
@@ -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 =0 ; +DWORD i =0 ;for (; *p && i < capacity; p +=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_BLOB *val,DWORD flags,DWORD *cb)
tests/unit_tests/openvpn/test_cryptoapi.c +2 -2
@@ -469,7 +469,7 @@for (size_t i =0 ; i <_countof (valid_str); i++) { -int len =parse_hexstring (valid_str[i], hash,_countof (hash)); +DWORD len =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 =0 ; i <_countof (invalid_str); i++) { -int len =parse_hexstring (invalid_str[i], hash,_countof (hash)); +DWORD len =parse_hexstring (invalid_str[i], hash,_countof (hash));assert_int_equal (len,0 ); } }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1492?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: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed
Gerrit-Change-Number: 1492
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1492?usp=email )
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1492
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35901.html
---
M src/openvpn/cryptoapi.c
M tests/unit_tests/openvpn/test_cryptoapi.c
2 files changed, 6 insertions(+), 15 deletions(-)
src/openvpn/cryptoapi.c +4 -13
@@ -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 =0 ; +DWORD i =0 ;for (; *p && i < capacity; p +=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_BLOB *val,DWORD flags,DWORD *cb)
tests/unit_tests/openvpn/test_cryptoapi.c +2 -2
@@ -469,7 +469,7 @@for (size_t i =0 ; i <_countof (valid_str); i++) { -int len =parse_hexstring (valid_str[i], hash,_countof (hash)); +DWORD len =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 =0 ; i <_countof (invalid_str); i++) { -int len =parse_hexstring (invalid_str[i], hash,_countof (hash)); +DWORD len =parse_hexstring (invalid_str[i], hash,_countof (hash));assert_int_equal (len,0 ); } }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1492?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: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed
Gerrit-Change-Number: 1492
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>