From e344f312731e85c63bfdf14458782e10d7b59bff Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 16 Aug 2023 17:13:06 -0700 Subject: [PATCH] Fixes for simulator malloc/free. Fix for RSA encrypt missing `wc_RsaPublicEncrypt_ex`. --- arch.mk | 1 + include/user_settings.h | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch.mk b/arch.mk index 04a378a40..d7009b70d 100644 --- a/arch.mk +++ b/arch.mk @@ -586,6 +586,7 @@ ifeq ($(TARGET),sim) USE_GCC_HEADLESS=0 LD = gcc UPDATE_OBJS:=src/update_flash.o + MATH_OBJS+=./lib/wolfssl/wolfcrypt/src/memory.o LD_START_GROUP= LD_END_GROUP= BOOT_IMG=test-app/image.elf diff --git a/include/user_settings.h b/include/user_settings.h index 86bf6b236..c83e24ccd 100644 --- a/include/user_settings.h +++ b/include/user_settings.h @@ -136,7 +136,9 @@ extern int tolower(int c); # define WOLFSSL_RSA_VERIFY_INLINE # define WOLFSSL_RSA_VERIFY_ONLY # endif -# define WC_NO_RSA_OAEP +# ifndef WOLFBOOT_TPM_KEYSTORE +# define WC_NO_RSA_OAEP +# endif # define FP_MAX_BITS (2048 * 2) /* sp math */ # if !defined(USE_FAST_MATH) && !defined(WOLFSSL_SP_MATH_ALL) @@ -229,6 +231,9 @@ extern int tolower(int c); #endif #ifdef WOLFBOOT_TPM + /* Do not use heap */ + #define WOLFTPM2_NO_HEAP + #ifdef WOLFBOOT_TPM_KEYSTORE /* Enable AES CFB (parameter encryption) and HMAC (for KDF) */ #define WOLFSSL_AES_CFB @@ -319,7 +324,9 @@ extern int tolower(int c); # define WOLFSSL_SP_NO_MALLOC # define WOLFSSL_SP_NO_DYN_STACK # endif -# define WOLFSSL_NO_MALLOC +# ifndef ARCH_SIM +# define WOLFSSL_NO_MALLOC +# endif #else # if defined(WOLFBOOT_HUGE_STACK) # error "Cannot use SMALL_STACK=1 with HUGE_STACK=1"