Repository navigation
x86-64 secp256k1 and brainpool public-key functions and ECDH return without secret residue - #4900
Merged
Merged
Conversation
Return without secret residue (`X86_64.RScrub.withScrub`) from the x86-64
`vg_ec_<curve>_{public_key,compress_public_key,decompress_public_key,
validate_public_key}` for secp256k1, brainpoolP256r1, brainpoolP384r1 and
brainpoolP512r1, and from every `vg_ecdh_<curve>` (P-192, P-224, P-256,
P-384, P-521, secp256k1 and the three Brainpool curves, with the `_adx`
variants of P-256, P-384 and P-521): 28 functions leave
ci/residue_allowlist.txt. The residue analysis finds nothing to wipe in any
of them.
`exchangeOut` (`Proof/EcKey/X86_64/Scrub/Out.lean`) proves, for every
curve, that ECDH's postcondition reads the memory on return only within
`out`. As before, each scrubbed registration is in the module that proves
its code, taking the curve's law as an argument, so the registration files
only bind.
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.
Stacked on #4899, whose shared
PostOutproofs (Proof/EcKey/X86_64/Scrub/Out.lean) this PR uses. Its base is that PR's branch; it is meant to be retargeted tomainonce #4899 merges. It takes 28 more lines offci/residue_allowlist.txt. No trust change: nothing underTCB/orSpec/changes, and no Lean module is added.What is converted
public_key,compress_public_key,decompress_public_keyandvalidate_public_keyfor secp256k1, brainpoolP256r1, brainpoolP384r1 and brainpoolP512r1.vg_ecdh_{p192,p224,p256,p384,p521,secp256k1,brainpoolp256r1,brainpoolp384r1,brainpoolp512r1}, and the_adxvariants of P-256, P-384 and P-521.For each of them the residue analysis finds nothing on the stack to wipe, so the scrub only clears registers.
How
As in #4899:
scrubKs,scrubOk,scrubReg) is in the module that proves its code:Proof/EcKey/{Compressed,Validate}/X86_64/<C>.lean;Proof/EcKey/X86_64/<C>/Verified.lean;Proof/Ecdh/X86_64/<C>/Verified.lean;VerifiedAdx.leanfiles, for the_adxvariants (scrubRegAdx).Out.leangainsexchangeOut, for ECDH's postcondition.Checks
lake build(all modules),Emit.lean --check, the Static checks job,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 42779179146: x86-64, against #4899's branch, one interleaved run, with every CPU feature and with
none.🤖 Generated with Claude Code
https://claude.ai/code/session_015ajQWxYnEynffr2A7QLPVa