Skip to content

Commit 840d1e9

Browse files
committed
Benchmark, SM2: initialize vars for small stack
Variables may not be initialized in benchmark test when building for small stack.
1 parent db6b138 commit 840d1e9

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

wolfcrypt/benchmark/benchmark.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10939,13 +10939,13 @@ void bench_eccEncrypt(int curveId)
1093910939
#ifdef WOLFSSL_SM2
1094010940
static void bench_sm2_MakeKey(int useDeviceID)
1094110941
{
10942-
int ret = 0, i, times, count, pending = 0;
10942+
int ret = 0, i, times, count = 0, pending = 0;
1094310943
int deviceID;
1094410944
int keySize;
1094510945
WC_DECLARE_ARRAY(genKey, ecc_key, BENCH_MAX_PENDING,
1094610946
sizeof(ecc_key), HEAP_HINT);
1094710947
char name[BENCH_ECC_NAME_SZ];
10948-
double start;
10948+
double start = 0;
1094910949
const char**desc = bench_desc_words[lng_index];
1095010950
DECLARE_MULTI_VALUE_STATS_VARS()
1095110951

wolfssl/wolfcrypt/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ typedef struct w64wrapper {
592592
#endif
593593

594594
#define WC_DECLARE_HEAP_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \
595-
VAR_TYPE* VAR_NAME[VAR_ITEMS]; \
595+
VAR_TYPE* VAR_NAME[VAR_ITEMS] = { NULL, }; \
596596
int idx##VAR_NAME = 0, inner_idx_##VAR_NAME
597597
#define WC_HEAP_ARRAY_ARG(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE) \
598598
VAR_TYPE* VAR_NAME[VAR_ITEMS]

0 commit comments

Comments
 (0)