Skip to content

Commit 0a1b4f9

Browse files
committed
fix shaCopy errors
1 parent 7ae2ecc commit 0a1b4f9

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6215,8 +6215,10 @@ static wc_test_ret_t sha3_256_test(void)
62156215
test_sha[2] = c;
62166216

62176217
ret = wc_InitSha3_256(&sha, HEAP_HINT, devId);
6218-
if (ret != 0)
6218+
if (ret != 0) {
6219+
WC_FREE_VAR(shaCopy, HEAP_HINT);
62196220
return WC_TEST_RET_ENC_EC(ret);
6221+
}
62206222

62216223
for (i = 0; i < times; ++i) {
62226224
ret = wc_Sha3_256_Update(&sha, (byte*)test_sha[i].input,
@@ -6380,8 +6382,10 @@ static wc_test_ret_t sha3_384_test(void)
63806382
test_sha[2] = c;
63816383

63826384
ret = wc_InitSha3_384(&sha, HEAP_HINT, devId);
6383-
if (ret != 0)
6385+
if (ret != 0) {
6386+
WC_FREE_VAR(shaCopy, HEAP_HINT);
63846387
return WC_TEST_RET_ENC_EC(ret);
6388+
}
63856389

63866390
for (i = 0; i < times; ++i) {
63876391
XMEMCPY(buf, test_sha[i].input, test_sha[i].inLen);
@@ -6521,8 +6525,10 @@ static wc_test_ret_t sha3_512_test(void)
65216525
test_sha[2] = c;
65226526

65236527
ret = wc_InitSha3_512(&sha, HEAP_HINT, devId);
6524-
if (ret != 0)
6528+
if (ret != 0) {
6529+
WC_FREE_VAR(shaCopy, HEAP_HINT);
65256530
return WC_TEST_RET_ENC_EC(ret);
6531+
}
65266532

65276533
for (i = 0; i < times; ++i) {
65286534
ret = wc_Sha3_512_Update(&sha, (byte*)test_sha[i].input,
@@ -6938,8 +6944,10 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t shake128_test(void)
69386944
test_sha[4] = e;
69396945

69406946
ret = wc_InitShake128(&sha, HEAP_HINT, devId);
6941-
if (ret != 0)
6947+
if (ret != 0) {
6948+
WC_FREE_VAR(shaCopy, HEAP_HINT);
69426949
return WC_TEST_RET_ENC_EC(ret);
6950+
}
69436951

69446952
for (i = 0; i < times; ++i) {
69456953
ret = wc_Shake128_Update(&sha, (byte*)test_sha[i].input,
@@ -7315,8 +7323,10 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t shake256_test(void)
73157323
test_sha[4] = e;
73167324

73177325
ret = wc_InitShake256(&sha, HEAP_HINT, devId);
7318-
if (ret != 0)
7326+
if (ret != 0) {
7327+
WC_FREE_VAR(shaCopy, HEAP_HINT);
73197328
return WC_TEST_RET_ENC_EC(ret);
7329+
}
73207330

73217331
for (i = 0; i < times; ++i) {
73227332
ret = wc_Shake256_Update(&sha, (byte*)test_sha[i].input,

0 commit comments

Comments
 (0)