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

Add faster reduction for secp256k1 pcurves #4113

Merged
merged 3 commits into from
Jul 12, 2024
Merged

Conversation

randombit
Copy link
Owner

@randombit randombit commented Jun 11, 2024

This takes advantage of the modulus being near a power of 2.

Rough idea of improvements. Seems to vary a lot between compilers and CPUs:

  • Sandybridge/GCC: ECDH and ECDSA all about 9% faster
  • Skylake/GCC: ECDH 19% faster, ECDSA sign 13% faster, ECDSA verify 17% faster

#4027

@coveralls
Copy link

Coverage Status

coverage: 91.771% (+0.005%) from 91.766%
when pulling 4cd489f on jack/faster-k1-redc
into 856174e on master.

@coveralls
Copy link

Coverage Status

coverage: 91.77% (+0.004%) from 91.766%
when pulling 8839e0a on jack/faster-k1-redc
into 856174e on master.

@randombit randombit added this to the Botan 3.5.0 milestone Jun 12, 2024
@coveralls
Copy link

Coverage Status

coverage: 91.78% (+0.01%) from 91.766%
when pulling 5815410 on jack/faster-k1-redc
into 856174e on master.

@coveralls
Copy link

Coverage Status

coverage: 91.776% (-0.006%) from 91.782%
when pulling c33c00f on jack/faster-k1-redc
into 4c3e9dc on master.

@coveralls
Copy link

Coverage Status

coverage: 91.779% (-0.003%) from 91.782%
when pulling efdbdc8 on jack/faster-k1-redc
into 4c3e9dc on master.

This takes advantage of the modulus being near a power of 2.

Performance improvement varies by CPU, compiler, and specific
algorithm in use, but generally ranges between 10% to 20%.
@coveralls
Copy link

Coverage Status

coverage: 91.727% (+0.001%) from 91.726%
when pulling ac87424 on jack/faster-k1-redc
into 7fad1d2 on master.

@randombit randombit merged commit 1af5545 into master Jul 12, 2024
39 checks passed
@randombit randombit deleted the jack/faster-k1-redc branch July 12, 2024 07:15
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