Attention is currently required from: Arne Schwabe.
Hello Arne Schwabe,
I'd like you to do a code review.
Please visit
https://gerrit.openvpn.net/c/openvpn/+/2199?usp=email
to review the following change.
Change subject: ssl_util: Switch get_num_elements to size_t
......................................................................
ssl_util: Switch get_num_elements to size_t
ALLOC_ARRAY already wants size_t.
Change-Id: If79d4356b5da82c2844cd9e8c59a0fc41aeff3c0
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
M src/openvpn/ssl_util.c
M src/openvpn/ssl_util.h
4 files changed, 6 insertions(+), 23 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/99/2199/1
diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c
index 2d29e60..19a2d48 100644
--- a/src/openvpn/ssl_mbedtls.c
+++ b/src/openvpn/ssl_mbedtls.c
@@ -199,11 +199,6 @@
ciphers);
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-conversion"
-#endif
-
void
tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)
{
@@ -217,7 +212,7 @@
ASSERT(NULL != ctx);
/* Get number of ciphers */
- int cipher_count = get_num_elements(ciphers, ':');
+ size_t cipher_count = get_num_elements(ciphers, ':');
/* Allocate an array for them */
ALLOC_ARRAY_CLEAR(ctx->allowed_ciphers, int, cipher_count + 1)
@@ -339,7 +334,7 @@
struct gc_arena gc = gc_new();
/* Get number of groups and allocate an array in ctx */
- int groups_count = get_num_elements(groups, ':');
+ size_t groups_count = get_num_elements(groups, ':');
ALLOC_ARRAY_CLEAR(ctx->groups, uint16_t, groups_count + 1)
/* Parse allowed ciphers, getting IDs */
@@ -1188,10 +1183,6 @@
return 1;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
/* **************************************
*
* Information functions
diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
index 7622d88..30ef383 100644
--- a/src/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -518,11 +518,6 @@
{
ASSERT(ctx);
#if OPENSSL_VERSION_NUMBER < 0x30000000L && !defined(ENABLE_CRYPTO_WOLFSSL)
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-conversion"
-#endif
-
struct gc_arena gc = gc_new();
/* This method could be as easy as
* SSL_CTX_set1_groups_list(ctx->ctx, groups)
@@ -533,7 +528,7 @@
* Also note that the code is wrong in the presence of OpenSSL3 providers.
*/
- int groups_count = get_num_elements(groups, ':');
+ size_t groups_count = get_num_elements(groups, ':');
int *glist;
/* Allocate an array for them */
@@ -569,9 +564,6 @@
}
gc_free(&gc);
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
#else /* if OPENSSL_VERSION_NUMBER < 0x30000000L */
if (!SSL_CTX_set1_groups_list(ctx->ctx, groups))
{
diff --git a/src/openvpn/ssl_util.c b/src/openvpn/ssl_util.c
index 337faed..6c17fe5 100644
--- a/src/openvpn/ssl_util.c
+++ b/src/openvpn/ssl_util.c
@@ -359,14 +359,14 @@
return NULL;
}
-int
+size_t
get_num_elements(const char *string, char delimiter)
{
const size_t string_len = strlen(string);
ASSERT(0 != string_len);
- int element_count = 1;
+ size_t element_count = 1;
/* Get number of ciphers */
for (size_t i = 0; i < string_len; i++)
{
diff --git a/src/openvpn/ssl_util.h b/src/openvpn/ssl_util.h
index 6f9f65b..db5e17c 100644
--- a/src/openvpn/ssl_util.h
+++ b/src/openvpn/ssl_util.h
@@ -125,6 +125,6 @@
* @param delimiter the delimiter to count, typically ':'
* @return occrrences of delimiter + 1
*/
-int get_num_elements(const char *string, char delimiter);
+size_t get_num_elements(const char *string, char delimiter);
#endif /* ifndef SSL_UTIL_H_ */
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2199?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If79d4356b5da82c2844cd9e8c59a0fc41aeff3c0
Gerrit-Change-Number: 2199
Gerrit-PatchSet: 1
Gerrit-Owner: Frank Lichtenheld <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel