wolfssl/wolfcrypt/types.h: make DECLARE_VAR() et al use heap allocation not only when WOLFSSL_ASYNC_CRYPT but also when WOLFSSL_SMALL_STACK.

This commit is contained in:
Daniel Pouzzner
2020-08-25 23:26:57 -05:00
parent ce8f2e65de
commit 9b7c753165
2 changed files with 14 additions and 1 deletions

View File

@@ -18897,6 +18897,19 @@ static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount,
ecc_key userA, userB, pubKey;
int curveSize;
#ifdef WOLFSSL_SMALL_STACK
#if (defined(HAVE_ECC_DHE) || defined(HAVE_ECC_CDH)) && \
!defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A)
if ((sharedA == NULL) || (sharedB == NULL))
ERROR_OUT(-9652, done);
#endif
#ifdef HAVE_ECC_SIGN
if ((sig == NULL) || (digest == NULL))
ERROR_OUT(-9653, done);
#endif
#endif /* WOLFSSL_SMALL_STACK */
(void)testVerifyCount;
(void)dp;
(void)x;

View File

@@ -396,7 +396,7 @@ decouple library dependencies with standard string, memory and so on.
#endif
/* declare/free variable handling for async */
#ifdef WOLFSSL_ASYNC_CRYPT
#if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLFSSL_SMALL_STACK)
#define DECLARE_VAR(VAR_NAME, VAR_TYPE, VAR_SIZE, HEAP) \
VAR_TYPE* VAR_NAME = (VAR_TYPE*)XMALLOC(sizeof(VAR_TYPE) * VAR_SIZE, (HEAP), DYNAMIC_TYPE_WOLF_BIGINT);
#define DECLARE_VAR_INIT(VAR_NAME, VAR_TYPE, VAR_SIZE, INIT_VALUE, HEAP) \