ML-DSA x86_64: import full assembly backend from mldsa-native#3357
Draft
jakemas wants to merge 3 commits into
Draft
ML-DSA x86_64: import full assembly backend from mldsa-native#3357jakemas wants to merge 3 commits into
jakemas wants to merge 3 commits into
Conversation
Prepares AWS-LC to import the complete mldsa-native x86_64 assembly backend, matching the aarch64 backend. The upstream x86_64 backend is now 100% assembly (no AVX2 C intrinsics), so: - importer.sh: copy the whole native/x86_64 tree verbatim (as for aarch64) and drop the obsolete BCM C-intrinsic include stripping. - mldsa_native_backend.h: include the imported upstream mldsa/native/x86_64/meta.h and remove the hand-maintained mldsa_x86_64_meta.h. - mldsa_native_config.h: track the MLD_SYS_CAP_AVX2 -> MLD_SYS_CAP_X86_64_AVX2 rename. - ml_dsa.c: migrate the sign/verify call sites to the updated mldsa-native API (the sig_len output/input parameter was removed; signatures are fixed size, so the wrappers set *sig_len themselves).
Result of running importer.sh against mldsa-native
1dbd70f78583fab6fbfc46287702d6a09d5ec5e6. Imports the complete x86_64
assembly backend: adds verified .S implementations for poly_chknorm,
poly_decompose_{32,88}, poly_use_hint_{32,88}, polyz_unpack_{17,19},
rej_uniform, and rej_uniform_eta{2,4} (previously AVX2 C intrinsics,
excluded from import), plus the upstream meta.h and rej_uniform_table.c.
The remainder is the corresponding mldsa-native C-source refresh.
Generated by importer.sh; do not edit by hand.
Contributor
|
🔒 Security Review — View Report Please review before merging. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3357 +/- ##
==========================================
+ Coverage 78.19% 78.44% +0.24%
==========================================
Files 695 696 +1
Lines 124086 124178 +92
Branches 17233 17261 +28
==========================================
+ Hits 97031 97410 +379
+ Misses 26134 25845 -289
- Partials 921 923 +2 ☔ 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.
import mldsa-native v1, including x86 backend additions
Description of changes
Imports the complete mldsa-native x86_64 assembly backend, bringing in the six ML-DSA operations that were previously AVX2 C intrinsics and excluded from the import (#3195):
rej_uniform,rej_uniform_eta2/eta4,poly_decompose_32/88,poly_use_hint_32/88,poly_chknorm, andpolyz_unpack_17/19. Each of these assembly routines has a verified functional-correctness and memory-safety proof in s2n-bignum, which is the bar for importing assembly here.The upstream x86_64 backend is now 100% assembly (no AVX2 C intrinsics remain), so this brings x86_64 in line with the aarch64 backend (#3219): the importer copies the whole backend tree verbatim and uses the upstream
meta.hdirectly, and the hand-maintainedmldsa_x86_64_meta.his removed.This is a full mldsa-native re-import (pin bumped to
1dbd70f7), so the diff also includes the corresponding C-source refresh. One upstream API change is worth calling out for review:mld_sign_signature/mld_sign_verifyfamily dropped thesig_lenparameter (signatures are fixed size). AWS-LC'sml_dsa.cglue is migrated accordingly: the inner calls drop the argument, and the signature wrappers set*sig_len = MLDSA{44,65,87}_SIGNATURE_BYTESthemselves. The public AWS-LC wrapper prototypes are unchanged.Commit 1 is the hand-authored change (importer script + glue); commit 2 is the mechanical output of running
importer.sh.Testing
All 79 ML-DSA tests pass (
crypto_test --gtest_filter='*MLDSA*') on x86_64 with AVX2.nmconfirms the native dispatchers call the new assembly (the symbols are undefined references from the BCM object, not fallbacks).Benchmarked with
bssl speed -filter MLDSAon x86_64 (AVX2), before (6 ops still C vs. after (full assembly), ops/sec: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.