Skip to content

Don't declare WC_ALLOC_DO_ON_FAILURE by default#9905

Merged
dgarske merged 1 commit into
wolfSSL:masterfrom
julek-wolfssl:WC_ALLOC_DO_ON_FAILURE-cleanup
Mar 24, 2026
Merged

Don't declare WC_ALLOC_DO_ON_FAILURE by default#9905
dgarske merged 1 commit into
wolfSSL:masterfrom
julek-wolfssl:WC_ALLOC_DO_ON_FAILURE-cleanup

Conversation

@julek-wolfssl

Copy link
Copy Markdown
Member

No description provided.

@julek-wolfssl julek-wolfssl self-assigned this Mar 6, 2026
Copilot AI review requested due to automatic review settings March 6, 2026 09:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates allocation-failure handling by removing the default WC_ALLOC_DO_ON_FAILURE definition from the core header and making tests explicitly define (or avoid relying on) that behavior.

Changes:

  • Removed the default WC_ALLOC_DO_ON_FAILURE() definition from wolfssl/wolfcrypt/types.h.
  • Added explicit WC_ALLOC_DO_ON_FAILURE() definitions in select test files.
  • Updated Chacha API test to use WC_ALLOC_VAR_EX/WC_FREE_VAR_EX with explicit failure/cleanup handling.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
wolfssl/wolfcrypt/types.h Removes default allocation-failure hook macro from a public header.
wolfcrypt/test/test.c Adds a local WC_ALLOC_DO_ON_FAILURE() definition for tests.
tests/api/test_rsa.c Defines WC_ALLOC_DO_ON_FAILURE() for RSA API tests.
tests/api/test_aes.c Defines WC_ALLOC_DO_ON_FAILURE() for AES API tests.
tests/api/test_chacha.c Switches to _EX alloc/free macros and adds a cleanup path on allocation failure.
Comments suppressed due to low confidence (1)

wolfcrypt/test/test.c:1

  • WC_ALLOC_DO_ON_FAILURE() is defined mid-file (and apparently inside a function body). With the default removed from types.h, any WC_ALLOC_VAR usages earlier in this translation unit will no longer see this macro and may fail to compile. Define this at file scope near the top of the file (or in a shared test header included before any uses) so it consistently applies to the entire compilation unit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/api/test_rsa.c
Comment thread tests/api/test_aes.c
Comment thread tests/api/test_chacha.c
Comment thread tests/api/test_chacha.c
@dgarske

dgarske commented Mar 19, 2026

Copy link
Copy Markdown
Member

Jenkins retest this please. History lost

@dgarske

dgarske commented Mar 20, 2026

Copy link
Copy Markdown
Member

Jenkins retest this please - history lost. It seems the failure was on FIPS test

@dgarske dgarske merged commit c64fd4f into wolfSSL:master Mar 24, 2026
455 of 456 checks passed
@julek-wolfssl julek-wolfssl deleted the WC_ALLOC_DO_ON_FAILURE-cleanup branch May 12, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Not For This Release Not for release 5.9.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants