lowmem: Unpack z lazily in verification#1025
Draft
mkannwischer wants to merge 1 commit intomainfrom
Draft
Conversation
d7de92e to
0f60231
Compare
Contributor
CBMC Results (ML-DSA-44)
Full Results (203 proofs)
|
Contributor
CBMC Results (ML-DSA-65)Full Results (203 proofs)
|
Contributor
CBMC Results (ML-DSA-87)
Full Results (203 proofs)
|
0f60231 to
947662d
Compare
770cd6a to
2e91517
Compare
Contributor
CBMC Results (ML-DSA-65, REDUCE-RAM)Full Results (203 proofs)
|
Contributor
CBMC Results (ML-DSA-44, REDUCE-RAM)
Full Results (203 proofs)
|
Contributor
CBMC Results (ML-DSA-87, REDUCE-RAM)
Full Results (203 proofs)
|
90b809b to
3797d11
Compare
Introduce mld_zvec (eager / lazy, dispatched by MLD_CONFIG_REDUCE_RAM):
- mld_zvec_init: eager unpacks the full polyvecl, runs the polyvecl-wide
norm check, and NTTs in place; lazy stores a pointer.
- mld_zvec_get_poly: eager copies one poly from the precomputed vector;
lazy unpacks one poly, norm-checks it, and NTTs into the caller's buf.
The norm check moves out of mld_sign_verify_internal into the accessors.
Add a fused mld_polyvec_matrix_pointwise_montgomery_zvec helper used by
verify: eager is a thin wrapper around the standard matrix-vector multiply
(z is already NTT'd); lazy streams z via mld_zvec_get_poly_lazy and
samples the matrix column-by-column.
In REDUCE_RAM mode this avoids holding the full unpacked polyvecl z,
reducing verify allocation by 2-5 KiB per parameter set.
Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
3797d11 to
926bbe1
Compare
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.
Introduce mld_zvec following the lazy polyvec pattern (eager / lazy
variants with #define dispatch on MLD_CONFIG_REDUCE_RAM):
polyvecl-wide infinity-norm bound check, and NTTs in place. In lazy
mode it just stores a pointer to the packed signature bytes.
the precomputed vector. In lazy mode unpacks one polynomial,
performs the per-poly infinity-norm bound check, and NTTs into
the caller-provided buffer.
The norm check thus moves out of mld_sign_verify_internal into the
zvec init / get_poly accessors, so the verify body no longer has to
sequence chknorm explicitly.
Add a fused matrix-vector helper
mld_polyvec_matrix_pointwise_montgomery_zvec used by verify:
mld_polyvec_matrix_pointwise_montgomery_eager (z is already NTT'd
by mld_zvec_init).
the matrix on-the-fly column-by-column,
accumulating A[*,l] * z[l] into w.
In REDUCE_RAM mode this avoids holding the full unpacked polyvecl z
in memory at once, reducing verify allocation by 2-5 KiB per parameter
set.