Merge pull request #2900 from dgarske/sp_no_malloc
Added option to build SP small without malloc
This commit is contained in:
commit
416f0775d3
@ -4236,6 +4236,7 @@ ENABLED_SP_FF_4096=no
|
||||
ENABLED_SP_ECC=no
|
||||
ENABLED_SP_EC_256=no
|
||||
ENABLED_SP_EC_384=no
|
||||
ENABLED_SP_NO_MALLOC=no
|
||||
for v in `echo $ENABLED_SP | tr "," " "`
|
||||
do
|
||||
case $v in
|
||||
@ -4354,6 +4355,10 @@ do
|
||||
ENABLED_SP_FF_4096=yes
|
||||
;;
|
||||
|
||||
nomalloc)
|
||||
ENABLED_SP_NO_MALLOC=yes
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid choice of Single Precision length in bits [256, 2048, 3072]: $ENABLED_SP.])
|
||||
break;;
|
||||
@ -4402,6 +4407,10 @@ if test "$ENABLED_SP_SMALL" = "yes"; then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_SMALL"
|
||||
AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_SMALL"
|
||||
fi
|
||||
if test "$ENABLED_SP_NO_MALLOC" = "yes"; then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_NO_MALLOC"
|
||||
AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SP_NO_MALLOC"
|
||||
fi
|
||||
|
||||
|
||||
AC_ARG_ENABLE([sp-asm],
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -34,6 +34,26 @@
|
||||
#include <wolfcrypt/src/misc.c>
|
||||
#endif
|
||||
|
||||
/* SP Build Options:
|
||||
* WOLFSSL_HAVE_SP_RSA: Enable SP RSA support
|
||||
* WOLFSSL_HAVE_SP_DH: Enable SP DH support
|
||||
* WOLFSSL_HAVE_SP_ECC: Enable SP ECC support
|
||||
* WOLFSSL_SP_MATH: Use only single precision math and algorithms it supports (no fastmath tfm.c or normal integer.c)
|
||||
* WOLFSSL_SP_SMALL: Use smaller version of code and avoid large stack variables
|
||||
* WOLFSSL_SP_NO_MALLOC: Always use stack, no heap XMALLOC/XFREE allowed
|
||||
* WOLFSSL_SP_NO_3072: Disable RSA/DH 3072-bit support
|
||||
* WOLFSSL_SP_NO_2048: Disable RSA/DH 2048-bit support
|
||||
* WOLFSSL_SP_4096: Enable RSA/RH 4096-bit support
|
||||
* WOLFSSL_SP_384 Enable ECC 384-bit SECP384R1 support
|
||||
* WOLFSSL_SP_NO_256 Disable ECC 256-bit SECP256R1 support
|
||||
* WOLFSSL_SP_CACHE_RESISTANT Enable cache resistantant code
|
||||
* WOLFSSL_SP_ASM Enable assembly speedups (detect platform)
|
||||
* WOLFSSL_SP_X86_64_ASM Enable Intel x86 assembly speedups like AVX/AVX2
|
||||
* WOLFSSL_SP_ARM32_ASM Enable Aarch32 assembly speedups
|
||||
* WOLFSSL_SP_ARM64_ASM Enable Aarch64 assembly speedups
|
||||
* WOLFSSL_SP_ARM_CORTEX_M_ASM Enable Cortex-M assembly speedups
|
||||
* WOLFSSL_SP_ARM_THUMB_ASM Enable ARM Thumb assembly speedups (used with -mthumb)
|
||||
*/
|
||||
|
||||
#ifdef WOLFSSL_SP_MATH
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -10056,6 +10056,7 @@ int random_test(void)
|
||||
#define MEM_TEST_SZ 1024
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_STATIC_MEMORY) || !defined(WOLFSSL_NO_MALLOC)
|
||||
static int simple_mem_test(int sz)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -10080,6 +10081,7 @@ static int simple_mem_test(int sz)
|
||||
XFREE(b, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int memory_test(void)
|
||||
{
|
||||
@ -10185,10 +10187,12 @@ int memory_test(void)
|
||||
(void)dist; /* avoid static analysis warning of variable not used */
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_STATIC_MEMORY) || !defined(WOLFSSL_NO_MALLOC)
|
||||
/* simple test */
|
||||
ret = simple_mem_test(MEM_TEST_SZ);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
#ifdef COMPLEX_MEM_TEST
|
||||
/* test various size blocks */
|
||||
@ -10212,7 +10216,7 @@ int memory_test(void)
|
||||
XFREE(b, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -27889,6 +27893,8 @@ int mutex_test(void)
|
||||
}
|
||||
|
||||
#if defined(USE_WOLFSSL_MEMORY) && !defined(FREERTOS)
|
||||
|
||||
#ifndef WOLFSSL_NO_MALLOC
|
||||
static int malloc_cnt = 0;
|
||||
static int realloc_cnt = 0;
|
||||
static int free_cnt = 0;
|
||||
@ -27900,6 +27906,7 @@ static void *my_Malloc_cb(size_t size)
|
||||
return malloc(size);
|
||||
#else
|
||||
WOLFSSL_MSG("No malloc available");
|
||||
(void)size;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
@ -27910,6 +27917,7 @@ static void my_Free_cb(void *ptr)
|
||||
free(ptr);
|
||||
#else
|
||||
WOLFSSL_MSG("No free available");
|
||||
(void)ptr;
|
||||
#endif
|
||||
}
|
||||
static void *my_Realloc_cb(void *ptr, size_t size)
|
||||
@ -27919,14 +27927,19 @@ static void *my_Realloc_cb(void *ptr, size_t size)
|
||||
return realloc(ptr, size);
|
||||
#else
|
||||
WOLFSSL_MSG("No realloc available");
|
||||
(void)ptr;
|
||||
(void)size;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
#endif /* !WOLFSSL_NO_MALLOC */
|
||||
|
||||
int memcb_test(void)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifndef WOLFSSL_NO_MALLOC
|
||||
byte* b = NULL;
|
||||
#endif
|
||||
wolfSSL_Malloc_cb mc;
|
||||
wolfSSL_Free_cb fc;
|
||||
wolfSSL_Realloc_cb rc;
|
||||
@ -27972,7 +27985,7 @@ exit_memcb:
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif /* USE_WOLFSSL_MEMORY && !WOLFSSL_NO_MALLOC */
|
||||
|
||||
|
||||
#ifdef WOLFSSL_IMX6_CAAM_BLOB
|
||||
|
Loading…
x
Reference in New Issue
Block a user