Merge pull request #7847 from SparkiDev/sp_xfree_2

SP: Remove check of NULL before XFREE
This commit is contained in:
Daniel Pouzzner
2024-08-09 14:47:05 -05:00
committed by GitHub
7 changed files with 144 additions and 186 deletions

View File

@@ -73547,15 +73547,15 @@ static int sp_256_ecc_mulmod_fast_8(sp_point_256* r, const sp_point_256* g, cons
#endif
}
#ifndef WC_NO_CACHE_RESISTANT
#ifdef WOLFSSL_SP_SMALL_STACK
#ifdef WOLFSSL_SP_SMALL_STACK
if (p != NULL)
#endif
{
ForceZero(p, sizeof(sp_point_256));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
{
ForceZero(p, sizeof(sp_point_256));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
}
}
#endif /* !WC_NO_CACHE_RESISTANT */
#ifdef WOLFSSL_SP_SMALL_STACK
if (t != NULL)
@@ -76464,10 +76464,8 @@ int sp_ecc_make_key_256(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -91268,15 +91266,15 @@ static int sp_384_ecc_mulmod_fast_12(sp_point_384* r, const sp_point_384* g, con
#endif
}
#ifndef WC_NO_CACHE_RESISTANT
#ifdef WOLFSSL_SP_SMALL_STACK
#ifdef WOLFSSL_SP_SMALL_STACK
if (p != NULL)
#endif
{
ForceZero(p, sizeof(sp_point_384));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
{
ForceZero(p, sizeof(sp_point_384));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
}
}
#endif /* !WC_NO_CACHE_RESISTANT */
#ifdef WOLFSSL_SP_SMALL_STACK
if (t != NULL)
@@ -94223,10 +94221,8 @@ int sp_ecc_make_key_384(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -118420,15 +118416,15 @@ static int sp_521_ecc_mulmod_fast_17(sp_point_521* r, const sp_point_521* g, con
#endif
}
#ifndef WC_NO_CACHE_RESISTANT
#ifdef WOLFSSL_SP_SMALL_STACK
#ifdef WOLFSSL_SP_SMALL_STACK
if (p != NULL)
#endif
{
ForceZero(p, sizeof(sp_point_521));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
{
ForceZero(p, sizeof(sp_point_521));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
}
}
#endif /* !WC_NO_CACHE_RESISTANT */
#ifdef WOLFSSL_SP_SMALL_STACK
if (t != NULL)
@@ -121969,10 +121965,8 @@ int sp_ecc_make_key_521(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -144551,16 +144545,16 @@ static void sp_1024_point_free_32(sp_point_1024* p, int clear, void* heap)
{
#if (defined(WOLFSSL_SP_SMALL) && !defined(WOLFSSL_SP_NO_MALLOC)) || \
defined(WOLFSSL_SP_SMALL_STACK)
/* If valid pointer then clear point data if requested and free data. */
/* If valid pointer then clear point data if requested and free data. */
if (p != NULL) {
if (clear != 0) {
if (clear) {
XMEMSET(p, 0, sizeof(*p));
}
XFREE(p, heap, DYNAMIC_TYPE_ECC);
}
#else
/* Clear point data if requested. */
if ((p != NULL) && (clear != 0)) {
/* Clear point data if requested. */
if ((p != NULL) && clear) {
XMEMSET(p, 0, sizeof(*p));
}
#endif

View File

@@ -39858,10 +39858,8 @@ int sp_ecc_make_key_256(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -66598,10 +66596,8 @@ int sp_ecc_make_key_384(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -111737,10 +111733,8 @@ int sp_ecc_make_key_521(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -115523,16 +115517,16 @@ static void sp_1024_point_free_16(sp_point_1024* p, int clear, void* heap)
{
#if (defined(WOLFSSL_SP_SMALL) && !defined(WOLFSSL_SP_NO_MALLOC)) || \
defined(WOLFSSL_SP_SMALL_STACK)
/* If valid pointer then clear point data if requested and free data. */
/* If valid pointer then clear point data if requested and free data. */
if (p != NULL) {
if (clear != 0) {
if (clear) {
XMEMSET(p, 0, sizeof(*p));
}
XFREE(p, heap, DYNAMIC_TYPE_ECC);
}
#else
/* Clear point data if requested. */
if ((p != NULL) && (clear != 0)) {
/* Clear point data if requested. */
if ((p != NULL) && clear) {
XMEMSET(p, 0, sizeof(*p));
}
#endif

View File

@@ -101049,15 +101049,15 @@ static int sp_256_ecc_mulmod_fast_8(sp_point_256* r, const sp_point_256* g, cons
#endif
}
#ifndef WC_NO_CACHE_RESISTANT
#ifdef WOLFSSL_SP_SMALL_STACK
#ifdef WOLFSSL_SP_SMALL_STACK
if (p != NULL)
#endif
{
ForceZero(p, sizeof(sp_point_256));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
{
ForceZero(p, sizeof(sp_point_256));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
}
}
#endif /* !WC_NO_CACHE_RESISTANT */
#ifdef WOLFSSL_SP_SMALL_STACK
if (t != NULL)
@@ -104024,10 +104024,8 @@ int sp_ecc_make_key_256(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -111877,15 +111875,15 @@ static int sp_384_ecc_mulmod_fast_12(sp_point_384* r, const sp_point_384* g, con
#endif
}
#ifndef WC_NO_CACHE_RESISTANT
#ifdef WOLFSSL_SP_SMALL_STACK
#ifdef WOLFSSL_SP_SMALL_STACK
if (p != NULL)
#endif
{
ForceZero(p, sizeof(sp_point_384));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
{
ForceZero(p, sizeof(sp_point_384));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
}
}
#endif /* !WC_NO_CACHE_RESISTANT */
#ifdef WOLFSSL_SP_SMALL_STACK
if (t != NULL)
@@ -114920,10 +114918,8 @@ int sp_ecc_make_key_384(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -125477,15 +125473,15 @@ static int sp_521_ecc_mulmod_fast_17(sp_point_521* r, const sp_point_521* g, con
#endif
}
#ifndef WC_NO_CACHE_RESISTANT
#ifdef WOLFSSL_SP_SMALL_STACK
#ifdef WOLFSSL_SP_SMALL_STACK
if (p != NULL)
#endif
{
ForceZero(p, sizeof(sp_point_521));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
{
ForceZero(p, sizeof(sp_point_521));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
}
}
#endif /* !WC_NO_CACHE_RESISTANT */
#ifdef WOLFSSL_SP_SMALL_STACK
if (t != NULL)
@@ -129150,10 +129146,8 @@ int sp_ecc_make_key_521(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -202402,16 +202396,16 @@ static void sp_1024_point_free_32(sp_point_1024* p, int clear, void* heap)
{
#if (defined(WOLFSSL_SP_SMALL) && !defined(WOLFSSL_SP_NO_MALLOC)) || \
defined(WOLFSSL_SP_SMALL_STACK)
/* If valid pointer then clear point data if requested and free data. */
/* If valid pointer then clear point data if requested and free data. */
if (p != NULL) {
if (clear != 0) {
if (clear) {
XMEMSET(p, 0, sizeof(*p));
}
XFREE(p, heap, DYNAMIC_TYPE_ECC);
}
#else
/* Clear point data if requested. */
if ((p != NULL) && (clear != 0)) {
/* Clear point data if requested. */
if ((p != NULL) && clear) {
XMEMSET(p, 0, sizeof(*p));
}
#endif

View File

@@ -4103,7 +4103,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 36 * 13);
@@ -7550,7 +7550,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 53 * 13);
@@ -11657,7 +11657,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 56 * 13);
@@ -15186,7 +15186,7 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 71 * 13);
@@ -19160,7 +19160,7 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 81 * 13);
@@ -24945,10 +24945,8 @@ int sp_ecc_make_key_256(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -32982,10 +32980,8 @@ int sp_ecc_make_key_384(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -41068,10 +41064,8 @@ int sp_ecc_make_key_521(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -44308,16 +44302,16 @@ static void sp_1024_point_free_42(sp_point_1024* p, int clear, void* heap)
{
#if (defined(WOLFSSL_SP_SMALL) && !defined(WOLFSSL_SP_NO_MALLOC)) || \
defined(WOLFSSL_SP_SMALL_STACK)
/* If valid pointer then clear point data if requested and free data. */
/* If valid pointer then clear point data if requested and free data. */
if (p != NULL) {
if (clear != 0) {
if (clear) {
XMEMSET(p, 0, sizeof(*p));
}
XFREE(p, heap, DYNAMIC_TYPE_ECC);
}
#else
/* Clear point data if requested. */
if ((p != NULL) && (clear != 0)) {
/* Clear point data if requested. */
if ((p != NULL) && clear) {
XMEMSET(p, 0, sizeof(*p));
}
#endif

View File

@@ -2774,7 +2774,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 17 * 13);
@@ -6363,7 +6363,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 18 * 13);
@@ -9635,7 +9635,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 26 * 13);
@@ -13373,7 +13373,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 27 * 13);
@@ -16682,7 +16682,7 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 35 * 13);
@@ -20476,7 +20476,7 @@ int sp_RsaPrivate_4096(const byte* in, word32 inLen, const mp_int* dm,
}
#ifdef WOLFSSL_SP_SMALL_STACK
if (a != NULL)
if (a != NULL)
#endif
{
ForceZero(a, sizeof(sp_digit) * 39 * 13);
@@ -25841,10 +25841,8 @@ int sp_ecc_make_key_256(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -33303,10 +33301,8 @@ int sp_ecc_make_key_384(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -40717,10 +40713,8 @@ int sp_ecc_make_key_521(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -43762,16 +43756,16 @@ static void sp_1024_point_free_18(sp_point_1024* p, int clear, void* heap)
{
#if (defined(WOLFSSL_SP_SMALL) && !defined(WOLFSSL_SP_NO_MALLOC)) || \
defined(WOLFSSL_SP_SMALL_STACK)
/* If valid pointer then clear point data if requested and free data. */
/* If valid pointer then clear point data if requested and free data. */
if (p != NULL) {
if (clear != 0) {
if (clear) {
XMEMSET(p, 0, sizeof(*p));
}
XFREE(p, heap, DYNAMIC_TYPE_ECC);
}
#else
/* Clear point data if requested. */
if ((p != NULL) && (clear != 0)) {
/* Clear point data if requested. */
if ((p != NULL) && clear) {
XMEMSET(p, 0, sizeof(*p));
}
#endif

View File

@@ -36632,15 +36632,15 @@ static int sp_256_ecc_mulmod_fast_8(sp_point_256* r, const sp_point_256* g, cons
#endif
}
#ifndef WC_NO_CACHE_RESISTANT
#ifdef WOLFSSL_SP_SMALL_STACK
#ifdef WOLFSSL_SP_SMALL_STACK
if (p != NULL)
#endif
{
ForceZero(p, sizeof(sp_point_256));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
{
ForceZero(p, sizeof(sp_point_256));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
}
}
#endif /* !WC_NO_CACHE_RESISTANT */
#ifdef WOLFSSL_SP_SMALL_STACK
if (t != NULL)
@@ -39555,10 +39555,8 @@ int sp_ecc_make_key_256(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -46653,15 +46651,15 @@ static int sp_384_ecc_mulmod_fast_12(sp_point_384* r, const sp_point_384* g, con
#endif
}
#ifndef WC_NO_CACHE_RESISTANT
#ifdef WOLFSSL_SP_SMALL_STACK
#ifdef WOLFSSL_SP_SMALL_STACK
if (p != NULL)
#endif
{
ForceZero(p, sizeof(sp_point_384));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
{
ForceZero(p, sizeof(sp_point_384));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
}
}
#endif /* !WC_NO_CACHE_RESISTANT */
#ifdef WOLFSSL_SP_SMALL_STACK
if (t != NULL)
@@ -49614,10 +49612,8 @@ int sp_ecc_make_key_384(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -58818,15 +58814,15 @@ static int sp_521_ecc_mulmod_fast_17(sp_point_521* r, const sp_point_521* g, con
#endif
}
#ifndef WC_NO_CACHE_RESISTANT
#ifdef WOLFSSL_SP_SMALL_STACK
#ifdef WOLFSSL_SP_SMALL_STACK
if (p != NULL)
#endif
{
ForceZero(p, sizeof(sp_point_521));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
{
ForceZero(p, sizeof(sp_point_521));
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(p, heap, DYNAMIC_TYPE_ECC);
#endif
}
}
#endif /* !WC_NO_CACHE_RESISTANT */
#ifdef WOLFSSL_SP_SMALL_STACK
if (t != NULL)
@@ -62373,10 +62369,8 @@ int sp_ecc_make_key_521(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -70771,16 +70765,16 @@ static void sp_1024_point_free_32(sp_point_1024* p, int clear, void* heap)
{
#if (defined(WOLFSSL_SP_SMALL) && !defined(WOLFSSL_SP_NO_MALLOC)) || \
defined(WOLFSSL_SP_SMALL_STACK)
/* If valid pointer then clear point data if requested and free data. */
/* If valid pointer then clear point data if requested and free data. */
if (p != NULL) {
if (clear != 0) {
if (clear) {
XMEMSET(p, 0, sizeof(*p));
}
XFREE(p, heap, DYNAMIC_TYPE_ECC);
}
#else
/* Clear point data if requested. */
if ((p != NULL) && (clear != 0)) {
/* Clear point data if requested. */
if ((p != NULL) && clear) {
XMEMSET(p, 0, sizeof(*p));
}
#endif

View File

@@ -24609,10 +24609,8 @@ int sp_ecc_make_key_256(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -49582,10 +49580,8 @@ int sp_ecc_make_key_384(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -90616,10 +90612,8 @@ int sp_ecc_make_key_521(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap)
#ifdef WOLFSSL_SP_SMALL_STACK
XFREE(k, heap, DYNAMIC_TYPE_ECC);
if (point != NULL) {
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
}
/* point is not sensitive, so no need to zeroize */
XFREE(point, heap, DYNAMIC_TYPE_ECC);
#endif
return err;
@@ -93352,16 +93346,16 @@ static void sp_1024_point_free_16(sp_point_1024* p, int clear, void* heap)
{
#if (defined(WOLFSSL_SP_SMALL) && !defined(WOLFSSL_SP_NO_MALLOC)) || \
defined(WOLFSSL_SP_SMALL_STACK)
/* If valid pointer then clear point data if requested and free data. */
/* If valid pointer then clear point data if requested and free data. */
if (p != NULL) {
if (clear != 0) {
if (clear) {
XMEMSET(p, 0, sizeof(*p));
}
XFREE(p, heap, DYNAMIC_TYPE_ECC);
}
#else
/* Clear point data if requested. */
if ((p != NULL) && (clear != 0)) {
/* Clear point data if requested. */
if ((p != NULL) && clear) {
XMEMSET(p, 0, sizeof(*p));
}
#endif