Repository navigation
Align remaining heap Aes/XtsAes allocations - #12180
Open
danielinux wants to merge 1 commit into
Open
danielinux wants to merge 1 commit into
danielinux wants to merge 1 commit into
Conversation
PR 12110 aligned heap Aes allocations via WC_ALLOC_AES, but several consumers still allocate Aes (and XtsAes) with plain XMALLOC, which only guarantees 8-byte alignment on 32-bit Arm. The NEON/asm AES paths issue 16-byte-aligned loads, so a misaligned context faults at runtime whenever the heap happens to place it 8-byte aligned (layout-dependent SIGBUS seen in the arm32 MC/DC lane's PKCS7 KAT). Convert the remaining heap allocation sites to WC_ALLOC_AES/WC_FREE_AES and add WC_ALLOC_XTS/WC_FREE_XTS for XtsAes contexts: - wolfcrypt/src/pkcs7.c: PKCS7 EncryptContent/DecryptContent Aes - src/keys.c: TLS cipher enc/dec Aes (freed in FreeCiphersSide) - src/internal.c: TicketEncDec Aes + FreeCiphersSide free - src/dtls13.c: DTLS 1.3 record-number Aes cipher - wolfcrypt/src/kdf.c: SRTP/SRTCP KDF Aes contexts - wolfcrypt/test/test.c: test Aes/XtsAes contexts SMALL_STACK stack-array paths keep their dual-mode frees; heap frees are guarded to match the heap allocations.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#12110 aligned heap Aes allocations via WC_ALLOC_AES, but several consumers still allocate Aes (and XtsAes) with plain XMALLOC, which only guarantees 8-byte alignment on 32-bit Arm. The NEON/asm AES paths issue 16-byte-aligned loads, so a misaligned context faults at runtime whenever the heap happens to place it 8-byte aligned (layout-dependent SIGBUS seen in the arm32 MC/DC lane's PKCS7 KAT).
Convert the remaining heap allocation sites to WC_ALLOC_AES/WC_FREE_AES and add WC_ALLOC_XTS/WC_FREE_XTS for XtsAes contexts:
SMALL_STACK stack-array paths keep their dual-mode frees; heap frees are guarded to match the heap allocations.