-
Notifications
You must be signed in to change notification settings - Fork 1k
Fixes for static memory builds with WOLFSSL_NO_MALLOC #11432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1529,6 +1529,11 @@ static WC_MAYBE_UNUSED Aes* test_AesGcmNew(void* heap, int declaredDevId, | |
| #else | ||
| static byte gTestMemory[576*1024]; /* ML-DSA full mem */ | ||
| #endif | ||
| #elif defined(WOLFSSL_NO_MALLOC) && defined(OPENSSL_EXTRA) && \ | ||
| !defined(BENCH_EMBEDDED) | ||
| /* No malloc, so the compatibility layer's NULL-heap allocations come | ||
| * out of this pool as well, not the system heap. */ | ||
| static byte gTestMemory[1024*1024]; | ||
| #elif defined(BENCH_EMBEDDED) | ||
| static byte gTestMemory[14000]; | ||
| #elif defined(WOLFSSL_CERT_EXT) | ||
|
|
@@ -2354,7 +2359,7 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\ | |
| printf("unable to load static memory.\n"); | ||
| EXIT_TEST(EXIT_FAILURE); | ||
| } | ||
| #ifndef OPENSSL_EXTRA | ||
| #if !defined(OPENSSL_EXTRA) || defined(WOLFSSL_NO_MALLOC) | ||
| wolfSSL_SetGlobalHeapHint(HEAP_HINT); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test permanently clobbers a caller's global heap hint · Race conditions in setup/teardown The new branch overwrites any caller-installed global heap hint and Suggested fix: Install |
||
| #endif | ||
| #endif | ||
|
|
@@ -29695,6 +29700,15 @@ static wc_test_ret_t cert_no_malloc_test(void) | |
| ret = WC_TEST_RET_ENC_NC; | ||
| } | ||
| } | ||
| #else | ||
| /* With an allocator the RSA key is copied out, so a Signer built from this | ||
| * cert keeps a public key of its own. */ | ||
| if ((ret == 0) && ((cert.pubKeyStored != 1) || | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RSA copy-out assertion rejects no-CM-verify builds · Logic errors
Suggested fix: Gate the copy-out assertion with the same |
||
| (((wc_ptr_t)cert.publicKey >= (wc_ptr_t)cert.source) && | ||
| ((wc_ptr_t)cert.publicKey < | ||
| (wc_ptr_t)cert.source + cert.maxIdx)))) { | ||
| ret = WC_TEST_RET_ENC_NC; | ||
| } | ||
| #endif | ||
| FreeDecodedCert(&cert); | ||
| #endif | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ML-DSA builds bypass the enlarged static test pool · Logic errors
WOLFSSL_HAVE_MLDSAis tested before the new no-malloc/OpenSSL arm, so that supported combination still receives only 192 or 576 KiB. This preserves the static-pool exhaustion the new 1 MiB arm addresses.Suggested fix: Select the 1 MiB pool before the ML-DSA arm whenever
WOLFSSL_NO_MALLOC && OPENSSL_EXTRA && !BENCH_EMBEDDEDholds.