Repository navigation
mldsa: load the ARM32 NTT zetas table PC-relative, no text relocation - #12193
kaleb-himes wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The companion generator PR returned 404, so a maintainer must verify it reproduces the assembly changes and merges before or alongside this PR to prevent regeneration from restoring absolute-address words.
No open issues 🎉
What changed in this PR
Updates wolfCrypt’s ARM32 ML-DSA assembly to address NTT zetas tables PC-relatively, removing their absolute-address relocations without changing the inline-assembly implementation.
Changes:
- Stores relative table offsets for both forward and inverse NTT routines.
- Reconstructs table addresses at runtime using the existing
ADRresult. Unrelated AES text relocations remain outside this PR.
| File | Description |
|---|---|
| wolfcrypt/src/port/arm/armv8-32-mldsa-asm.S | Replaces absolute zetas pointers with relative offsets and updates both NTT address-loading sequences. |
Review effort: Balanced
|
retest this please |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12193
Scan targets checked: wolfssl-pr-general
Review type: general (no scan target covers the changed files)
Coverage: 1 of 1 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Max
|
Pairs with: https://github.com/wolfSSL/scripts/pull/722
Description
mldsa_ntt_neonandmldsa_invntt_neoninarmv8-32-mldsa-asm.Sreach theirzetas table through a 32-bit word in
.textthat held the table's absoluteaddress. That word needs an
R_ARM_ABS32relocation at load time, so a sharedlibwolfsslbuilt with--enable-armasm --enable-mldsaon 32-bit ARM getsDT_TEXTRELfrom this object.The word now holds the table's offset from the word itself, and the code adds
that offset to the address that ADR already gives. The assembler resolves the
difference within the section, so the object has no relocation for it. The
inline-asm file (
armv8-32-mldsa-asm_c.c) does not change.The
.Sfile is generated by wolfSSL/scripts. The generator change is inwolfSSL/scripts#, which should merge with or before this PR. Otherwise the
next regeneration puts the absolute
.longback.Testing
armv7, non-FIPS,
--host=arm-linux-gnueabihf --enable-armasm --enable-mldsa --enable-mlkem --enable-shared --enable-sp=yes --enable-sp-asm, GCC 13.3.0(arm-linux-gnueabihf), run under qemu-arm 8.2.2.
readelf -ron the ML-DSA asm object shows 2R_ARM_ABS32in.rel.texton master and none on this branch.testwolfcrypt: ML-DSA and ML-KEM pass on both master and this branch.testwolfcryptreport
ML-DSA test failed!, so the test does runmldsa_invntt_neon.scripts master reproduces master's file byte for byte.
Note: the shared library still has
DT_TEXTRELon both master and this branch.All of it comes from
armv8-32-aes-asm.o, which is outside this PR.