Repository navigation
ML-DSA x86: verified prepared keys - #4393
Merged
Merged
Conversation
Member
Author
|
Compare with base (x86) is red on its 35% threshold, on
The numbers are in the description. Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWwDf2TWyuN7bZSQDiU
reaperhulk
force-pushed
the
claude/mldsa-prepared-x86
branch
from
November 7, 2026 03:49
3aacf86 to
776c6a1
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.
Verified ML-DSA prepared keys for 32-bit x86 (
crates/verified-garbage-asm-x86), following AArch64, x86-64 and RISC-V:SigningKey{44,65,87}::prepare()andVerifyingKey*::prepare()now use verified prepared functions on x86 too, rather than keeping the encoded key.No changes to
TCB/orSpec/. This is an implementation PR:Impl/+Proof/+ registrations + regenerated crate + Rust.What's new on x86
vg_mldsa{44,65,87}_prepare_signing_key/_prepare_verifying_key(Impl/MlDsa/X86/PreparedKey.lean,Proof/MlDsa/X86/PreparedKey.lean, stack 96).u32coefficients, the NTTs signing and verification compute from it:ŝ₁,ŝ₂,t̂₀for a private key;t̂₁for a public key.vg_mldsa*_sign_message_prepared/_verify_message_prepared.KeyArg: its length and precondition); the ordinary functions are the plain key's instance, byrfl.Api:vg_mldsa*_sign_core, called byvg_mldsa*_signand byvg_mldsa*_sign_prepared; a word ofscratchtells it whether to decode the key and compute the NTTs, or take them from the prepared key.vg_mldsa*_verify_core, which takest̂₁as an argument:vg_mldsa*_verifycomputes it in scratch, andvg_mldsa*_verify_preparedpasses the prepared key's.src/mldsa_common.rs:target_arch = "x86"joins each prepared-keycfg.prepares take AArch64 and RISC-V's path, with no dispatch.Backendmatches stay exhaustive: theSha3/Avx2/Avx512arms keep their owncfgs.Constant time is proven with
taint_decidethroughout. There is nosorry,native_decideormaxHeartbeats.Testing
lake build(full) andEmit.lean: onlycrates/verified-garbage-asm-x86changes.check_lean_public_imports.pyon the edited modules.cargo test, andVG_CPU_FEATURES=none cargo test --features cpu-features-env, with Wycheproof. All pass, with x86 line coverage 21573/21573 (100%).-D warnings) and fmt, for i686, x86-64 and AArch64, with each feature set.Benchmarks
https://github.com/pyca/verified-garbage/actions/runs/42331360693 measures x86 with
modules=mldsa_commonagainstmain(9ff6f96, before the rebase; the x86 code is unchanged by it).It is scoped to x86 ML-DSA because no other code changes:
mldsa_common.rscompiles to the same code.The work moves into
prepare, and the prepared operations get faster by about what it costs:prepare/verifying(base → head)verify_prepared(base → head)verify(ordinary, head)prepare/signing(base → head)sign_deterministic_prepared(base → head)sign_deterministic(ordinary, base → head)prepare/verifying: before this PR, preparing a verifying key on x86 only copied the key. It now computes thekpolynomialst̂₁. That is the run's red check: the workflow's 35% threshold, on 3 benchmarks.prepare/signing: now also computesŝ₁,ŝ₂andt̂₀._muand keygen are unchanged within noise. Randomizedsignmoves by ±5% in both directions across parameter sets; the deterministic signature does not.🤖 Generated with Claude Code
https://claude.ai/code/session_015ajQWwDf2TWyuN7bZSQDiU