Skip to content

RISC-V: specialize public RSA squaring - #4500

Merged
reaperhulk merged 1 commit into
mainfrom
perf/riscv-rsa-public-square
Nov 7, 2026
Merged

reaperhulk merged 1 commit into
mainfrom
perf/riscv-rsa-public-square

Conversation

@reaperhulk

@reaperhulk reaperhulk commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Public RSA exponentiation currently squares the running power with the general Montgomery multiplier. Reuse the verified Montgomery squaring kernel, using the R-squared array as scratch after conversion of the input.

The proofs account for that scratch array and establish the same operation contract and constant-time guarantee. The helper is regenerated from Lean; no specification, ISA, API, stack-size, or workspace-size changes are needed.

Native RISC-V PKCS#1 verification (benchmark run), comparing da38ca4f448b with 85a4ddeb333c. Each value is the fastest Criterion median of three interleaved runs per revision:

RSA size Base This PR Time reduction
2048 124.94 µs 102.65 µs 17.8%
3072 273.90 µs 219.86 µs 19.7%
4096 481.02 µs 384.85 µs 20.0%

Validation: full lake build (28,600 jobs), complete RISC-V target emitter audits and byte-for-byte check, import checks, and every repository static check passed. Native RISC-V PR tests and full CI emitter validation also passed.

@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
@reaperhulk
reaperhulk added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 9f8067a Nov 7, 2026
24 checks passed
@reaperhulk
reaperhulk deleted the perf/riscv-rsa-public-square branch November 7, 2026 18:18
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.

1 participant