From b179b843352643a1b53bc0acd9990366f37ea51b Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 8 Feb 2021 16:53:29 +0000 Subject: [PATCH] Change set_err_add_hook void pointer to actual function pointer signature Change the signature of the `hook` parameter of `mbedtls_set_err_add_hook` to use the actual signature of the function as opposed to `void *`. This fixes a warning when compiling with clang `-pedantic`. Signed-off-by: Chris Jones --- include/mbedtls/error.h | 2 +- library/error.c | 2 +- scripts/data_files/error.fmt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mbedtls/error.h b/include/mbedtls/error.h index 752f7bf05..154f0718e 100644 --- a/include/mbedtls/error.h +++ b/include/mbedtls/error.h @@ -125,7 +125,7 @@ extern "C" { * * \param hook hook to invasive testing function */ -void mbedtls_set_err_add_hook( void *hook ); +void mbedtls_set_err_add_hook( void (*hook)( int, int, const char *, int ) ); int mbedtls_err_add( int high, int low, const char *file, int line ); #define MBEDTLS_ERR_ADD( high, low ) \ ( mbedtls_err_add( high, low, __FILE__, __LINE__ ) ) diff --git a/library/error.c b/library/error.c index 4e279b069..aaa66dddf 100644 --- a/library/error.c +++ b/library/error.c @@ -896,7 +896,7 @@ const char * mbedtls_low_level_strerr( int error_code ) #if defined(MBEDTLS_TEST_HOOKS) static void (*err_add_hook)( int, int, const char *, int ); -void mbedtls_set_err_add_hook(void *hook) +void mbedtls_set_err_add_hook( void (*hook)( int, int, const char *, int ) ) { err_add_hook = hook; } diff --git a/scripts/data_files/error.fmt b/scripts/data_files/error.fmt index fdb3ce291..5925904a4 100644 --- a/scripts/data_files/error.fmt +++ b/scripts/data_files/error.fmt @@ -85,7 +85,7 @@ LOW_LEVEL_CODE_CHECKS #if defined(MBEDTLS_TEST_HOOKS) static void (*err_add_hook)( int, int, const char *, int ); -void mbedtls_set_err_add_hook(void *hook) +void mbedtls_set_err_add_hook( void (*hook)( int, int, const char *, int ) ) { err_add_hook = hook; }