Skip to content

Commit ec973e6

Browse files
committed
fix shaCopy errors
1 parent 56d984c commit ec973e6

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
@@ -6191,8 +6191,10 @@ static wc_test_ret_t sha3_256_test(void)
61916191
test_sha[2] = c;
61926192

61936193
ret = wc_InitSha3_256(&sha, HEAP_HINT, devId);
6194-
if (ret != 0)
6194+
if (ret != 0) {
6195+
WC_FREE_VAR(shaCopy, HEAP_HINT);
61956196
return WC_TEST_RET_ENC_EC(ret);
6197+
}
61966198

61976199
for (i = 0; i < times; ++i) {
61986200
ret = wc_Sha3_256_Update(&sha, (byte*)test_sha[i].input,
@@ -6356,8 +6358,10 @@ static wc_test_ret_t sha3_384_test(void)
63566358
test_sha[2] = c;
63576359

63586360
ret = wc_InitSha3_384(&sha, HEAP_HINT, devId);
6359-
if (ret != 0)
6361+
if (ret != 0) {
6362+
WC_FREE_VAR(shaCopy, HEAP_HINT);
63606363
return WC_TEST_RET_ENC_EC(ret);
6364+
}
63616365

63626366
for (i = 0; i < times; ++i) {
63636367
XMEMCPY(buf, test_sha[i].input, test_sha[i].inLen);
@@ -6497,8 +6501,10 @@ static wc_test_ret_t sha3_512_test(void)
64976501
test_sha[2] = c;
64986502

64996503
ret = wc_InitSha3_512(&sha, HEAP_HINT, devId);
6500-
if (ret != 0)
6504+
if (ret != 0) {
6505+
WC_FREE_VAR(shaCopy, HEAP_HINT);
65016506
return WC_TEST_RET_ENC_EC(ret);
6507+
}
65026508

65036509
for (i = 0; i < times; ++i) {
65046510
ret = wc_Sha3_512_Update(&sha, (byte*)test_sha[i].input,
@@ -6914,8 +6920,10 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t shake128_test(void)
69146920
test_sha[4] = e;
69156921

69166922
ret = wc_InitShake128(&sha, HEAP_HINT, devId);
6917-
if (ret != 0)
6923+
if (ret != 0) {
6924+
WC_FREE_VAR(shaCopy, HEAP_HINT);
69186925
return WC_TEST_RET_ENC_EC(ret);
6926+
}
69196927

69206928
for (i = 0; i < times; ++i) {
69216929
ret = wc_Shake128_Update(&sha, (byte*)test_sha[i].input,
@@ -7291,8 +7299,10 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t shake256_test(void)
72917299
test_sha[4] = e;
72927300

72937301
ret = wc_InitShake256(&sha, HEAP_HINT, devId);
7294-
if (ret != 0)
7302+
if (ret != 0) {
7303+
WC_FREE_VAR(shaCopy, HEAP_HINT);
72957304
return WC_TEST_RET_ENC_EC(ret);
7305+
}
72967306

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

0 commit comments

Comments
 (0)