From 2d149b1befc182843835df89823aec997e2546fd Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Wed, 4 Nov 2020 15:35:58 -0600 Subject: [PATCH] benchmark.c: backport fixes to bench_dh() DH key size initialization from SparkiDev:sp_math_all. --- wolfcrypt/benchmark/benchmark.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index b342f8fd7..94aa4bc3d 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -4857,8 +4857,8 @@ void bench_dh(int doAsync) #endif word32 pubSz[BENCH_MAX_PENDING]; word32 privSz[BENCH_MAX_PENDING]; - word32 pubSz2; - word32 privSz2; + word32 pubSz2 = BENCH_DH_KEY_SIZE; + word32 privSz2 = BENCH_DH_PRIV_SIZE; word32 agreeSz[BENCH_MAX_PENDING]; #ifdef HAVE_FFDHE_2048 const DhParams *params = NULL; @@ -4953,7 +4953,8 @@ void bench_dh(int doAsync) for (i = 0; i < BENCH_MAX_PENDING; i++) { if (bench_async_check(&ret, BENCH_ASYNC_GET_DEV(&dhKey[i]), 0, ×, genTimes, &pending)) { - privSz[i] = 0; + privSz[i] = BENCH_DH_PRIV_SIZE; + pubSz[i] = BENCH_DH_KEY_SIZE; ret = wc_DhGenerateKeyPair(&dhKey[i], &gRng, priv[i], &privSz[i], pub[i], &pubSz[i]); if (!bench_async_handle(&ret, BENCH_ASYNC_GET_DEV(&dhKey[i]), 0, ×, &pending)) {