Repository navigation
PPC64LE P-256: public keys by the signed seven-bit comb - #4729
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHJ728Kwktcff5BR2sx
This was referenced Nov 8, 2026
This was referenced Nov 8, 2026
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.
Replaces #4675. It's the same change, rebased linearly onto
main(cd0c332) instead of havingmainmerged in, because this PR is the base of a stack.Part of #4141 (PPC64LE audit, finding 1):
vg_ec_p256_public_keycomputed[d]Gby the Montgomery ladder, one double, add and select per bit (862 µs on POWER9, 57× OpenSSL).What changes
[d]Gnow uses the fixed-base signed comb the other targets share (Impl/P256/CombTable7.lean): 37 windows of seven bits. Each window's entry is selected from a read-only table by scanning all 64 entries under the mask of the digit's magnitude, so timing stays constant. The sign is applied by the field's subtraction, and each window costs one call of the complete addition.The comb is 32-bit ARM's (
Impl/Weierstrass/Arm/TComb.lean, which PPC64LE's ladder layout was ported from), adapted to PPC64LE:Impl/Weierstrass/PPC64LE/TComb.lean: the comb, for any curve whose coordinates fit the point functions' slots (3 to 6 words). P-224 and P-384 can reuse it.Proof/Weierstrass/PPC64LE/TComb.lean:comb_ok, which provesR = [k]Gfrom the table and the scalar's table of bits (the scan, the digits, the sign, the addition, the loop).Proof/P256/PPC64LE/Comb.lean: P-256's configuration, and the comb as the generator of the stages that follow the setup.Proof/EcKey/PPC64LE/P256Comb.lean: the public key with the table as a constant (Abi.withConsts), its constant time (taint_decidewithtaintSym), andVerified.The signing and public-key stages now accept any generator that meets
GeneratorPost(ladPowWith_ok,stage₂With,publicKeyWith_ok), as on ARM. These changes are proof-only, and the ladder's proofs go through them. The ladder-based P-256 public key and its literal are deleted.Signing still uses the ladder, because PPC64LE's RFC 6979 wrapper does not yet accept a core with its own table. That is the next PR.
No TCB or Spec change.
Testing
lake buildandEmit.leanpass on this tree. The only crate change iscrates/verified-garbage-asm-powerpc64le(ec_p256, the newconsts/vg_p256_comb.rs, andvg_p256_mulmoving to the module of its first caller).check_lean_public_imports.pypass.Benchmark
Benchmarks run 42512986586, scoped to
arches=powerpc64,modules=ec_p256,groups=ec_p256_public_key, with base 24da64c:ec_p256_public_key/65Generated by Claude Code