From 8d9db0d68c31869478a9d53cea313a34822eae1b Mon Sep 17 00:00:00 2001 From: Jack Tjaden Date: Tue, 4 Jun 2024 14:49:47 -0600 Subject: [PATCH 1/2] updated Static buffer allocation section --- wolfSSL/src/CTX_structure.png | Bin 0 -> 18296 bytes wolfSSL/src/chapter04.md | 42 ++++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 wolfSSL/src/CTX_structure.png diff --git a/wolfSSL/src/CTX_structure.png b/wolfSSL/src/CTX_structure.png new file mode 100644 index 0000000000000000000000000000000000000000..704ee98644a9a45926c143122d87eac14921f289 GIT binary patch literal 18296 zcmbuncRbep|2KR{B_t~;vkqj1vob1fz!2m}J1stQSmK%np= z5VjC@Y{74KMJiU{f0S-Ys=7ON?D#sM^@BjzPf#VD(Di;i-EV8WTmS3!S>G?)PHZDF zI0g#zuvq;PDX_TPAIipl>0@KhnW)UU!=>iGs@d7?@<}&o($abuNu==bPT52G`M*Nu zFDA9>ka`loxUMSu2*J$p*M=PXlcDcarBIv<-R9>41PG4rfnY(~)eqZru_y zs~P_GFgBKtDQs3>BeEBjDk@#^Vm_jip)ymE;vzRntXERV29I!U0Y;644SoA}4vx|p^ z$CWEhZEXjM1qObb8|%28pr9c9_xrWgoU>0(OG`_KJOAn}`Pr5zJK}oP)6?^NjsNuY zbOcA`T@R6*3q_+Vi$8yTtNz(jz{8khR(ox3upSp4(=u}5!Uep?<^BqfuFg)~Rc1mU zu}S@HskG;mLGvS)KMi%b%X&%g^%V)m>VVB8Uv(!ZQO5PZW68mP4#uj5jd$l5P1#($ zc#tv2v^wGIeo@gop??1U5yA~!UD3YHb*JWT{{H` zD#fy_0tg|42S*Z%&ti4!#mKXf|x-c9H4HGFA%L=3N} z^D>1!dh|6>)~g|sUBAtlj=*Uh#PKlTB`(~}y>q^_=>E5a0pCD6F^S2cS(EiG+*@SQt%ro5>L zAJrn2W%#UEA8p^cS9{na!@lcj5-AeEBkF!%|08l9W@Qfa~=4fX)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F}{<8j1w zXpO@1$$wN;Q?sP=pE-39r)r#mkPScs34TAej~^Bn#{okNd?|#t4q|+4eXkN%RP$<& z6OvzM4|FOk{QC#^7~MZattR;KYOR-JISYOZHspW8n0d!`tdoKuufn^jFm&$x`3L#2 zI{>j>G0&)7H86Pi-=A>e0L|up-SYJnYVv3xR8GXUO>7U|LH;@U--s9-?5IbNgxy7M zkVo|yY`E;Ggajc+zAfP4vmxv?!s6op9UyusZF@z@4Wa{+;MP zNMJB@kdFe&`8J5)yCgcMqrNiA5N_bQ@BPe|Sy3imcKITgvcszXvYIZYz%ZdGe`up!eg5$hItHe~eH< zU46X`VpnRkA$05qRSr+yY^P}751gu|j*tLyGR`N$&oaC7QrZOpZ&=3PFHWCrKa8o%mY9cq0T}4y|6G`#9LAqwJXs4TeWW)GFRxtF&Brx0nsm? zSMqZGP{CXQL%Dl-m6eo;*dQy8obpFQCTHN{S7iuZU|*uj*Ecp6b%>}59zI+E{yr&u zo0~jrsu`W=%rG%wgEqWM#?WMDo&F~SHuuLBIAPk63EDVQnHoYt=kj{J7{T( z3JL~Hzg2pDzyU#*9FR)}55YHAGH`K^O)36!iv7hV<)2&pKMP}~0`OHj1l3cTq+BKQ G8~+Ofc;Wg0 literal 0 HcmV?d00001 diff --git a/wolfSSL/src/chapter04.md b/wolfSSL/src/chapter04.md index e35a6ee9..986274f5 100644 --- a/wolfSSL/src/chapter04.md +++ b/wolfSSL/src/chapter04.md @@ -551,7 +551,10 @@ By default, wolfSSL assumes that the execution environment provides dynamic memo Using static-buffer-allocation is equivalent in API to using dynamic memory with wolfSSL. This functional equivalency is achieved in wolfSSL by abstracting memory allocation/free into XMALLOC/XFREE function calls. Once static-buffer-allocation is set, wolfSSL will use it from then on to allocate buffers and other structures used internally. Since this feature is set for WOLFSSL_CTX, it will continue to work for the lifetime of the context object. -The static-buffer-allocation set in a WOLFSSL_CTX is thread-safe. Even if the same WOLFSSL_CTX is shared by different threads, buffer allocation/free is used under exclusive control inside wolfSSL. +The static-buffer-allocation set in a WOLFSSL_CTX is thread-safe. Even if the same WOLFSSL_CTX is shared by different threads, buffer allocation/free is used under exclusive control inside wolfSSL. The following is a visual representation of the CTX structure, the arrows indicate passing a pointer to the heap and "..." references all structs and not to the ones listed. + +![Alt text](CTX_structure.png) + In comparison to a memory pool functionality offered by an RTOS implementation, memory functionality in an RTOS will commonly suspend a thread (task) if an unused memory block cannot be found when requested until a free block becomes available. wolfSSL’s static memory functionality has no such synchronization capability. ### Specifying Static Buffer Use @@ -582,6 +585,36 @@ user_settings.h #define WOLFSSL_NO_MALLOC ``` +In addition there are two build configurations. `--enable-staticmemory=small` which is a +smaller version that has smaller struct sizes and less supporting API's available. The other build +configuration is `--enable-staticmemory=debug` that enables the ability to set a callback function. This is +useful in cases where printf() is not available for determining what is being allocated and what +bucket sizes are being used. Here is what the example client output looks like with example +callback: + +``` +./examples/client/client +... +... +... +Free'ing : 16128 +OUT BUFFER: Alloc'd 6 bytes using bucket size 16992 +Alloc'd 848 bytes using bucket size 1024 +OUT BUFFER: Alloc'd 150 bytes using bucket size 16992 +Alloc'd 13 bytes using bucket size 64 +Alloc'd 12 bytes using bucket size 64 +Alloc'd 848 bytes using bucket size 1024 +IN BUFFER: Alloc'd 40 bytes using bucket size 16992 +Alloc'd 13 bytes using bucket size 64 +Alloc'd 12 bytes using bucket size 64 +Free'ing : 1024 +Free'ing : 512 + +... +... +... +``` + ### Using Static Buffer Allocation This can be helpful for environments without dynamic memory support, or safety-critical applications where dynamic memory use is disallowed. @@ -727,9 +760,10 @@ For DTLS server |API|description| |:---|:---| -|`wolfSSL_CTX_load_static_memory`|Set buffer for WOLFSSL_CTX as a heap memory. -|`wolfSSL_CTX_is_static_memory`|Returns whether "Static buffer Allocation" is used. If it is the case, gets usage report. -|`wolfSSL_is_static_memory`|Returns whether "Static buffer Allocation" is used. If it is the case, gets usage report. | +|[`wolfSSL_CTX_load_static_memory`](group__Memory.md#function-wolfSSL_CTX_static_memory)| Set buffer for WOLFSSL_CTX as a heap memory. | +|[`wolfSSL_CTX_is_static_memory`](group__Memory.md#function-wolfSSL_CTX_is_static_memory)| Returns whether "Static buffer Allocation" is used. If it is the case, gets usage report. | +|[`wolfSSL_is_static_memory`](group__Memory.md#function-wolfSSL_is_static_memory)| Returns whether "Static buffer Allocation" is used. If it is the case, gets usage report. | +|[`wc_LoadStaticMemory`](group__Memory.md#function-wc_LoadStaticMemory)| Used to set aside static memory for wolfCrypt use. | |[`wolfSSL_StaticBufferSz`](group__Memory.md#function-wolfssl_staticbuffersz)| Calculate required buffer size for "Static buffer Allocation" based on the macros defined in /wolfssl/wolfcrypt/memory.h. | From 217c92e3ffb69b86801d133c302548b7e1bb6114 Mon Sep 17 00:00:00 2001 From: Jack Tjaden Date: Wed, 5 Jun 2024 10:31:56 -0600 Subject: [PATCH 2/2] Fixed Static memory feature fallback --- wolfSSL/src/chapter04.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfSSL/src/chapter04.md b/wolfSSL/src/chapter04.md index 986274f5..10205d62 100644 --- a/wolfSSL/src/chapter04.md +++ b/wolfSSL/src/chapter04.md @@ -576,7 +576,7 @@ user_settings.h   #define WOLFSSL_STATIC_MEMORY ``` -The static-buffer-allocation option is implemented by default to additionally call the standard function malloc() without returning NULL when the memory block allocated from the given buffer is exhausted. If the environment does not provide dynamic memory management functionality, a link error will occur. Therefore, also define the **WOLFSSL_NO_MALLOC** macro to disable this feature if needed: +The static-buffer-allocation option is implemented by default to fall back to the standard malloc() function when a NULL heap hint is passed in. If a heap hint is passed in and the memory associated with it is exhausted, an error will occur. If the environment does not provide dynamic memory management functionality, a link error will occur. Therefore, also define the **WOLFSSL_NO_MALLOC** macro to disable this feature if needed: ``` user_settings.h