Repository navigation
x86-64 hash inits, SHA-512 digest and zeroize return without secret residue - #4904
Merged
Merged
Conversation
…residue vg_md5_init, vg_sha1_init, vg_sha224_init, vg_sha256_init, the SHA-512 family's four inits, vg_sha512_digest and vg_sha512_digest_shani, and vg_zeroize and vg_zeroize_avx are scrubbed (withScrub, StreamFn.scrub). The verified code that calls them by name (HMAC, PBKDF2, DSA, RSA, Ed25519, AES-CBC/ECB and ML-KEM through the Zeroize variants) calls their unscrubbed code as internal functions of their own, vg_<name>_core, as ChaCha20-Poly1305 calls vg_poly1305_init_core. Their lines leave ci/residue_allowlist.txt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxYnEynffr2A7QLPVa
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 10, 2026
Member
Author
|
The merge queue failed this PR on Generated by Claude Code |
The IFMA CRT decryption that main added calls vg_sha256_init, which this branch renames to vg_sha256_init_core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxYnEynffr2A7QLPVa
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 10, 2026
This was referenced Nov 10, 2026
This was referenced Nov 11, 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.
Continues the x86-64 residue burn-down (#4836). It converts 12 functions to prove
NoResidue, and removes their 12 lines fromci/residue_allowlist.txt(−12/+0). No trust change: nothing underTCB/orSpec/changes.These functions passed the residue analysis already. They stayed listed only because other verified code calls them by name: scrubbing the exported function changes the code that call runs, and the emitter refuses that. As with
vg_poly1305_init_core(#4836), the callers now call the unscrubbed code under an internal_corename, and only the exported function is scrubbed.What is converted
Inits (8):
vg_md5_init,vg_sha1_init,vg_sha224_init,vg_sha256_init,vg_sha384_init,vg_sha512_init,vg_sha512_224_initandvg_sha512_256_init. Their tails clear registers only.SHA-512 digest (2):
vg_sha512_digestwipes 144 bytes (9 stores);vg_sha512_digest_shaniwipes 32 bytes (2 stores).This matches the SHA-384 digests, which are already scrubbed.
Zeroize (2):
vg_zeroizeandvg_zeroize_avx. Their tails clear registers only.New modules:
Proof/{Sha1,Sha256,Sha512}/X86_64/Scrub.leanandProof/Zeroize/X86_64Scrub.lean. The MD5 init is added toProof/Md5/X86_64/Scrub.lean, and the SHA-512 digests toProof/Variants/MdHash/X86_64/Sha512{,ShaNi}.lean.The internal
_corefunctions and their callersvg_md5_init_core,vg_sha1_init_core,vg_sha224_init_core,vg_sha256_init_core,vg_sha384_init_core,vg_sha512_init_core,vg_sha512_224_init_coreandvg_sha512_256_init_core:Proof/Pbkdf2/Md/X86_64/Hashes/*.lean);vg_sha512_init_core). Only the name string changes inImpl/Ed25519/X86_64/{SignCached,VerifyMessage}.leanand four proofs that mention it.vg_sha512_digest_core,_shani_coreand_avx2_core: Ed25519 key-pair generation (Artifacts/Ed25519/X86_64.leannames themdigest512Api.name ++ c.suffix ++ "_core").vg_zeroize_coreandvg_zeroize_avx_core: AES-CBC, AES-ECB and ML-KEM, through theZeroizevariants (Proof/Zeroize/X86_64Impl.lean).Of the 238 changed files, 26 are written by hand. The other 212 are regenerated crate files: the new
_corefunctions, and every caller's assembly andsrc, whose call names changed.What stays listed
vg_sha512_digest_avx2: the analysis fails on its code, as it does on the rest of SHA-512's AVX2 family.Checks
lake build(all modules),Emit.leanandEmit.lean --check: pass.--base origin/mainwhere it applies): pass.check_lean_public_imports.py: pass.cargo fmt --checkandcargo clippy --all-targets -- -D warnings: pass.cargo testwith Wycheproof, with every CPU feature and withVG_CPU_FEATURES=none: pass.Speed
The callers run the same code as before under new names. The exported inits, digests and zeroize add a short tail.
Benchmarks run 42797918755: x86-64,
sha512 sha256 sha1 md5against the merge base, in every configuration that chooses among their implementations. One interleaved run.sha,ssse3: 4.2% slower at 64 B (281 → 293 ns);🤖 Generated with Claude Code
https://claude.ai/code/session_015ajQWxYnEynffr2A7QLPVa