forked from wolfSSL/wolfssl
Optimize memory usage for ARM Cortex M and similar embedded systems (#578)
* Changed ge_precomp data to const to reduce RAM usage on embedded systems. * Add configuration option "WOLFSSL_NRF5x" for Nordic nRF5x platform in settings.h
This commit is contained in:
@ -758,7 +758,7 @@ static unsigned char negative(signed char b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void cmov(ge_precomp *t,ge_precomp *u,unsigned char b)
|
static void cmov(ge_precomp *t,const ge_precomp *u,unsigned char b)
|
||||||
{
|
{
|
||||||
fe_cmov(t->yplusx,u->yplusx,b);
|
fe_cmov(t->yplusx,u->yplusx,b);
|
||||||
fe_cmov(t->yminusx,u->yminusx,b);
|
fe_cmov(t->yminusx,u->yminusx,b);
|
||||||
@ -767,7 +767,7 @@ static void cmov(ge_precomp *t,ge_precomp *u,unsigned char b)
|
|||||||
|
|
||||||
|
|
||||||
/* base[i][j] = (j+1)*256^i*B */
|
/* base[i][j] = (j+1)*256^i*B */
|
||||||
static ge_precomp base[32][8] = {
|
static const ge_precomp base[32][8] = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ 25967493,-14356035,29566456,3660896,-12694345,4014787,27544626,-11754271,-6079156,2047605 },
|
{ 25967493,-14356035,29566456,3660896,-12694345,4014787,27544626,-11754271,-6079156,2047605 },
|
||||||
@ -2222,7 +2222,7 @@ static void slide(signed char *r,const unsigned char *a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ge_precomp Bi[8] = {
|
static const ge_precomp Bi[8] = {
|
||||||
{
|
{
|
||||||
{ 25967493,-14356035,29566456,3660896,-12694345,4014787,27544626,-11754271,-6079156,2047605 },
|
{ 25967493,-14356035,29566456,3660896,-12694345,4014787,27544626,-11754271,-6079156,2047605 },
|
||||||
{ -12545711,934262,-2722910,3049990,-727428,9406986,12720692,5043384,19500929,-15469378 },
|
{ -12545711,934262,-2722910,3049990,-727428,9406986,12720692,5043384,19500929,-15469378 },
|
||||||
|
@ -124,6 +124,9 @@
|
|||||||
/* Uncomment next line if building for VxWorks */
|
/* Uncomment next line if building for VxWorks */
|
||||||
/* #define WOLFSSL_VXWORKS */
|
/* #define WOLFSSL_VXWORKS */
|
||||||
|
|
||||||
|
/* Uncomment next line if building for Nordic nRF5x platofrm */
|
||||||
|
/* #define WOLFSSL_NRF5x */
|
||||||
|
|
||||||
/* Uncomment next line to enable deprecated less secure static DH suites */
|
/* Uncomment next line to enable deprecated less secure static DH suites */
|
||||||
/* #define WOLFSSL_STATIC_DH */
|
/* #define WOLFSSL_STATIC_DH */
|
||||||
|
|
||||||
@ -401,6 +404,23 @@
|
|||||||
#define SINGLE_THREADED /* Not ported at this time */
|
#define SINGLE_THREADED /* Not ported at this time */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_NRF5x
|
||||||
|
#define SIZEOF_LONG 4
|
||||||
|
#define SIZEOF_LONG_LONG 8
|
||||||
|
#define NO_ASN_TIME
|
||||||
|
#define NO_DEV_RANDOM
|
||||||
|
#define NO_FILESYSTEM
|
||||||
|
#define NO_MAIN_DRIVER
|
||||||
|
#define NO_WRITEV
|
||||||
|
#define SINGLE_THREADED
|
||||||
|
#define USE_FAST_MATH
|
||||||
|
#define TFM_TIMING_RESISTANT
|
||||||
|
#define USE_WOLFSSL_MEMORY
|
||||||
|
#define WOLFSSL_NRF51
|
||||||
|
#define WOLFSSL_USER_IO
|
||||||
|
#define NO_SESSION_CACHE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \
|
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \
|
||||||
!defined(FREERTOS_TCP) && !defined(EBSNET) && !defined(WOLFSSL_EROAD) && \
|
!defined(FREERTOS_TCP) && !defined(EBSNET) && !defined(WOLFSSL_EROAD) && \
|
||||||
|
Reference in New Issue
Block a user