Skip to content

Commit 9f61cb9

Browse files
authored
Merge pull request #6590 from dgarske/sp_math_only
Fix for SP math only case to ensure fast math and heap math are disabled
2 parents f26b8bd + 29edef1 commit 9f61cb9

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
@@ -2040,17 +2040,22 @@ extern void uITRON4_free(void *p) ;
20402040
* Constant time: Always
20412041
* Enable: WOLFSSL_SP_MATH_ALL
20422042
*/
2043+
#undef USE_FAST_MATH
2044+
#undef USE_INTEGER_HEAP_MATH
20432045
#elif defined(WOLFSSL_SP_MATH)
20442046
/* 2) SP Math with restricted key sizes: wolfSSL proprietary math
20452047
* implementation (sp_*.c).
20462048
* Constant time: Always
20472049
* Enable: WOLFSSL_SP_MATH
20482050
*/
2051+
#undef USE_FAST_MATH
2052+
#undef USE_INTEGER_HEAP_MATH
20492053
#elif defined(USE_FAST_MATH)
20502054
/* 3) Tom's Fast Math: Stack based (tfm.c)
20512055
* Constant time: Only with TFM_TIMING_RESISTANT
20522056
* Enable: USE_FAST_MATH
20532057
*/
2058+
#undef USE_INTEGER_HEAP_MATH
20542059
#elif defined(USE_INTEGER_HEAP_MATH)
20552060
/* 4) Integer Heap Math: Heap based (integer.c)
20562061
* 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)