From e465b9ed61adb1396627bdc58fbc9d96755e90d1 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Fri, 25 Jul 2025 16:19:22 -0600 Subject: [PATCH] fixes for -fsanitize=memory --- src/benchmark/clu_benchmark.c | 2 ++ src/pkcs/clu_pkcs7.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/benchmark/clu_benchmark.c b/src/benchmark/clu_benchmark.c index 23ac37f..3d083d0 100644 --- a/src/benchmark/clu_benchmark.c +++ b/src/benchmark/clu_benchmark.c @@ -97,6 +97,7 @@ int wolfCLU_benchmark(int timer, int* option) wc_RNG_GenerateBlock(&rng, iv, AES_BLOCK_SIZE); start = wolfCLU_getTime(); + wc_AesInit(&aes, HEAP_HINT, INVALID_DEVID); wc_AesSetKey(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION); while (loop) { @@ -107,6 +108,7 @@ int wolfCLU_benchmark(int timer, int* option) /* if stop >= timer, loop = 0 */ loop = (stop >= timer) ? 0 : 1; } + wc_AesFree(&aes); printf("\n"); printf("AES-CBC "); wolfCLU_stats(start, AES_BLOCK_SIZE, blocks); diff --git a/src/pkcs/clu_pkcs7.c b/src/pkcs/clu_pkcs7.c index 902b939..8f5df38 100644 --- a/src/pkcs/clu_pkcs7.c +++ b/src/pkcs/clu_pkcs7.c @@ -71,6 +71,8 @@ int wolfCLU_PKCS7(int argc, char** argv) int derContentSz = 0; int freePkcs7 = 0; + XMEMSET(&pkcs7, 0, sizeof(PKCS7)); + opterr = 0; /* do not display unrecognized options */ optind = 0; /* start at indent 0 */ while ((option = wolfCLU_GetOpt(argc, argv, "",