Skip to content

WOLFSSL_SS_* small stack macro compress#9130

Closed
effbiae wants to merge 1 commit intowolfSSL:masterfrom
effbiae:small-stack
Closed

WOLFSSL_SS_* small stack macro compress#9130
effbiae wants to merge 1 commit intowolfSSL:masterfrom
effbiae:small-stack

Conversation

@effbiae
Copy link
Copy Markdown
Contributor

@effbiae effbiae commented Aug 25, 2025

Description

There are many lines of small stack conditional compiles (#ifdef WOLFSSL_SMALL_STACK) that can be compressed to fewer lines using the macros introduced in this PR.

I've compressed src/ssl_load.c by hand resulting in a net 100 line deletion in the code base. I hope to automate some of the rest of the work which I can do in stages, if that suits.

I considered calling the macros WOLFSSL_SMALL_STACK_*, but the names became quite long.

Testing

./configure --enable-all && make check && \
./configure --enable-all CFLAGS=-DWOLFSSL_SMALL_STACK && make check && \
./configure --enable-all CFLAGS="-DWOLFSSL_SMALL_STACK -DWOLFSSL_CHECK_MEM_ZERO" && make check

@wolfSSL-Bot
Copy link
Copy Markdown

Can one of the admins verify this patch?

@effbiae
Copy link
Copy Markdown
Contributor Author

effbiae commented Aug 27, 2025

i don't think these failures are related to the PR:

  • regarding the Espressif latest docker build error, i think the compiler might think thread_local is a keyword (it's a keyword in C++ since C++11)
  • and the socat failure disappeared when i turned on the socat workflow on my github repo

Copy link
Copy Markdown
Member

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually have a pattern for this all ready. See wolfssl/wolfcrypt/types.h WC_DECLARE_VAR, WC_ALLOC_VAR, WC_FREE_VAR and WC_DECLARE_ARRAY, WC_ALLOC_ARRAY, WC_FREE_ARRAY
You are welcome to refactor these to use the existing helpers. However there are many places we do this small stack pattern, so I am also fine if you want to close this PR.

@effbiae
Copy link
Copy Markdown
Contributor Author

effbiae commented Sep 1, 2025

superseded by #9153

@effbiae effbiae closed this Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants