Repository navigation
x86-64: BLAKE2b's init returns without secret residue - #4967
Merged
Merged
Conversation
vg_blake2b_init is followed by scrubTail (withScrub, Proof/Blake2/X86_64/Scrub.lean), as vg_blake2s_init is: it clears the registers (the analysis finds no granule of stack to wipe). Argon2's H' (Proof.Argon2.X86_64.HPrime.hash), which calls it by name, now calls its unscrubbed code as an internal function of its own, vg_blake2b_init_core. Its line leaves ci/residue_allowlist.txt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxYnEynffr2A7QLPVa
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.
vg_blake2b_initnow ends withscrubTail(withScrub,Proof/Blake2/X86_64/Scrub.lean), asvg_blake2s_initalready does. The tail only clears registers: the analysis finds no stack granule to wipe. Its line leavesci/residue_allowlist.txt.Argon2's H' (
Proof.Argon2.X86_64.HPrime.hash) calls this init by name, and the emitter refuses a function called by name whose code changes. So H' now calls the unscrubbed code as an internal function of its own,vg_blake2b_init_core, the same_corepattern as #4904 and #4951. Argon2's code changes only in that call's target.Nothing under
TCB/orSpec/changes.Benchmarks
Run 43072211343 compares the
blake2bmodule's benchmarks (BLAKE2b and Argon2) on x86-64 with 8564b91.BLAKE2b:
none: 2–5% faster at 64 B;avx,avx2,bmi1,bmi2,adx:blake2b-512/645% slower (183 → 192 ns) andblake2b-512-verify/643.3% slower.Argon2:
none: the rows are 1.7–8.6% slower, 1–2 ms on 25 ms runs.Argon2 calls this init a few times per hash, so it does about a millisecond of work against nanoseconds of change. Its generated code differs from main only in the call target's name. A change that size cannot add milliseconds, so I read the Argon2 rows as run-to-run noise in a memory-bound benchmark. I did not rerun it.
AVX-512: not measured; the runner lacked it.
Checks
All passed locally after rebasing onto main with #4951 and #4962:
lake build;Emit.leanthen--check;check_lean_public_imports.py --base origin/main;cargo fmt,cargo clippy;cargo test, and theVG_CPU_FEATURES=nonerun.Generated by Claude Code