Conversation
This branch has not been deployed
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.
Unoptimized ML-DSA-87 key construction can overflow a 512 KiB thread stack because the complete expanded matrix is assembled and moved before an enclosing key is heap-allocated.
Use a private
NttMatrixin ML-DSA backed byArray<MaybeBox<NttVector<L>>, K>. Each sampled or cloned row reaches its allocation before the next row is assembled; multiplication delegates to the existing lattice vector dot product. Withoutalloc, the rows remain inline. There is no new unsafe code or dependency change, and the implementation uses the releasedmodule-lattice0.2.3.Existing public types, tuple fields, constructor signatures, and const constructors in
module-latticeare unchanged. ML-DSA's public signatures are also unchanged. This supersedes RustCrypto/KEMs#382 by keeping the allocation policy inside ML-DSA's private matrix storage.Add regressions for construction, cloning, verification-key decoding, signing, and verification for all three parameter sets on 512 KiB workers. Keys cross a thread boundary before signing, and a modified message is rejected. CI runs the regression with optimization explicitly disabled. Vectors and other intermediate values still use stack space; 512 KiB is the tested configuration, not a portable maximum or a promise of 128 KiB construction.
Validation:
72ebaa1; all three parameter sets pass with this change, including on Rust 1.85.no_stdchecks pass with and withoutalloc; Rust 1.85 all-feature library check passes.-D warningspass. Clippy reports the existing workspace's removedfrom_iter_instead_of_collectlint.