Repository navigation
PPC64LE ECDSA: verification's inverses by the sliding windows of #4762 - #4782
Merged
Merged
Conversation
vg_ecdsa_<curve>_verify on PPC64LE takes s^(n-2) and Z^(p-2) by invN and invP, the chains of n - 2 and p - 2 that signing uses since #4762, in place of the bit-by-bit power: about 1.2 multiplications per bit instead of two. mid_ok and vtail_ok take them by chainPow_ok; the table the chain writes, the nine slots from DX, holds nothing the verification reads after either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHHNk9SreF92JBY2H8M
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 the PPC64LE audit, #4141 (ECDSA verification), following #4762 and #4770.
vg_ecdsa_<curve>_verifyon PPC64LE takes its two inverses by the chains signing has used since #4762, for all nine curves:s^(n-2): byinvN.Z^(p-2): byinvP.These are the sliding windows of
n − 2andp − 2(Impl/Weierstrass/PPC64LE/Chain.lean), about 1.2 multiplications per bit instead of the bit-by-bit power's two. The chain's table is the nine slots fromDX. At both points the verification reads nothing there afterwards:uvonly needsEM',D,K,RM'andACC, and the final stepR,RM'andACC.Proofs
Scalars.lean,mid_ok:chainPow_okwithchainNin place ofpow_ok.chainWN_eq, andmidWnow names the table's slots.Final.lean,vtail_ok:chainPow_okwithchainP, likewise.Main.lean: the composition's statement,rfl, names the new steps.The bit tables of
p − 2andn − 2are still written at setup but no longer read. Removing them is left to a follow-up.No TCB, Spec or registration changes.
Generated crate. Only PPC64LE changes: the nine
ecdsa_<curve>verifications.Testing
cargo test --target powerpc64le-unknown-linux-gnu --release ecdsapasses for all nine curves (Wycheproof, CAVP, RFC 7027).lake build(all modules) andEmit.leanpass on this tree, which ismainplus this commit.check_lean_public_imports.pypass.cargo fmt --checkandclippy -D warningspass.Benchmarks
Run 42538020637:
arches=powerpc64, the nine curves' verify groups, base7cfde1c4(main). Two inversions are a small part of a verification, and every curve is 2–6% faster.ecdsa_p192_sha256_verifyecdsa_p224_sha224_verifyecdsa_p256_sha256_verifyecdsa_p384_sha384_verifyecdsa_p521_sha512_verifyecdsa_secp256k1_sha256_verifyecdsa_brainpoolp256r1_sha256_verifyecdsa_brainpoolp384r1_sha384_verifyecdsa_brainpoolp512r1_sha512_verifyThe 64- and 16384-byte sizes show the same changes, but one cell: P-192's base at 64 bytes measured 691.68 µs, an outlier against the 392 µs of its other sizes, so that row's 45% is not real.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TKUFHHNk9SreF92JBY2H8M