Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pre-computation to speed-up Secp256r1 verification #595

Merged
merged 39 commits into from
May 31, 2023
Merged

Conversation

jonas-lj
Copy link
Contributor

@jonas-lj jonas-lj commented May 24, 2023

Fixes #588 and #573 (because the construction is similar to the one used by openssl, but with modification required for pure Rust)

This PR made to speed up signature verification in Secp256r1 (gives about ~50% speed-up), but it is implemented for generic groups, so it may also be used for other constructions, eg Ristretto (#589) so it's also relevant for #590. It uses a sliding window method (which is variable time) for verification and fixed window (which is constant time) for signing.

The BGMW algorithm is not used for ecdsa, but is faster for single scalar multiplications at the cost of larger precomputation tables. It has been added under the experimental feature flag.

@jonas-lj jonas-lj force-pushed the jonas/precompute branch from 7103488 to 0d66c5a Compare May 24, 2023 11:41
fastcrypto/src/groups/mod.rs Outdated Show resolved Hide resolved
fastcrypto/src/groups/secp256r1.rs Outdated Show resolved Hide resolved
fastcrypto/src/groups/secp256r1.rs Outdated Show resolved Hide resolved
fastcrypto/src/groups/multiplier/fixed_window.rs Outdated Show resolved Hide resolved
@jonas-lj jonas-lj requested a review from benr-ml May 26, 2023 09:00
fastcrypto/src/groups/mod.rs Outdated Show resolved Hide resolved
fastcrypto/src/groups/multiplier/comb_method.rs Outdated Show resolved Hide resolved
fastcrypto/src/groups/multiplier/integer_utils.rs Outdated Show resolved Hide resolved
fastcrypto/src/groups/secp256r1.rs Outdated Show resolved Hide resolved
@jonas-lj jonas-lj requested a review from kchalkias May 30, 2023 11:51
@jonas-lj jonas-lj requested a review from kchalkias May 31, 2023 10:26
Copy link
Collaborator

@kchalkias kchalkias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work!

@jonas-lj jonas-lj merged commit ed1c2e1 into main May 31, 2023
@jonas-lj jonas-lj deleted the jonas/precompute branch May 31, 2023 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants