Repository navigation
AES-GCM x86-64: the out-of-place AVX-512 encryption batches are the in-place ones - #4415
Merged
Merged
Conversation
reaperhulk
enabled stacked auto-merge
November 7, 2026 09:42
github-merge-queue
Bot
removed this pull request from the merge queue due to invalid changes in the merge commit
Nov 7, 2026
…n-place ones Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ajQWvqXkQxFyWZxghqxBG
reaperhulk
force-pushed
the
claude/gcm-enc-z-shared
branch
from
November 7, 2026 10:08
d9fa773 to
4771d58
Compare
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.
Stacked on pyca/verified-garbage#4409 (review only the commit after it). This is the 512-bit counterpart of pyca/verified-garbage#4391. Both out-of-place AVX-512 encryption loops had their own copy of the batch:
StitchZTo(keys loaded each round), withxorDataZTo.StitchZHTo(cached keys).Their proofs were also copies (
StitchZTo/Base.lean's XOR lemmas, andbatchTo_okinStitchZTo/Aes.leanandCached/AesTo.lean). They now use their in-place loops' batches and the proofs of those.Code.
StitchZ.xorDataZM(moved fromStitchZH) takes the load modeld. It reads atStitch.srcK ld, which isrdx + r8out of place, asStitch.xorDataKMdoes.StitchZ.batchandStitchZH.batchtakeixandld(both defaultfalse).StitchZTo.batchToandStitchZHTo.batchToare those batches withld.StitchZTo.xorDataZTois gone.The emitted code is unchanged (
Emit.lean --check).StitchZ.batchemits exactly the instructionsVaesZ.xorDataZdid.Proofs.
StitchZ/Aes.lean:xor1ZM_okandxorDataZM_ok(moved fromCached/Aes.lean) take the load mode.batchM_okis the generic batch of the uncached loops, with the code's modesstandldandrdxatStitch.wp ld, as AES-GCM x86-64: the out-of-place VAES encryption batch is the in-place one #4391's 256-bitbatchM_ok.batch_okis its in-place case.AInvMdropsr8, whose sign depends on the mode. The distance is a hypothesis of the batches and a field of the decryption invariants (DInvM.r8,DInv3M.r8).Cached/Aes.lean: the cachedbatchM_oktakesstandldlikewise.Cached/Keep.lean'sbatch_keepstakes both modes.StitchZTo/Aes.leanandCached/AesTo.lean:batchTo_okis the generic batch withld, throughAInvTo.toMandAInvM.toTo. Its statement is unchanged, so the out-of-place loop proofs above it are unchanged.StitchZTo/Base.lean:xor1ZTo_okandxorDataZTo_okare removed.AInvM.r8(Cached/Loop.lean,Cached/Loop48.lean,StitchZ/Loop48.leanandCached/DecFrom.lean) take it from the invariants instead.Net, the proofs lose 187 lines. What remains duplicated is the out-of-place AVX-512 encryption loops' bodies (
StitchZTo/Loop.lean,Loop48.lean,Cached/LoopTo.lean,Loop48To.lean), which #4409 did for the 256-bit loop.Trust. No
Spec/orTCB/changes, and no change to the emitted code, so there are no Rust, test or benchmark changes.Generated by Claude Code