mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 19:54:40 +02:00
Merge pull request #8975 from JeremiahM37/mldsa_static_mem
ML-DSA Static Memory Fix
This commit is contained in:
@@ -1073,6 +1073,15 @@ static WC_MAYBE_UNUSED int wc_DeleteRsaKey(RsaKey* key, RsaKey** key_p)
|
|||||||
#ifdef WOLFSSL_STATIC_MEMORY
|
#ifdef WOLFSSL_STATIC_MEMORY
|
||||||
#if defined(WOLFSSL_STATIC_MEMORY_TEST_SZ)
|
#if defined(WOLFSSL_STATIC_MEMORY_TEST_SZ)
|
||||||
static byte gTestMemory[WOLFSSL_STATIC_MEMORY_TEST_SZ];
|
static byte gTestMemory[WOLFSSL_STATIC_MEMORY_TEST_SZ];
|
||||||
|
#elif defined(HAVE_DILITHIUM)
|
||||||
|
#if defined(WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_SIGN_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_MAKE_KEY_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_VERIFY_ONLY)
|
||||||
|
static byte gTestMemory[192*1024]; /* Dilithium low mem */
|
||||||
|
#else
|
||||||
|
static byte gTestMemory[576*1024]; /* Dilithium full mem */
|
||||||
|
#endif
|
||||||
#elif defined(BENCH_EMBEDDED)
|
#elif defined(BENCH_EMBEDDED)
|
||||||
static byte gTestMemory[14000];
|
static byte gTestMemory[14000];
|
||||||
#elif defined(WOLFSSL_CERT_EXT)
|
#elif defined(WOLFSSL_CERT_EXT)
|
||||||
|
@@ -133,7 +133,18 @@ WOLFSSL_API int wolfSSL_GetAllocators(wolfSSL_Malloc_cb* mf,
|
|||||||
|
|
||||||
#ifndef LARGEST_MEM_BUCKET
|
#ifndef LARGEST_MEM_BUCKET
|
||||||
#ifndef SESSION_CERTS
|
#ifndef SESSION_CERTS
|
||||||
#define LARGEST_MEM_BUCKET 16128
|
#ifdef HAVE_DILITHIUM
|
||||||
|
#if defined(WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_SIGN_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_MAKE_KEY_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_VERIFY_ONLY)
|
||||||
|
#define LARGEST_MEM_BUCKET 14000 /* Dilithium low mem */
|
||||||
|
#else
|
||||||
|
#define LARGEST_MEM_BUCKET 131072 /* Dilithium full mem */
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define LARGEST_MEM_BUCKET 16128
|
||||||
|
#endif
|
||||||
#elif defined(OPENSSL_EXTRA)
|
#elif defined(OPENSSL_EXTRA)
|
||||||
#ifdef WOLFSSL_TLS13
|
#ifdef WOLFSSL_TLS13
|
||||||
#define LARGEST_MEM_BUCKET 30400
|
#define LARGEST_MEM_BUCKET 30400
|
||||||
@@ -151,9 +162,24 @@ WOLFSSL_API int wolfSSL_GetAllocators(wolfSSL_Malloc_cb* mf,
|
|||||||
|
|
||||||
#ifndef WOLFMEM_BUCKETS
|
#ifndef WOLFMEM_BUCKETS
|
||||||
#ifndef SESSION_CERTS
|
#ifndef SESSION_CERTS
|
||||||
/* default size of chunks of memory to separate into */
|
#ifdef HAVE_DILITHIUM
|
||||||
#define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3456,4544,\
|
#if defined(WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM) && \
|
||||||
LARGEST_MEM_BUCKET
|
defined(WOLFSSL_DILITHIUM_SIGN_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_MAKE_KEY_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_VERIFY_ONLY)
|
||||||
|
/* default size of chunks of memory to separate into */
|
||||||
|
#define WOLFMEM_BUCKETS 64,128,256,512,1024,2048,4096,\
|
||||||
|
8192,LARGEST_MEM_BUCKET
|
||||||
|
#else
|
||||||
|
/* default size of chunks of memory to separate into */
|
||||||
|
#define WOLFMEM_BUCKETS 64,128,256,512,1024,8192,32768,\
|
||||||
|
65536,LARGEST_MEM_BUCKET
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
/* default size of chunks of memory to separate into */
|
||||||
|
#define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3456,4544,\
|
||||||
|
LARGEST_MEM_BUCKET
|
||||||
|
#endif
|
||||||
#elif defined(OPENSSL_EXTRA)
|
#elif defined(OPENSSL_EXTRA)
|
||||||
/* extra storage in structs for multiple attributes and order */
|
/* extra storage in structs for multiple attributes and order */
|
||||||
#define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3360,4480,\
|
#define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3360,4480,\
|
||||||
@@ -168,7 +194,16 @@ WOLFSSL_API int wolfSSL_GetAllocators(wolfSSL_Malloc_cb* mf,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WOLFMEM_DIST
|
#ifndef WOLFMEM_DIST
|
||||||
#ifndef WOLFSSL_STATIC_MEMORY_SMALL
|
#ifdef HAVE_DILITHIUM
|
||||||
|
#if defined(WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_SIGN_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_MAKE_KEY_SMALL_MEM) && \
|
||||||
|
defined(WOLFSSL_DILITHIUM_VERIFY_ONLY)
|
||||||
|
#define WOLFMEM_DIST 20,8,6,10,8,6,4,2,1
|
||||||
|
#else
|
||||||
|
#define WOLFMEM_DIST 30,10,8,15,8,10,8,5,1
|
||||||
|
#endif
|
||||||
|
#elif !defined(WOLFSSL_STATIC_MEMORY_SMALL)
|
||||||
#define WOLFMEM_DIST 49,10,6,14,5,6,9,1,1
|
#define WOLFMEM_DIST 49,10,6,14,5,6,9,1,1
|
||||||
#else
|
#else
|
||||||
/* Low resource and not RSA */
|
/* Low resource and not RSA */
|
||||||
|
Reference in New Issue
Block a user