From 74baa0dafa9f15f008490fdc95d3d0e9918c0dd4 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Thu, 7 Jul 2022 12:16:12 +1000 Subject: [PATCH] SP math: fix configure.ac to allow its use Choosing SP and SP math was resulting in only integer.c being used. Fixed now. Reorder realloc calls for memory logging to ensure scripts can match allocate and free calls. --- configure.ac | 4 ++-- wolfcrypt/src/memory.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index df97ac75c..2b1617cec 100644 --- a/configure.ac +++ b/configure.ac @@ -603,7 +603,7 @@ then fi # if sp-math-all is not set, then enable fast math -if test "x$ENABLED_FASTMATH" = "xyes" && test "$enable_sp_math_all" = "" +if test "x$ENABLED_FASTMATH" = "xyes" && test "$enable_sp_math_all" = "" && test "$enable_sp_math" = "" then # turn off fastmth if leanpsk on or asn off (w/o DH and ECC) if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no" @@ -640,7 +640,7 @@ AC_ARG_ENABLE([heapmath], [ ENABLED_HEAPMATH=$enableval ], [ ENABLED_HEAPMATH=no] ) -if test "x$ENABLED_HEAPMATH" = "xyes" || (test "x$ENABLED_SP_MATH_ALL" = "xno" && test "x$ENABLED_FASTMATH" = "xno") +if test "x$ENABLED_HEAPMATH" = "xyes" || (test "x$ENABLED_SP_MATH_ALL" = "xno" && test "x$ENABLED_FASTMATH" = "xno" && test "x$ENABLED_SP_MATH" = "xno") then AM_CFLAGS="$AM_CFLAGS -DUSE_INTEGER_HEAP_MATH" ENABLED_HEAPMATH="yes" diff --git a/wolfcrypt/src/memory.c b/wolfcrypt/src/memory.c index b4d77a70b..aabf49d51 100644 --- a/wolfcrypt/src/memory.c +++ b/wolfcrypt/src/memory.c @@ -1283,12 +1283,12 @@ void *xrealloc(void *p, size_t n, void* heap, int type, const char* func, p32[0] = (word32)n; newp = (void*)(p32 + 4); - fprintf(stderr, "Alloc: %p -> %u (%d) at %s:%s:%u\n", newp, (word32)n, - type, func, file, line); if (p != NULL) { fprintf(stderr, "Free: %p -> %u (%d) at %s:%s:%u\n", p, oldLen, type, func, file, line); } + fprintf(stderr, "Alloc: %p -> %u (%d) at %s:%s:%u\n", newp, (word32)n, + type, func, file, line); } (void)heap;