From fc4b3ce49b0ce50fc19dc545d332bd3cbe79a0cb Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Wed, 12 Jan 2022 13:12:35 -0400 Subject: [PATCH] hcrypto: Fix return type for null_Init, null_Update and null_Final The hc_evp_md_init, hc_evp_md_update and hc_evp_md_final typedefs are defined as functions returning an int, but null_Init, null_Update and null_Final are defined as void, and cast with the typedef when assigned to the function vector. This might result in some uninitialized value being returned to the caller, if some of them make use of the return value. It also causes warnings if the -Wcast-function-type warning is enabled. Change the type to in to match the typedef, and return 1 (success). --- lib/hcrypto/evp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/hcrypto/evp.c b/lib/hcrypto/evp.c index 23838709c..9cced4c53 100644 --- a/lib/hcrypto/evp.c +++ b/lib/hcrypto/evp.c @@ -485,17 +485,20 @@ EVP_md2(void) HC_DEPRECATED_CRYPTO * */ -static void +static int null_Init (void *m) { + return 1; } -static void +static int null_Update (void *m, const void * data, size_t size) { + return 1; } -static void +static int null_Final(void *res, void *m) { + return 1; } /**