From 7a98c517e4e360c1f2182b8fb954fd258bd063c8 Mon Sep 17 00:00:00 2001 From: Elms Date: Mon, 19 Apr 2021 10:04:50 -0700 Subject: [PATCH] Fixes for some `-pedantic` errors Some of the API with callbacks may not be compatible with pedantic --- tests/api.c | 14 +++++++------- wolfcrypt/test/test.c | 8 ++++---- wolfssl/test.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/api.c b/tests/api.c index 7195540ed..559e591e5 100644 --- a/tests/api.c +++ b/tests/api.c @@ -3343,7 +3343,7 @@ done: typedef int (*cbType)(WOLFSSL_CTX *ctx, WOLFSSL *ssl); -static void test_client_nofail(void* args, void *cb) +static void test_client_nofail(void* args, cbType cb) { SOCKET_T sockfd = 0; callback_functions* cbf; @@ -3510,7 +3510,7 @@ static void test_client_nofail(void* args, void *cb) #endif if (cb != NULL) - ((cbType)cb)(ctx, ssl); + (cb)(ctx, ssl); if (wolfSSL_write(ssl, msg, msgSz) != msgSz) { /*err_sys("SSL_write failed");*/ @@ -29826,7 +29826,7 @@ static void test_wolfSSL_msgCb(void) #ifndef SINGLE_THREADED start_thread(test_server_nofail, &server_args, &serverThread); wait_tcp_ready(&server_args); - test_client_nofail(&client_args, (void *)msgCb); + test_client_nofail(&client_args, msgCb); join_thread(serverThread); #endif @@ -40261,7 +40261,7 @@ static int my_DhCallback(WOLFSSL* ssl, struct DhKey* key, (void)ssl; /* return 0 on success */ return wc_DhAgree(key, out, outlen, priv, privSz, pubKeyDer, pubKeySz); -}; +} static void test_dh_ctx_setup(WOLFSSL_CTX* ctx) { wolfSSL_CTX_SetDhAgreeCb(ctx, my_DhCallback); @@ -41764,9 +41764,9 @@ typedef struct { ASN1_SEQUENCE(DPP_BOOTSTRAPPING_KEY) = { ASN1_SIMPLE(DPP_BOOTSTRAPPING_KEY, alg, X509_ALGOR), ASN1_SIMPLE(DPP_BOOTSTRAPPING_KEY, pub_key, ASN1_BIT_STRING) -} ASN1_SEQUENCE_END(DPP_BOOTSTRAPPING_KEY); +} ASN1_SEQUENCE_END(DPP_BOOTSTRAPPING_KEY) -IMPLEMENT_ASN1_FUNCTIONS(DPP_BOOTSTRAPPING_KEY); +IMPLEMENT_ASN1_FUNCTIONS(DPP_BOOTSTRAPPING_KEY) #endif static void test_wolfSSL_IMPLEMENT_ASN1_FUNCTIONS(void) @@ -42869,7 +42869,7 @@ static void test_export_keying_material(void) start_thread(test_server_nofail, &server_args, &serverThread); wait_tcp_ready(&server_args); - test_client_nofail(&client_args, (void*)test_export_keying_material_cb); + test_client_nofail(&client_args, test_export_keying_material_cb); join_thread(serverThread); AssertTrue(client_args.return_code); diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index efa3c430f..e7f33cb1b 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -89,7 +89,7 @@ #endif #ifdef __GNUC__ -_Pragma("GCC diagnostic ignored \"-Wunused-function\""); +_Pragma("GCC diagnostic ignored \"-Wunused-function\"") #endif #ifdef USE_FLAT_TEST_H @@ -36409,9 +36409,9 @@ WOLFSSL_TEST_SUBROUTINE int memcb_test(void) b = NULL; /* Use API. */ - if (wolfSSL_SetAllocators((wolfSSL_Malloc_cb)(void*)&my_Malloc_cb, - (wolfSSL_Free_cb)(void*)&my_Free_cb, - (wolfSSL_Realloc_cb)(void*)&my_Realloc_cb) != 0) { + if (wolfSSL_SetAllocators((wolfSSL_Malloc_cb)my_Malloc_cb, + (wolfSSL_Free_cb)my_Free_cb, + (wolfSSL_Realloc_cb)my_Realloc_cb) != 0) { ERROR_OUT(-13802, exit_memcb); } diff --git a/wolfssl/test.h b/wolfssl/test.h index 8532125d7..95bcf1616 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -3428,7 +3428,7 @@ static WC_INLINE int myDhCallback(WOLFSSL* ssl, struct DhKey* key, ret, privSz, pubKeySz, *outlen); return ret; -}; +} #endif /* !NO_DH */