Repository navigation
Regenerate asm with constant tables in read-only sections - #12274
Merged
rlm2002 merged 1 commit intoNov 26, 2026
Merged
Conversation
Regenerated from the scripts generators. Constant tables move from .data / __DATA,__data to .rodata / __TEXT,__const, so the FIPS in-core integrity HMAC covers them. Previously an altered table (e.g. the AES-GCM counters) still passed the POST. The SHA-512 AVX2/RORX transforms now compute the K-table end pointer at run time instead of storing a relocated pointer in .data.
|
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Missing FIPS integrity sources and test results leave relocated-table coverage unverified, requiring maintainer validation of ELF/Mach-O measurement boundaries and POST tamper detection.
No open issues 🎉
What changed in this PR
Regenerates wolfCrypt assembly to place constant tables in read-only sections, supporting coverage by the FIPS in-core integrity HMAC.
Changes:
- Moves x86 constants from
.datato.rodataand Apple constants from__DATA,__datato__TEXT,__const. - Replaces stored SHA-512 AVX2/RORX K-table end pointers with runtime calculations in GNU and MASM assembly.
- Adjusts SHA-512 stack allocation to hold the calculated pointers.
| File | Description |
|---|---|
| wolfcrypt/src/sp_x86_64_asm.S | Moves modular-inversion constants to read-only sections. |
| wolfcrypt/src/sha512_asm.S | Moves constants and computes K-table end pointers at runtime. |
| wolfcrypt/src/sha512_asm.asm | Computes K-table end pointers at runtime; adjusts stack allocation. |
| wolfcrypt/src/sha3_asm.S | Moves SHA-3 constants to read-only sections. |
| wolfcrypt/src/sha256_asm.S | Moves SHA-256 constants to read-only sections. |
| wolfcrypt/src/port/ppc64/ppc64-sha512-asm.S | Moves Apple SHA-512 constants to __TEXT,__const. |
| wolfcrypt/src/port/ppc64/ppc64-sha3-asm.S | Moves Apple SHA-3 constants to __TEXT,__const. |
| wolfcrypt/src/port/ppc64/ppc64-sha256-asm.S | Moves Apple SHA-256 constants to __TEXT,__const. |
| wolfcrypt/src/port/ppc64/ppc64-aes-asm.S | Moves Apple AES constants to __TEXT,__const. |
| wolfcrypt/src/port/ppc32/ppc32-sha512-asm.S | Moves Apple SHA-512 constants to __TEXT,__const. |
| wolfcrypt/src/port/ppc32/ppc32-sha3-asm.S | Moves Apple SHA-3 constants to __TEXT,__const. |
| wolfcrypt/src/port/ppc32/ppc32-sha256-asm.S | Moves Apple SHA-256 constants to __TEXT,__const. |
| wolfcrypt/src/port/ppc32/ppc32-aes-asm.S | Moves Apple AES constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/thumb2-sha512-asm.S | Moves Apple SHA-512 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/thumb2-sha3-asm.S | Moves Apple SHA-3 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/thumb2-sha256-asm.S | Moves Apple SHA-256 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/thumb2-poly1305-asm.S | Moves Apple Poly1305 clamp constant to __TEXT,__const. |
| wolfcrypt/src/port/arm/thumb2-mlkem-asm.S | Moves Apple ML-KEM tables to __TEXT,__const. |
| wolfcrypt/src/port/arm/thumb2-chacha-asm.S | Moves Apple ChaCha constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/thumb2-aes-asm.S | Moves Apple AES tables to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-sha512-asm.S | Moves Apple SHA-512 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-sha3-asm.S | Moves Apple SHA-3 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-sha256-asm.S | Moves Apple SHA-256 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-sha1-asm.S | Moves Apple SHA-1 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-poly1305-asm.S | Moves Apple Poly1305 clamp constant to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-mlkem-asm.S | Moves Apple ML-KEM tables to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-mldsa-asm.S | Moves Apple ML-DSA tables to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-frodokem-asm.S | Moves Apple SHA-3 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-curve25519.S | Moves Apple Curve25519 base constant to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-chacha-asm.S | Moves Apple ChaCha constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-aes-asm.S | Moves Apple AES tables to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-32-sha512-asm.S | Moves Apple SHA-512 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-32-sha3-asm.S | Moves Apple SHA-3 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-32-sha256-asm.S | Moves Apple SHA-256 constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-32-poly1305-asm.S | Moves Apple Poly1305 clamp constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-32-mlkem-asm.S | Moves Apple ML-KEM tables to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-32-mldsa-asm.S | Moves Apple ML-DSA tables to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-32-chacha-asm.S | Moves Apple ChaCha constants to __TEXT,__const. |
| wolfcrypt/src/port/arm/armv8-32-aes-asm.S | Moves Apple AES tables to __TEXT,__const. |
| wolfcrypt/src/poly1305_asm.S | Moves Poly1305 constants to read-only sections. |
| wolfcrypt/src/fe_x25519_asm.S | Moves field-arithmetic constants to read-only sections. |
| wolfcrypt/src/chacha_asm.S | Moves ChaCha and combined Poly1305 constants to read-only sections. |
| wolfcrypt/src/aes_xts_asm.S | Moves AES-XTS constants to read-only sections. |
| wolfcrypt/src/aes_x86_64_asm.S | Moves AES counter-mode constants to read-only sections. |
| wolfcrypt/src/aes_gcm_asm.S | Moves AES-GCM counters, masks, and constants to read-only sections. |
Review effort: Balanced
Contributor
|
Thanks @kaleb-himes! |
rlm2002
approved these changes
Nov 26, 2026
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.
Regenerated from the scripts generators. Constant tables move from .data / __DATA,__data to .rodata / __TEXT,__const, so the FIPS in-core integrity HMAC covers them. Previously an altered table (e.g. the AES-GCM counters) still passed the POST.
The SHA-512 AVX2/RORX transforms now compute the K-table end pointer at run time instead of storing a relocated pointer in .data.
Description
Please describe the scope of the fix or feature addition.
Fixes zd#
Testing
How did you test?
Checklist