Skip to content

Commit 29edef1

Browse files
committed
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
1 parent 2426cf1 commit 29edef1

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

wolfssl/wolfcrypt/settings.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,17 +2033,22 @@ extern void uITRON4_free(void *p) ;
20332033
* Constant time: Always
20342034
* Enable: WOLFSSL_SP_MATH_ALL
20352035
*/
2036+
#undef USE_FAST_MATH
2037+
#undef USE_INTEGER_HEAP_MATH
20362038
#elif defined(WOLFSSL_SP_MATH)
20372039
/* 2) SP Math with restricted key sizes: wolfSSL proprietary math
20382040
* implementation (sp_*.c).
20392041
* Constant time: Always
20402042
* Enable: WOLFSSL_SP_MATH
20412043
*/
2044+
#undef USE_FAST_MATH
2045+
#undef USE_INTEGER_HEAP_MATH
20422046
#elif defined(USE_FAST_MATH)
20432047
/* 3) Tom's Fast Math: Stack based (tfm.c)
20442048
* Constant time: Only with TFM_TIMING_RESISTANT
20452049
* Enable: USE_FAST_MATH
20462050
*/
2051+
#undef USE_INTEGER_HEAP_MATH
20472052
#elif defined(USE_INTEGER_HEAP_MATH)
20482053
/* 4) Integer Heap Math: Heap based (integer.c)
20492054
* Constant time: Not supported

wolfssl/wolfcrypt/sp.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@
4141
#include <wolfssl/wolfcrypt/wolfmath.h>
4242
#include <wolfssl/wolfcrypt/sp_int.h>
4343

44-
#include <wolfssl/wolfcrypt/ecc.h>
44+
#if defined(HAVE_ECC) && defined(WOLFSSL_HAVE_SP_ECC)
45+
#include <wolfssl/wolfcrypt/ecc.h>
46+
#else
47+
#undef WOLFSSL_HAVE_SP_ECC
48+
#endif
4549

4650
#ifdef noinline
4751
#define SP_NOINLINE noinline

0 commit comments

Comments
 (0)