Repository navigation
GCM: 48 prepared powers on 256-bit registers (vg_aes_gcm_prepare_vpclmul) - #4518
Merged
Merged
Conversation
…mul) Prepare16.prepare runs prepare16's plan, squares H'^8 to H'^16 in both lanes, and multiplies the eight pairs the registers hold by it twice, storing pairs 8-15 and 16-23: vg_aes_gcm_prepare for CPUs with VPCLMULQDQ and AVX2 but not AVX-512. The plan's proof is generalized over the number of pairs stored; the new function is proven against prepareContract, and constant time by taint_decide. The generated crates follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHHDjuK1puxAcLZKKff
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHHDjuK1puxAcLZKKff
alex
marked this pull request as ready for review
November 7, 2026 19:01
alex
pushed a commit
that referenced
this pull request
Nov 7, 2026
Resolve the conflicts with #4518 by keeping both registrations and both constant-time theorems, and regenerate the x86-64 crate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHHDjuK1puxAcLZKKff
This was referenced Nov 7, 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.
Implementation PR (Impl + Proof + registration + regenerated crate). No
TCB/orSpec/change.Part of moving AES-GCM onto one key layout per target, so that the generated dispatchers make the only choice. On x86-64 every backend will take the 1 KiB prepared context, which
vg_aes_gcm_preparewrites. Today only the AVX-512 code (_vpclmul_avx512) has aprepare. This adds one for CPUs with VPCLMULQDQ and AVX2 but not AVX-512.Impl/Gcm/X86_64/Prepare16.lean:preparerunsprepare16's plan (pairs 0–7), squaresH'⁸toH'¹⁶in both lanes, and multiplies the eight pairs the registers hold by it twice, storing pairs 8–15, then 16–23. That is 17 more 256-bit steps thanprepare16, each multiplication of a round independent of the others.Proof/Gcm/X86_64/Prepare16.lean: the plan's checker (valid) and invariant (Inv) now take the number of pairs stored (8 forprepare16, 24 forprepare).prepare_okgivesPrepare.PrepOk, andPrepare.verified_ofgivesprepareContract.Proof/Gcm/X86_64/PrepareCT.lean:prepare_ct, bytaint_decide.Artifacts/Gcm/X86_64.lean:vg_aes_gcm_prepare_vpclmul, with the features ofprepare16_vpclmul.No Rust calls the new function yet. The Rust change that does (the GCM dispatch rework) will come with a Benchmarks run of key setup. The coordinating session agreed to measure it there rather than add a temporary call here.
Checks: the module builds,
Emit.leanregenerates the crates with no diff, everyStatic checksstep andcheck_lean_public_imports.pypass, and so doescargo clippy --all-targets -- -D warnings.Generated by Claude Code