Repository navigation
x86-64 Blowfish and IDEA return without secret residue - #4892
Merged
Merged
Conversation
Key expansion (and IDEA's key inversion) and the ECB, CBC, CFB64 and OFB functions of both ciphers on x86-64 are followed by the residue scrub (`X86_64.Scrub.withScrub`), with their postconditions shown to read the memory on return only within the buffers (`PostOut`), in `Proof/Blowfish/X86_64/Scrub.lean` and `Proof/Idea/X86_64/Scrub.lean`. The registration files bind them, and the 22 functions leave `ci/residue_allowlist.txt`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWxYnEynffr2A7QLPVa
This was referenced Nov 10, 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.
A residue burn-down, following #4836 and #4842. It converts every x86-64 Blowfish and IDEA function, taking 22 lines off
ci/residue_allowlist.txt. No trust change: nothing underTCB/orSpec/changes.What is converted
expand_key;ecb_encryptandecb_decrypt;cbc_encrypt_chainedandcbc_decrypt_chained;cfb64_encrypt,cfb64_decryptand their_finalforms;ofbandofb_final.expand_keyandinvert_key;ecb;cbc_encrypt_chainedandcbc_decrypt_chained;cfb64_encrypt,cfb64_decryptand their_finalforms;ofbandofb_final.Each function is scrubbed with
X86_64.Scrub.withScrub, as #4842 did for MD5 and SM3. Its code is followed byscrubTail, which clears what the residue analysis finds may hold secrets. The kernel checks that analysis (taint_decide), and the registration's ownstackis used for it.Proofs
Proof/Blowfish/X86_64/Scrub.leanandProof/Idea/X86_64/Scrub.lean(new): onePostOutproof per contract, viapostOut_of_local. Each says the postcondition reads memory on return only within the buffers: the blocks, the chaining value and, for key expansion, the schedule (scheduleAt_congr).Artifacts/{Blowfish,BlowfishCbc,BlowfishCfb,BlowfishOfb,Idea,IdeaCbc,IdeaCfb,IdeaOfb}/X86_64.lean) now only bind the scrubbed registrations. Imports they no longer need are dropped.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 42761432349: x86-64,
blowfish ideaagainstmain, one interleaved run. The scrub is a fixed cost per call, and it does not show:🤖 Generated with Claude Code
https://claude.ai/code/session_015ajQWxYnEynffr2A7QLPVa