Skip to content

Commit d676b98

Browse files
authored
elliptic-curve: use crypto_bigint::Invert trait (#1839)
Replaces `elliptic_curve::ops::Invert` which has an identical shape
1 parent ddee7f8 commit d676b98

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

elliptic-curve/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ and public/secret keys composed thereof.
1818

1919
[dependencies]
2020
base16ct = "0.2"
21-
crypto-bigint = { version = "=0.7.0-pre.1", default-features = false, features = ["rand_core", "hybrid-array", "zeroize"] }
21+
crypto-bigint = { version = "=0.7.0-pre.2", default-features = false, features = ["rand_core", "hybrid-array", "zeroize"] }
2222
hybrid-array = { version = "0.3", default-features = false, features = ["zeroize"] }
2323
rand_core = { version = "0.9.0", default-features = false }
2424
subtle = { version = "2.6", default-features = false }

elliptic-curve/src/ops.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,14 @@
11
//! Traits for arithmetic operations on elliptic curve field elements.
22
33
pub use core::ops::{Add, AddAssign, Mul, Neg, Shr, ShrAssign, Sub, SubAssign};
4+
pub use crypto_bigint::Invert;
45

56
use crypto_bigint::Integer;
67
use subtle::{Choice, ConditionallySelectable, CtOption};
78

89
#[cfg(feature = "alloc")]
910
use alloc::vec::Vec;
1011

11-
/// Perform an inversion on a field element (i.e. base field element or scalar)
12-
pub trait Invert {
13-
/// Field element type
14-
type Output;
15-
16-
/// Invert a field element.
17-
fn invert(&self) -> Self::Output;
18-
19-
/// Invert a field element in variable time.
20-
///
21-
/// ⚠️ WARNING!
22-
///
23-
/// This method should not be used with secret values, as its variable-time
24-
/// operation can potentially leak secrets through sidechannels.
25-
fn invert_vartime(&self) -> Self::Output {
26-
// Fall back on constant-time implementation by default.
27-
self.invert()
28-
}
29-
}
30-
3112
/// Perform a batched inversion on a sequence of field elements (i.e. base field elements or scalars)
3213
/// at an amortized cost that should be practically as efficient as a single inversion.
3314
pub trait BatchInvert<FieldElements: ?Sized>: Invert + Sized {

0 commit comments

Comments
 (0)