wolfcrypt/benchmark/benchmark.c: mollify scan-build with XMEMSET()s in several false positives around WC_DECLARE_ARRAY().

This commit is contained in:
Daniel Pouzzner
2024-02-16 10:27:06 -06:00
parent 44e0ee1ecd
commit 3676dc02a6

View File

@ -8940,6 +8940,11 @@ void bench_dh(int useDeviceID)
WC_DECLARE_VAR(priv2, byte, WC_DECLARE_VAR(priv2, byte,
BENCH_DH_PRIV_SIZE, HEAP_HINT); 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, WC_CALLOC_ARRAY(dhKey, DhKey, BENCH_MAX_PENDING,
sizeof(DhKey), HEAP_HINT); sizeof(DhKey), HEAP_HINT);
WC_ALLOC_ARRAY(pub, byte, WC_ALLOC_ARRAY(pub, byte,
@ -10348,6 +10353,11 @@ void bench_ecc(int useDeviceID, int curveId)
BENCH_MAX_PENDING, MAX_ECC_BYTES, HEAP_HINT); BENCH_MAX_PENDING, MAX_ECC_BYTES, HEAP_HINT);
#endif #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, WC_CALLOC_ARRAY(genKey, ecc_key, BENCH_MAX_PENDING,
sizeof(ecc_key), HEAP_HINT); sizeof(ecc_key), HEAP_HINT);
#ifdef WC_DECLARE_VAR_IS_HEAP_ALLOC #ifdef WC_DECLARE_VAR_IS_HEAP_ALLOC