Repository navigation
ML-DSA AArch64: prepared keys for many signatures and verifications - #4375
Merged
Merged
Conversation
reaperhulk
marked this pull request as ready for review
November 6, 2026 21:28
reaperhulk
enabled stacked auto-merge
November 6, 2026 21:33
|
This pull request has conflicts with Posted by |
reaperhulk
force-pushed
the
claude/wonderful-planck-ihi993-prepared
branch
from
November 6, 2026 21:57
d2e99b5 to
6285cc9
Compare
github-merge-queue
Bot
removed this pull request from the merge queue due to invalid changes in the merge commit
Nov 6, 2026
reaperhulk
force-pushed
the
claude/wonderful-planck-ihi993-prepared
branch
2 times, most recently
from
November 6, 2026 22:31
0f1705d to
806abd0
Compare
reaperhulk
enabled stacked auto-merge
November 6, 2026 22:31
|
This pull request has conflicts with Posted by |
SigningKey{44,65,87}::prepare and VerifyingKey{44,65,87}::prepare give a
PreparedSigningKey / PreparedVerifyingKey: the key, with its polynomials
decoded and transformed once (vg_mldsa*_prepare_signing_key,
vg_mldsa*_prepare_verifying_key), for a key that signs or verifies a
stream of messages. Its sign, sign_deterministic and verify call
vg_mldsa*_sign_message_prepared and vg_mldsa*_verify_message_prepared on
AArch64, and the ordinary functions elsewhere. The prepared bytes are
inline (no allocation), immutable, and wiped on drop for a private key.
The implementation and proofs are those of #3819,
rebased onto main:
* The ordinary and prepared entries share one signing and one
verification kernel per parameter set and Keccak backend
(vg_mldsa*_sign_with_cache, vg_mldsa*_verify_with_cache), which take an
optional slice of the key's polynomials. They and the entries on mu with
a prepared key (vg_mldsa*_sign_prepared, vg_mldsa*_verify_prepared) are
internal functions now, their contracts untrusted in
Proof/MlDsa/PreparedKeyContract.lean, with polyStored_iff relating the
spec's PolyStored to PolyIs.
* Lemmas main deleted as dead code (PostB.refl, PPostB.mono,
selectedPairedSignLoop_ok/_tr, finish_rootPair) are restated in the
modules that use them, and the uses of removed names (KeyGen.prims,
Sig.u64Bufs, the verify_message call lemmas) follow main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ajQWy42drMfWKyQXeWwK8
…Regions; regenerate Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWy42drMfWKyQXeWwK8
reaperhulk
force-pushed
the
claude/wonderful-planck-ihi993-prepared
branch
from
November 6, 2026 22:39
806abd0 to
a4b74f2
Compare
This was referenced Nov 6, 2026
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.
Stacked on #4366 (the specification). This takes over #3819, with an explicit prepared-key API in place of its automatic cache.
API
PreparedSigningKey{44,65,87}andPreparedVerifyingKey{44,65,87}are for a key that signs or verifies a stream of messages.prepare(self)consumes the key;signing_key()/verifying_key()return it.vg_mldsa*_sign_message_preparedandvg_mldsa*_verify_message_prepared, with the scalar and_sha3variants chosen exhaustively byBackend. On every other architecture they call the ordinary functions, so the API is the same everywhere.Verified code (AArch64)
The implementation and proofs are #3819's, rebased onto main (417 commits newer):
Artifacts/MlDsaPreparedKey/AArch64.leanregistersvg_mldsa*_prepare_{signing,verifying}_key. The Keccak generic files register the ordinary entries andvg_mldsa*_{sign,verify}_message_prepared.vg_mldsa*_sign_with_cacheandvg_mldsa*_verify_with_cache, which take an optional slice holding the key's polynomials.μentries with a prepared key (vg_mldsa*_{sign,verify}_prepared) are internal functions (crates/verified-garbage-asm-aarch64/src/internal/). Their contracts are untrusted, inProof/MlDsa/PreparedKeyContract.lean. It also provespolyStored_iff, that the spec'sPolyStoredisPolyIs.PostB.refl,PPostB.mono,selectedPairedSignLoop_ok,selectedPairedSignLoop_tr,finish_rootPair, and three verify-call lemmas, now taken fromOptimized.CachedVerify.KeyGen.prims,Sig.u64Bufs) follow main.TCB/,Spec/orProof/Framework/changes.Performance (AArch64)
Benchmarks run, scoped to the ML-DSA sign/verify groups on
ubuntu-26.04-arm, compared against maind3d83849a. It's one short interleaved pass per side (25 samples, about 0.3 s each), so the numbers are indicative.Prepared vs ordinary on this branch, detected features (SHA3):
μmethods are within 0.4% in all three configurations (detected,sha3,none). Hedgedsignmoves ±4% either way between runs, because its randomness changes how many times the rejection loop runs.mldsa*_prepare/verifying) costs 5.1 / 7.6 / 10.2 µs, so it pays for itself after about 2.5 verifications.mldsa*_prepare/signingtimes key generation plus preparation together: 54 / 88 / 137 µs.VG_CPU_FEATURES=none, prepared operations are about 4–6% faster.Validation
Lean: every new and edited module builds, and the full
Emit.leanruns clean. Its standard-axiom, compiled-code and spec-origin audits pass, and it changes onlycrates/verified-garbage-asm-aarch64.check_lean_public_imports.py --base origin/mainpasses on the 30 edited modules. All the Static checks steps pass locally, includingcheck_variants.py,check_mcdt.pyandalgorithms_table.py --check.Rust, x86-64 native: the ML-DSA tests pass,
cargo fmtandcargo clippy --all-targets -D warningsare clean, and the benchmarks build.Rust, AArch64 cross-compiled under
qemu-aarch64 -cpu max: the ML-DSA integration tests pass with detected features (the SHA3 variants) and withVG_CPU_FEATURES=none, andcargo clippy --target aarch64-unknown-linux-gnu --all-targets -D warningsis clean.Tests use published vectors. Each Wycheproof key group is signed and verified with one prepared key, the streaming pattern:
Unit-level checks cover the accessors,
Debug, and a prepared key agreeing with its unprepared key.🤖 Generated with Claude Code
https://claude.ai/code/session_015ajQWy42drMfWKyQXeWwK8