Repository navigation
x86-64 NIST-curve public-key functions and P-192 verify return without secret residue - #4899
Merged
Merged
Conversation
Return without secret residue (`X86_64.RScrub.withScrub`) from the x86-64
`vg_ec_<curve>_{compress,decompress,validate}_public_key` (and their `_adx`
variants) for P-192, P-224, P-256, P-384 and P-521, `vg_ec_p192_public_key`
and `vg_ecdsa_p192_verify`: 26 functions leave ci/residue_allowlist.txt.
The postconditions' locality is proven once per contract shape, for every
curve (`Proof/EcKey/X86_64/Scrub/Out.lean`). Each scrubbed registration is
in the module that proves its code (the residue analysis next to the code's
literal), taking the curve's law as an argument, so that the registration
files only bind and no new module imports the curves' heavy algebra
(`check_lean_speed.py`'s importer limit).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ajQWxYnEynffr2A7QLPVa
alex
pushed a commit
that referenced
this pull request
Nov 10, 2026
…work's scrubAllCode and its proof move from Proof/Framework/X86_64/Scrub.lean to their one user, Proof/Pbkdf2/Md/X86_64/ScrubStream.lean, so that this change leaves Scrub.lean as main has it. Every function that is scrubbed imports that module, the EC key and ECDH functions of #4899 and #4900 among them, whose proofs CI's Lean shard rebuilt together, twice ending with the runner's shutdown. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHFEUkKJRQvsEBN9oBp
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.
A residue burn-down, following #4892. It takes 26 lines off
ci/residue_allowlist.txt. No trust change: nothing underTCB/orSpec/changes.What is converted
_adxvariant.vg_ec_p192_public_key.vg_ecdsa_p192_verify. Its analysis wipes 6 granules of its 96-byte frame.Every other function here has nothing on the stack to wipe; its scrub only clears registers.
How
Proof/EcKey/X86_64/Scrub/Out.lean(new): onePostOutproof per contract shape, generic over the curve:publicKeyOut,compressOut,decompressOut,validateOutandverifyHashOut.scrubKs,scrubOk,scrubReg) is in the module that proves its code, next to that code's literal (for exampleProof/EcKey/Compressed/X86_64/P256.lean).Divstep/Weierstrass, whichci/check_lean_speed.pylimits; one of them is already at its limit.(Proof.EcKey.Compressed.X86_64.P256.scrubReg hasLaw.inv true).What stays listed, and why
vg_ec_{p224,p256,p384,p521}_public_key, and_adxfor P-256, P-384 and P-521. They read tables of constants (Abi.withConsts), which the residue analysis does not model yet.Checks
lake build(all modules),Emit.lean --check, the Static checks job (includingcheck_lean_speed.py),check_lean_public_imports.pyon the changed modules: pass.cargo fmt --check,cargo clippy --all-targets -- -D warnings: pass.cargo testwith Wycheproof, with every CPU feature and withVG_CPU_FEATURES=none: pass.Speed
Benchmarks run 42776698050: x86-64, the P-192 to P-521 public-key, validate and ECDSA verify groups, with every CPU feature and with
none, againstmain, one interleaved run.ecdsa_p192_sha256_verify, the one function here that wipes stack: 1.3% faster at 64 B, 0.2% slower at 16 KiB.🤖 Generated with Claude Code
https://claude.ai/code/session_015ajQWxYnEynffr2A7QLPVa