Skip to content

x86-64: BLAKE2b's init returns without secret residue - #4967

Merged
reaperhulk merged 1 commit into
mainfrom
claude/residue-core-blake2b-init
Nov 12, 2026
Merged

reaperhulk merged 1 commit into
mainfrom
claude/residue-core-blake2b-init

Conversation

@reaperhulk

Copy link
Copy Markdown
Member

vg_blake2b_init now ends with scrubTail (withScrub, Proof/Blake2/X86_64/Scrub.lean), as vg_blake2s_init already does. The tail only clears registers: the analysis finds no stack granule to wipe. Its line leaves ci/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 _core pattern as #4904 and #4951. Argon2's code changes only in that call's target.

Nothing under TCB/ or Spec/ changes.

Benchmarks

Run 43072211343 compares the blake2b module's benchmarks (BLAKE2b and Argon2) on x86-64 with 8564b91.

  • BLAKE2b:

    • default: within ±1.5%;
    • none: 2–5% faster at 64 B;
    • avx,avx2,bmi1,bmi2,adx: blake2b-512/64 5% slower (183 → 192 ns) and blake2b-512-verify/64 3.3% slower.
  • Argon2:

    • default: within ±3.6%;
    • 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:

  • full lake build;
  • Emit.lean then --check;
  • every step of the Static checks job;
  • check_lean_public_imports.py --base origin/main;
  • cargo fmt, cargo clippy;
  • cargo test, and the VG_CPU_FEATURES=none run.

Generated by Claude Code

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
@reaperhulk
reaperhulk added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 3170b02 Nov 12, 2026
38 checks passed
@reaperhulk
reaperhulk deleted the claude/residue-core-blake2b-init branch November 12, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants