Skip to content

primeorder: mul_by_generator_and_mul_add_vartime method for PrimeCurveParams#1759

Merged
tarcieri merged 1 commit into
masterfrom
primeorder/vartime-basepoint-lincomb-support
May 7, 2026
Merged

primeorder: mul_by_generator_and_mul_add_vartime method for PrimeCurveParams#1759
tarcieri merged 1 commit into
masterfrom
primeorder/vartime-basepoint-lincomb-support

Conversation

@tarcieri
Copy link
Copy Markdown
Member

@tarcieri tarcieri commented May 7, 2026

Adds a trait method that can be overridden to plug in variable-time linear combinations using precomputed wNAF for the basepoint which otherwise uses lincomb_vartime by default.

When used in p256 in combination with RustCrypto/traits#2405 which added BasepointTableVartime::lincomb, this results in a 25% speedup for ECDSA verification:

ECDSA/P-256 (SHA-256)/verify
    time:   [146.21 µs 147.14 µs 148.38 µs]
    change: [−25.356% −24.522% −23.756%] (p = 0.00 < 0.05)
    Performance has improved.

Adds a trait method that can be overridden to plug in variable-time
linear combinations using precomputed wNAF for the basepoint which
otherwise uses `lincomb_vartime` by default.

When used in `p256` in combination with RustCrypto/traits#2405 which
added `BasepointTableVartime::lincomb`, this results in a 25% speedup
for ECDSA verification:

    ECDSA/P-256 (SHA-256)/verify
        time:   [146.21 µs 147.14 µs 148.38 µs]
        change: [−25.356% −24.522% −23.756%] (p = 0.00 < 0.05)
        Performance has improved.

Also applies the optimization to `p384`, `p521`, and `sm2`.
@tarcieri tarcieri force-pushed the primeorder/vartime-basepoint-lincomb-support branch from a415ae8 to 29b2897 Compare May 7, 2026 03:49
@tarcieri tarcieri changed the title primeorder: PrimeCurveParams::mul_by_generator_and_mul_add_vartime primeorder: mul_by_generator_and_mul_add_vartime method for PrimeCurveParams May 7, 2026
@tarcieri tarcieri merged commit 557cf79 into master May 7, 2026
159 checks passed
@tarcieri tarcieri deleted the primeorder/vartime-basepoint-lincomb-support branch May 7, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant