From 91d883d99f571b88d4fc8d15ca7439584ea69bee Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Wed, 6 Apr 2022 07:04:17 -0700 Subject: [PATCH] macro guard on ECB test case and use realloc for hash --- wolfcrypt/src/hash.c | 6 ++---- wolfcrypt/test/test.c | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/wolfcrypt/src/hash.c b/wolfcrypt/src/hash.c index 28b1edc9d..b733a3472 100644 --- a/wolfcrypt/src/hash.c +++ b/wolfcrypt/src/hash.c @@ -1715,13 +1715,11 @@ int _wc_Sha_Grow(byte** msg, word32* used, word32* len, const byte* in, *msg = (byte*)XMALLOC(*used + inSz, heap, DYNAMIC_TYPE_TMP_BUFFER); } else { - byte* pt = (byte*)XMALLOC(*used + inSz, heap, - DYNAMIC_TYPE_TMP_BUFFER); + byte* pt = (byte*)XREALLOC(*msg, *used + inSz, heap, + DYNAMIC_TYPE_TMP_BUFFER); if (pt == NULL) { return MEMORY_E; } - XMEMCPY(pt, *msg, *used); - XFREE(*msg, heap, DYNAMIC_TYPE_TMP_BUFFER); *msg = pt; } if (*msg == NULL) { diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index b2ae77b54..c50d96433 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -8462,7 +8462,7 @@ static int aes_cbc_test(void) } #endif -#ifdef HAVE_AES_ECB +#if defined(HAVE_AES_ECB) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) static int aesecb_test(void) { #ifdef WOLFSSL_SMALL_STACK @@ -9174,7 +9174,7 @@ WOLFSSL_TEST_SUBROUTINE int aes_test(void) #endif #endif -#if defined(HAVE_AES_ECB) +#if defined(HAVE_AES_ECB) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) ret = aesecb_test(); if (ret != 0) goto out; @@ -38726,7 +38726,7 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx) } } #endif /* HAVE_AES_CBC */ - #ifdef HAVE_AES_ECB + #if defined(HAVE_AES_ECB) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) if (info->cipher.type == WC_CIPHER_AES_ECB) { if (info->cipher.enc) { /* set devId to invalid, so software is used */