Skip to content

brainpoolP512r1 x86-64: verify with [u]G by the signature's comb - #4418

Merged
alex merged 1 commit into
mainfrom
claude/perf-4141-brainpool-verify-512
Nov 7, 2026
Merged

alex merged 1 commit into
mainfrom
claude/perf-4141-brainpool-verify-512

Conversation

@alex

@alex alex commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Part of #4141 (findings: #4141 (comment), "Brainpool ECDSA": brainpoolP512r1 verification 2.3× OpenSSL). It applies #4414's generic Cfg.verifyG/verifyG_ok (merged) to brainpoolP512r1, with #4413's signing comb (merged), as #4433 did for brainpoolP384r1.

What was slow, and why

Verification computed [u]G and [v]Q with two calls of vg_brainpoolp512r1_mul, a bit-by-bit ladder of complete additions over 512 bits. One call takes ~2.1 ms, so verification took 4.1 ms.

What changed

  • verifyBrainpoolP512r1 := Cfg.verifyG brainpoolp512r1S brainpoolp512r1Comb. [u]G comes from the signature's comb (VG_BRAINPOOLP512R1_COMB, 74 additions); [v]Q keeps the ladder.
  • The contract (Proof/Ecdsa/Verify/X86_64/BrainpoolP512r1/Contract.lean) declares the comb's tables (Abi.withConsts brainpoolp512r1S.combConsts: 75776 words), as brainpoolP256r1 x86-64: verify with [u]G by the signature's comb #4414 does for brainpoolP256r1.
  • Verified.lean follows brainpoolP256r1's: verifyG_ok with brainpoolp512r1S_ok, brainpoolp512r1S_comb and Proof.BrainpoolP512r1.combOk7. Constant time is proved by taint tracking with the table's symbol public.

No change to TCB/ or Spec/. No new variant, and no Rust source changed: only the generated ecdsa_brainpoolp512r1 files.

Numbers

Local, Intel(R) Xeon(R) Processor @ 2.10GHz, cargo bench, all features:

benchmark before this PR OpenSSL
ecdsa_brainpoolp512r1_sha512_verify_prehashed/64 4.12 ms 2.21 ms 1.73–1.78 ms
ecdsa_brainpoolp512r1_sha512_verify/16384 — 2.31 ms 1.82 ms

Benchmarks workflow (x86_64, ecdsa_brainpoolp512r1 verify groups, with OpenSSL; it measured this commit before the rebase onto main, which changes no brainpoolP512r1 verification code): https://github.com/pyca/verified-garbage/actions/runs/42360068848

The remaining gap to OpenSSL is the ladder for [v]Q. Closing it needs a public-scalar method for any a (a Jacobian doubling for any a in x86-64's joint framework), which is a separate change.

Checks

lake build (all modules), Emit.lean, every Static checks step, check_lean_public_imports.py on the edited modules, and cargo test --release of the brainpool tests with Wycheproof all pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TKUFHEXYPYjjPyLdLUmbW1

@github-actions github-actions Bot added the untrusted-only This changes exclusively implementations and proofs, and thus is entirely formally verified. label Nov 7, 2026
@alex
alex force-pushed the claude/perf-4141-brainpool-verify branch from 19d9427 to b00bbb7 Compare November 7, 2026 10:20
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

This pull request has conflicts with claude/perf-4141-brainpool-verify, found after 5edcc5b landed on main: rebase it to resolve them. Before rebasing, see CLAUDE.md on checking how much Lean main changed, and on restacking a stacked pull request.

Posted by .github/workflows/conflicts.yml, once per push to a conflicting pull request.

Base automatically changed from claude/perf-4141-brainpool-verify to main November 7, 2026 10:39
@github-actions github-actions Bot removed the untrusted-only This changes exclusively implementations and proofs, and thus is entirely formally verified. label Nov 7, 2026
@alex
alex force-pushed the claude/perf-4141-brainpool-verify-512 branch from 8be00f9 to b288487 Compare November 7, 2026 11:10
As brainpoolP256r1's: Cfg.verifyG with the signature's comb for any a
(VG_BRAINPOOLP512R1_COMB, 74 additions) for [u]G instead of a 512-bit
ladder, the ladder kept for [v]Q; the contract declares the comb's
tables.

No change to TCB/ or Spec/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHEXYPYjjPyLdLUmbW1
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

This pull request has conflicts with main, found after f82e82c landed on main: rebase it to resolve them. Before rebasing, see CLAUDE.md on checking how much Lean main changed, and on restacking a stacked pull request.

Posted by .github/workflows/conflicts.yml, once per push to a conflicting pull request.

@alex
alex force-pushed the claude/perf-4141-brainpool-verify-512 branch from b288487 to f23aaf3 Compare November 7, 2026 11:11
@github-actions github-actions Bot added the untrusted-only This changes exclusively implementations and proofs, and thus is entirely formally verified. label Nov 7, 2026
@alex
alex enabled auto-merge November 7, 2026 11:13
@alex
alex added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit e953e6f Nov 7, 2026
36 of 51 checks passed
@alex
alex deleted the claude/perf-4141-brainpool-verify-512 branch November 7, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

untrusted-only This changes exclusively implementations and proofs, and thus is entirely formally verified.

Development

Successfully merging this pull request may close these issues.

2 participants