[CHERRYPICK FIPS 5.x] Add AArch64 NEON runtime fallback for ML-KEM and ML-DSA#3358
Open
samuel40791765 wants to merge 1 commit into
Open
[CHERRYPICK FIPS 5.x] Add AArch64 NEON runtime fallback for ML-KEM and ML-DSA#3358samuel40791765 wants to merge 1 commit into
samuel40791765 wants to merge 1 commit into
Conversation
On aarch64, the ML-KEM/ML-DSA native primitives called the NEON assembly unconditionally, with no runtime path to the C reference implementation. This was fine since NEON assembly is a mandatory part of the base aarch64 architecture. However, FIPS requires us to include a way to test the C fallback implementation on relevant architectures. This adds a runtime NEON capability gate on every native entry point so that when NEON is unavailable (reachable via `OPENSSL_armcap=0`) execution falls back to the C reference path, mirroring the existing x86-64/AVX2 gate. This was implemented with the shadow-header pattern already used for x86-64 ML-DSA (`mldsa_x86_64_meta.h`). Since upstream mlkem-native does not have this, I've created two similar files `mlkem_aarch64_meta.h` / `mldsa_aarch64_meta.h` which mirror the vendored aarch64 meta.h. This allows no edits to the vendored mlkem/ or mldsa/ trees. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license. (cherry picked from commit aba09cb)
samuel40791765
temporarily deployed
to
auto-approve
July 18, 2026 02:22 — with
GitHub Actions
Inactive
samuel40791765
temporarily deployed
to
auto-approve
July 18, 2026 02:23 — with
GitHub Actions
Inactive
samuel40791765
temporarily deployed
to
auto-approve
July 18, 2026 02:23 — with
GitHub Actions
Inactive
samuel40791765
temporarily deployed
to
auto-approve
July 18, 2026 02:23 — with
GitHub Actions
Inactive
samuel40791765
temporarily deployed
to
auto-approve
July 18, 2026 02:23 — with
GitHub Actions
Inactive
samuel40791765
temporarily deployed
to
auto-approve
July 18, 2026 02:23 — with
GitHub Actions
Inactive
Contributor
|
🔒 Security Review — View Report Please review before merging. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fips-2026-06-26-snapshot #3358 +/- ##
============================================================
- Coverage 78.21% 78.17% -0.05%
============================================================
Files 693 693
Lines 123900 123900
Branches 17208 17216 +8
============================================================
- Hits 96910 96855 -55
- Misses 26072 26126 +54
- Partials 918 919 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
On aarch64, the ML-KEM/ML-DSA native primitives called the NEON assembly unconditionally, with no runtime path to the C reference implementation. This was fine since NEON assembly is a mandatory part of the base aarch64 architecture.
However, FIPS requires us to include a way to test the C fallback implementation on relevant architectures. This adds a runtime NEON capability gate on every native entry point so that when NEON is unavailable (reachable via
OPENSSL_armcap=0) execution falls back to the C reference path, mirroring the existing x86-64/AVX2 gate.This was implemented with the shadow-header pattern already used for x86-64 ML-DSA (
mldsa_x86_64_meta.h). Since upstream mlkem-native does not have this, I've created two similar filesmlkem_aarch64_meta.h/mldsa_aarch64_meta.hwhich mirror the vendored aarch64 meta.h. This allows no edits to the vendored mlkem/ or mldsa/ trees.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
(cherry picked from commit aba09cb)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.