Skip to content

Commit

Permalink
CID 426062,426063 initialization and free check
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Oct 22, 2024
1 parent 27267d7 commit 18150a1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions wolfcrypt/test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13939,6 +13939,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_cbc_test(void)
if ((bigCipher == NULL) ||
(bigPlain == NULL)) {
XFREE(bigCipher, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(bigPlain, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
}
#else
Expand Down Expand Up @@ -35099,6 +35100,16 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve25519_test(void)
(void)x;
WOLFSSL_ENTER("curve25519_test");

/* wc_FreeRng is always called on exit. Therefore wc_InitRng should be
* called before any exit goto's */
#ifndef HAVE_FIPS
ret = wc_InitRng_ex(&rng, HEAP_HINT, devId);
#else
ret = wc_InitRng(&rng);
#endif
if (ret != 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), cleanup);

#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
userA = wc_curve25519_new(HEAP_HINT, devId, &ret);
if (ret != 0)
Expand All @@ -35115,14 +35126,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve25519_test(void)
wc_curve25519_init_ex(pubKey, HEAP_HINT, devId);
#endif

#ifndef HAVE_FIPS
ret = wc_InitRng_ex(&rng, HEAP_HINT, devId);
#else
ret = wc_InitRng(&rng);
#endif
if (ret != 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), cleanup);

/* make curve25519 keys */
ret = wc_curve25519_make_key(&rng, 32, userA);
if (ret != 0)
Expand Down

0 comments on commit 18150a1

Please sign in to comment.