elliptic-curve: add vartime BatchInvert/BatchNormalize methods#2468
Merged
Conversation
Adds the following: - `BatchInvert::batch_invert_in_place_vartime` - `BatchNormalize::batch_normalize_vartime` Both are provided methods that currently call the constant-time path, but in the future we can potentially provide default implementations that are variable-time and optimized. Since the new methods are provided, this isn't a breaking change.
tarcieri
added a commit
to RustCrypto/elliptic-curves
that referenced
this pull request
Jun 25, 2026
Adds support for variable-time batch inversions, a method for which was added in RustCrypto/traits#2468 Benchmarks showing it's ~20% faster than the constant-time version, and ammortized ~2X faster than the single element inversion when inverting two elements field element operations/invert time: [2.5369 µs 2.5453 µs 2.5557 µs] field element operations/invert_vartime time: [2.0041 µs 2.0076 µs 2.0111 µs] field element operations/batch_invert_in_place (2p) time: [2.6878 µs 2.6929 µs 2.6980 µs] field element operations/batch_invert_in_place_vartime (2p) time: [2.1331 µs 2.1379 µs 2.1426 µs]
tarcieri
added a commit
to RustCrypto/elliptic-curves
that referenced
this pull request
Jun 25, 2026
Adds support for variable-time batch inversions, a method for which was added in RustCrypto/traits#2468 Benchmarks showing it's ~20% faster than the constant-time version, and ammortized ~2X faster than the single element inversion when inverting two elements field element operations/invert time: [2.5369 µs 2.5453 µs 2.5557 µs] field element operations/invert_vartime time: [2.0041 µs 2.0076 µs 2.0111 µs] field element operations/batch_invert_in_place (2p) time: [2.6878 µs 2.6929 µs 2.6980 µs] field element operations/batch_invert_in_place_vartime (2p) time: [2.1331 µs 2.1379 µs 2.1426 µs]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the following:
BatchInvert::batch_invert_in_place_vartimeBatchNormalize::batch_normalize_vartimeBoth are provided methods that currently call the constant-time path, but in the future we can potentially provide default implementations that are variable-time and optimized.
Since the new methods are provided, this isn't a breaking change.