Repository navigation
ChaCha20-Poly1305: open zeroes the data on a wrong tag, in verified code - #4347
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEMqEdVZRt8M1hMXb1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEMqEdVZRt8M1hMXb1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEMqEdVZRt8M1hMXb1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEMqEdVZRt8M1hMXb1
# Conflicts: # README.md # lean/VerifiedGarbage/Impl/ChaCha20Poly1305/AArch64/Stitched.lean # lean/VerifiedGarbage/Proof/ChaCha20Poly1305/AArch64/Correct.lean
|
CI is failing |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEMqEdVZRt8M1hMXb1
|
Generated by Claude Code |
|
The merge-queue run (https://github.com/pyca/verified-garbage/actions/runs/42280340668) failed on one job only. Generated by Claude Code |
Part of #4139 (finding 7: ChaCha20-Poly1305: zeroing on a bad tag is Rust's)
Implements
openZeroApi(spec merged in #4312) for every target and variant. On a wrong tag,vg_chacha20_poly1305_opennow zeroeslenbytes atdataitself. It leaks only whether the tag was right (openLeak). The Rustdata.fill(0)indecrypt_in_placeis deleted, and so is the "ChaCha20-Poly1305 decryption" entry under "What is not verified" in the README.What changed
openbranches on the result and runs a byte loop that zeroes the data (zeroData). This is the only new code on the success path: a compare and a branch the taint analysis checks against the leak.openTail, inProof/ChaCha20Poly1305/X86_64/OpenTail.lean.x22/x23, so at the tail no register holdsdataandlen.opentherefore saves them after the context (saveData,ctx[1280, 1296)). Its frame grows from 1280 to 1296 bytes, and its scratch contract from 160 to 162 words.RegionModel.verified_narrowTo.seal, the gather variant andctxRare unchanged.lenand stores atdata. Correctness shows these are the values the code loaded, which are public.StackArgScratchWipe), AArch64, RISC-V, PPC64LE and ARMv7 now take a contractleak. Every other caller passes none.openScratchContract/openPost_local/openPost_out, and AArch64's unusedopenWith/«open»/openStitched.No change to
TCB/orSpec/. The oldSpec.ChaCha20Poly1305.openApi/openContract/openPostare now unused, and I'll remove them in a follow-up PR of their own, since that is aSpec/change.Checks
lake buildandEmit.lean. Only the sixchacha20poly1305crate files change.lean-importsjob.check_lean_public_imports.pyon the edited modules.cargo fmt --checkandcargo clippy --all-targets -- -D warnings.cargo testwith Wycheproof on x86-64, andVG_CPU_FEATURES=nonefor the ChaCha20-Poly1305 tests.round_trip, Wycheproof, RFC 8439 forgery) check thatdatais zeroed on a wrong tag, so they now test the verified code.Benchmarks, scoped to
chacha20poly1305on every architecture against the base: https://github.com/pyca/verified-garbage/actions/runs/42266494176Generated by Claude Code