Skip to content

k256: fast invert_vartime using Stein's algorithm#743

Merged
tarcieri merged 2 commits into
masterfrom
k256/invert-vartime
Feb 5, 2023
Merged

k256: fast invert_vartime using Stein's algorithm#743
tarcieri merged 2 commits into
masterfrom
k256/invert-vartime

Conversation

@tarcieri

@tarcieri tarcieri commented Feb 4, 2023

Copy link
Copy Markdown
Member

Adapts the implementation originally contributed to the p256 crate by @nickray to the k256 crate.

Implementation is checked against the constant-time Scalar::invert using proptests (where Scalar::invert is in turn proptested against num-bigint).

It results in a ~9% ECDSA verification performance improvement according to our criterion benchmarks:

ecdsa/verify_prehashed  time:   [67.681 µs 67.734 µs 67.796 µs]
                        change: [-9.4013% -9.2055% -9.0011%] (p = 0.00 < 0.05)
                        Performance has improved.

Adapts the implementation originally contributed to the `p256` crate by
@nickray to the `k256` crate.

Implementation is checked against the constant-time `Scalar::invert`
using proptests (where `Scalar::invert` is in turn proptested against
`num-bigint`).

It results in a ~9% ECDSA verification performance improvement according
to our criterion benchmarks:

ecdsa/verify_prehashed  time:   [67.681 µs 67.734 µs 67.796 µs]
                        change: [-9.4013% -9.2055% -9.0011%] (p = 0.00 < 0.05)
                        Performance has improved.
@tarcieri tarcieri requested review from fjarri and nickray February 4, 2023 01:51
@nickray

nickray commented Feb 5, 2023

Copy link
Copy Markdown
Member

Nice! LGTM

@tarcieri tarcieri merged commit 61f347d into master Feb 5, 2023
@tarcieri tarcieri deleted the k256/invert-vartime branch February 5, 2023 18:12
@tarcieri tarcieri mentioned this pull request Mar 3, 2023
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.

2 participants