Repository navigation
PPC64LE GHASH: two blocks per reduction with H² below sixteen blocks - #4742
Merged
Merged
Conversation
…and after the eight-block loop Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHE3csexSeALfzJpHUJ
…r itself Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHE3csexSeALfzJpHUJ
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.
Part of #4141, the small-message gap in AES-GCM on PPC64LE.
Below sixteen blocks,
vg_ghashon PPC64LE hashed one block per multiply and reduction, each depending on the last. In a 239-byte TLS record that is about 15 such steps, each roughly 36 cycles of latency.Now it hashes two blocks per iteration,
(Y ⊕ X₁)·H² + X₂·H, with one reduction (pairBody):pairsIf 2 paired), after computing H² (preparePowers 2) and the packed H², H (packKeyStep 3);pairsIf 1 pairLoop), since that loop already leaves the packed H², H.The last block, if the count is odd, still goes through the single-block loop. The pair loop writes no accumulator register, so H stays where it is. The eight-block path is unchanged.
vg_ghashis internal and shared: AES-GCM, AES-GCM-SIV and SM4-GCM on PPC64LE call it. Their code is unchanged except for the regeneratedvg_ghash.Proofs
Proof/Gcm/PPC64LE/Vpmsum/Fold.lean:pairKeys_ok, andpairBody_ok, whose result ishashField (x·φ H) Y _ 2. Both reusepackedRead_ok,packedProducts_okandreduce_ok.Proof/Gcm/PPC64LE/Vpmsum/Ghash.lean:pair_step_ok,pairLoop_ok,paired_okandpairsIf_ok;bulk_oknow also keeps the packed H², H;correct, over the new structure.ghash_ctis stilltaint_decide.No TCB or Spec change, and no Rust change.
Testing
lake buildand the fullEmit.leanpass.ci.ymlpass, as doescheck_lean_public_imports.pyon the edited modules.powerpc64le-unknown-linux-gnuunder qemu, the tests filtered bygcm,sivandsm4pass, including Wycheproof.Benchmark
First commit (pairs from two blocks): https://github.com/pyca/verified-garbage/actions/runs/42525152473 (powerpc64, against the merge-base; fastest of 8 copies):
Every other row is within ±2%; nothing at 1 KiB and above changes.
Every other row is within ±3%, and nothing at 1 KiB and above moves more than 0.3%.
https://claude.ai/code/session_01TKUFHE3csexSeALfzJpHUJ
Generated by Claude Code