Fix for benchmarking shake with custom block size. Using ./benchmark -shake 1024 caused seg fault.

This commit is contained in:
David Garske 2023-02-08 11:25:53 -08:00
parent ee12a5f0c6
commit cefd55eb74
2 changed files with 7 additions and 5 deletions

4
.gitignore vendored
View File

@ -393,6 +393,8 @@ cmake_install.cmake
# GDB Settings
\.gdbinit
libFuzzer
# Pycharm and other IDEs
\.idea
@ -413,4 +415,4 @@ user_settings_asm.h
/IDE/Espressif/**/sdkconfig
# auto-created CMake backups
**/CMakeLists.txt.old
**/CMakeLists.txt.old

View File

@ -5112,7 +5112,7 @@ void bench_shake128(int useDeviceID)
if (bench_async_check(&ret, BENCH_ASYNC_GET_DEV(&hash[i]),
0, &times, numBlocks, &pending)) {
ret = wc_Shake128_Update(&hash[i], bench_plain,
BENCH_SIZE);
bench_size);
if (!bench_async_handle(&ret,
BENCH_ASYNC_GET_DEV(&hash[i]), 0,
&times, &pending)) {
@ -5148,7 +5148,7 @@ void bench_shake128(int useDeviceID)
ret = wc_InitShake128(hash, HEAP_HINT,
useDeviceID ? devId : INVALID_DEVID);
if (ret == 0)
ret = wc_Shake128_Update(hash, bench_plain, BENCH_SIZE);
ret = wc_Shake128_Update(hash, bench_plain, bench_size);
if (ret == 0)
ret = wc_Shake128_Final(hash, digest[0],
WC_SHA3_128_BLOCK_SIZE);
@ -5207,7 +5207,7 @@ void bench_shake256(int useDeviceID)
if (bench_async_check(&ret, BENCH_ASYNC_GET_DEV(&hash[i]),
0, &times, numBlocks, &pending)) {
ret = wc_Shake256_Update(&hash[i], bench_plain,
BENCH_SIZE);
bench_size);
if (!bench_async_handle(&ret,
BENCH_ASYNC_GET_DEV(&hash[i]), 0,
&times, &pending)) {
@ -5243,7 +5243,7 @@ void bench_shake256(int useDeviceID)
ret = wc_InitShake256(hash, HEAP_HINT,
useDeviceID ? devId : INVALID_DEVID);
if (ret == 0)
ret = wc_Shake256_Update(hash, bench_plain, BENCH_SIZE);
ret = wc_Shake256_Update(hash, bench_plain, bench_size);
if (ret == 0)
ret = wc_Shake256_Final(hash, digest[0],
WC_SHA3_256_BLOCK_SIZE);