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.
Change-Id: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed
Signed-off-by: Frank Lichtenheld <[email protected]>
---
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
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 = 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)
diff --git a/tests/unit_tests/openvpn/test_cryptoapi.c
b/tests/unit_tests/openvpn/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 = 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]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel