Hi khalesiakram,
Your issue is the static memory feature `WOLFSSL_STATIC_MEMORY`. This is an advanced feature that replaces the XMALLOC heap calls with a static pool. This requires additional configuration to support properly.
See documentation for this feature here:
https://docs.google.com/document/d/1nST … sp=sharing
Example for setting it up with TLS here:
https://github.com/wolfSSL/wolfssl/blob … nt.c#L2053
Code example:
byte memory[80000];
byte memoryIO[34500]; /* max for IO buffer (TLS packet can be 16k) */
WOLFSSL_HEAP_HINT *heap = NULL;
if (wc_LoadStaticMemory(&heap, memory, sizeof(memory), WOLFMEM_GENERAL, 1)
!= 0) {
err_sys("unable to load static memory");
}
ctx = wolfSSL_CTX_new_ex(method(heap), heap);
if (ctx == NULL)
err_sys("unable to get ctx");
if (wolfSSL_CTX_load_static_memory(&ctx, NULL, memoryIO, sizeof(memoryIO),
WOLFMEM_IO_POOL_FIXED | WOLFMEM_TRACK_STATS, 1) != WOLFSSL_SUCCESS) {
err_sys("unable to load static memory");
}
You can configure the memory buckets using something like this:
#define WOLFSSL_STATIC_MEMORY
#define WOLFMEM_BUCKETS 64,256,384,432,512,1632,3456,16128
#define WOLFMEM_DIST 12,6,5,3,4,2,1,1
#define LARGEST_MEM_BUCKET 16128
Thanks,
David Garske, wolfSSL