Repository navigation
PPC64LE DSA: verify by one joint power g^u1 y^u2 (two-bit windows) - #4662
Merged
Merged
Conversation
Verification computed g^u1 mod p and y^u2 mod p by two separate bit-at-a-time exponentiations (`powSecret`: a square and a multiplication per bit), then their product. It now computes g^u1 y^u2 mod p by one joint power, as RISC-V does: a table of g^i y^j R mod p for i, j < 4 in arrays 8-23, then for each pair of bits of u1 and u2 two squares and one multiplication by the entry they select (`ModExp.select`, the four-bit windows' masked scan). That is 1.5 Montgomery multiplications per exponent bit in place of 4. The proof (`VerifyComb.lean`) follows RISC-V's, over the PPC64LE four-bit windows' working space (`Win.WCtx`, `Win.select_ok`); `combine_ok`'s statement is unchanged. No change to the TCB, the specs or the Rust code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHEf743DNZVAyToasZ6
This was referenced Nov 8, 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.
Part of #4141 (finding 7 of the PPC64LE audit). This PR changes no
Spec/orTCB/file and no Rust code outside the generated PPC64LE crate.What was slow
Impl/Dsa/PPC64LE/Verify.lean'scombinecomputedg^u1 mod pandy^u2 mod pwith two separate bit-serialModExp.powSecretcalls, each doing a square and a multiply for every bit, then multiplied the two results. That is 4 Montgomery multiplications modulo p per bit of q.What changed
combine(Impl/Dsa/PPC64LE/Verify.lean) computesg^u1 y^u2 mod pwith one joint power, the way RISC-V does (Impl/Dsa/RISCV64/Verify.lean):g^i y^j R mod pfori, j < 4in arrays 8–23 (jointTable).jointWindow), it does two squares and one multiplication by the entry those bits select. The entry is read byModExp.select, the four-bit windows' masked scan of every entry.r30and u2's throughr25, soproductsand the buffer layout are unchanged.That is 1.5 multiplications per bit, plus the selection, instead of 4. The code stays constant time (
Verify.body'staint_decideis unchanged).Proof (
Proof/Dsa/PPC64LE/VerifyComb.lean) follows RISC-V'sVerifyComb.leanover the PPC64LE four-bit windows' working space (Win.WCtx,Win.mont,Win.select_ok,Win.copy_ok). It coversjointTable_ok,jointWindow_ok,jointByte_okandjointLoop_ok, thencombine_ok.combine_ok's statement, whichVerifyBodyuses, is unchanged. The frame lemmas thatSign/Gk.leanandDerive/Y.leanuse stay in this file.powP(signing, key derivation) is unchanged; moving it topowWinis a separate PR.Numbers
Benchmarks run 42510853830: POWER9,
dsa, groupsdsa_verify_q[0-9]+ dsa_verify_cold_q[0-9]+, base =mainat a07cdef, one run of each side.dsa_verify_q160/1024dsa_verify_q160/2048dsa_verify_q224/2048dsa_verify_q256/2048dsa_verify_q256/3072dsa_verify_cold_q160/1024dsa_verify_cold_q160/2048dsa_verify_cold_q224/2048dsa_verify_cold_q256/2048dsa_verify_cold_q256/3072The cold variants still run the key import's bit-serial
g^qandy^qchecks. The next PR moves those, signing and key generation to the four-bit windows. The rest of the gap is the Montgomery multiplication itself, which the bignum workstream is working on.Checks
lake build(every module) andEmit.lean --checkpass.check_lean_public_imports.pyis OK on both changed modules.check_lean_single_importer.py --base origin/main.cargo build --release --target powerpc64le-unknown-linux-gnu --libbuilds the regenerated crate. CI's ppc64le jobs run the tests (Wycheproof and CAVP DSA verification).🤖 Generated with Claude Code
https://claude.ai/code/session_01TKUFHEf743DNZVAyToasZ6