From 3676dc02a6e5b0279852eb0075372a4f38a8fc88 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Fri, 16 Feb 2024 10:27:06 -0600 Subject: [PATCH] wolfcrypt/benchmark/benchmark.c: mollify scan-build with XMEMSET()s in several false positives around WC_DECLARE_ARRAY(). --- wolfcrypt/benchmark/benchmark.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 448fe65c6..b82e9c0b9 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -8940,6 +8940,11 @@ void bench_dh(int useDeviceID) WC_DECLARE_VAR(priv2, byte, BENCH_DH_PRIV_SIZE, HEAP_HINT); + /* old scan-build misfires -Wmaybe-uninitialized on these. */ + XMEMSET(pub, 0, sizeof(pub)); + XMEMSET(agree, 0, sizeof(agree)); + XMEMSET(priv, 0, sizeof(priv)); + WC_CALLOC_ARRAY(dhKey, DhKey, BENCH_MAX_PENDING, sizeof(DhKey), HEAP_HINT); WC_ALLOC_ARRAY(pub, byte, @@ -10348,6 +10353,11 @@ void bench_ecc(int useDeviceID, int curveId) BENCH_MAX_PENDING, MAX_ECC_BYTES, HEAP_HINT); #endif + /* old scan-build misfires -Wmaybe-uninitialized on these. */ + XMEMSET(sig, 0, sizeof(sig)); + XMEMSET(digest, 0, sizeof(digest)); + XMEMSET(shared, 0, sizeof(shared)); + WC_CALLOC_ARRAY(genKey, ecc_key, BENCH_MAX_PENDING, sizeof(ecc_key), HEAP_HINT); #ifdef WC_DECLARE_VAR_IS_HEAP_ALLOC