From 29edef1645d1e92e015f95eeaa8f6761f0167408 Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 10 Jul 2023 13:09:58 -0700 Subject: [PATCH] Fix for SP math only case to ensure fast math and heap math are disabled. Also fix build error for case where `WOLFSSL_HAVE_SP_ECC` is defined, but `HAVE_ECC` is not. ZD 16419 --- wolfssl/wolfcrypt/settings.h | 5 +++++ wolfssl/wolfcrypt/sp.h | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index a14364d4d1..cc0d876314 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -2033,17 +2033,22 @@ extern void uITRON4_free(void *p) ; * Constant time: Always * Enable: WOLFSSL_SP_MATH_ALL */ + #undef USE_FAST_MATH + #undef USE_INTEGER_HEAP_MATH #elif defined(WOLFSSL_SP_MATH) /* 2) SP Math with restricted key sizes: wolfSSL proprietary math * implementation (sp_*.c). * Constant time: Always * Enable: WOLFSSL_SP_MATH */ + #undef USE_FAST_MATH + #undef USE_INTEGER_HEAP_MATH #elif defined(USE_FAST_MATH) /* 3) Tom's Fast Math: Stack based (tfm.c) * Constant time: Only with TFM_TIMING_RESISTANT * Enable: USE_FAST_MATH */ + #undef USE_INTEGER_HEAP_MATH #elif defined(USE_INTEGER_HEAP_MATH) /* 4) Integer Heap Math: Heap based (integer.c) * Constant time: Not supported diff --git a/wolfssl/wolfcrypt/sp.h b/wolfssl/wolfcrypt/sp.h index 2bf033af0d..4544f5264c 100644 --- a/wolfssl/wolfcrypt/sp.h +++ b/wolfssl/wolfcrypt/sp.h @@ -41,7 +41,11 @@ #include #include -#include +#if defined(HAVE_ECC) && defined(WOLFSSL_HAVE_SP_ECC) + #include +#else + #undef WOLFSSL_HAVE_SP_ECC +#endif #ifdef noinline #define SP_NOINLINE noinline