Skip to content

Commit 523740b

Browse files
committed
[WIP] elliptic-curve: transition from subtle to ctutils
We can't completely remove `subtle` because it's used by the `ff`/`group` traits, however as much s possible this migrates from `subtle` to `ctutils`. It's a bit annoying because we end up with a mixed API of `ctutils` and `subtle`, but perhaps we can get `ff`/`group` to migrate upstream as well: RustCrypto/ff#148. See also: #2275
1 parent 1c96506 commit 523740b

File tree

16 files changed

+178
-169
lines changed

16 files changed

+178
-169
lines changed

Cargo.lock

Lines changed: 10 additions & 11 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: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,25 @@ and public/secret keys composed thereof.
1717
"""
1818

1919
[dependencies]
20-
array = { package = "hybrid-array", version = "0.4", default-features = false, features = ["zeroize"] }
21-
bigint = { package = "crypto-bigint", version = "0.7", default-features = false, features = ["hybrid-array", "rand_core", "subtle", "zeroize"] }
20+
array = { package = "hybrid-array", version = "0.4.10", default-features = false, features = ["ctutils", "zeroize"] }
21+
bigint = { package = "crypto-bigint", version = "0.7", default-features = false, features = ["hybrid-array", "rand_core", "zeroize"] }
2222
base16ct = "1"
23+
ctutils = { version = "0.4", features = ["subtle"] }
2324
common = { package = "crypto-common", version = "0.2", features = ["rand_core"] }
2425
rand_core = { version = "0.10", default-features = false }
2526
subtle = { version = "2.6", default-features = false }
2627
zeroize = { version = "1.7", default-features = false }
2728

2829
# optional dependencies
2930
digest = { version = "0.11", optional = true }
30-
ff = { version = "0.14.0-rc.0", package = "rustcrypto-ff", optional = true, default-features = false }
31-
group = { version = "0.14.0-rc.0", package = "rustcrypto-group", optional = true, default-features = false }
31+
ff = { version = "0.14.0-rc.1", package = "rustcrypto-ff", optional = true, default-features = false }
32+
group = { version = "0.14.0-rc.1", package = "rustcrypto-group", optional = true, default-features = false }
3233
hkdf = { version = "0.13", optional = true, default-features = false }
3334
hex-literal = { version = "1", optional = true }
3435
once_cell = { version = "1.21", optional = true, default-features = false }
3536
pem-rfc7468 = { version = "1", optional = true, features = ["alloc"] }
3637
pkcs8 = { version = "0.11.0-rc.10", optional = true, default-features = false }
37-
sec1 = { version = "0.8", optional = true, features = ["ctutils", "subtle", "zeroize"] }
38+
sec1 = { version = "0.8.1", optional = true, features = ["ctutils", "zeroize"] }
3839
serdect = { version = "0.4", optional = true, default-features = false, features = ["alloc"] }
3940

4041
[dev-dependencies]

elliptic-curve/src/arithmetic.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
33
use crate::{
44
Curve, CurveGroup, Error, FieldBytes, Group, NonZeroScalar, PrimeCurve, ScalarValue,
5-
ctutils::{CtEq, CtSelect},
5+
ctutils::{CtEq, CtOption, CtSelect},
66
ops::{Invert, LinearCombination, Mul, Reduce},
77
point::{AffineCoordinates, NonIdentity},
88
scalar::{FromUintUnchecked, IsHigh},
99
};
1010
use bigint::modular::Retrieve;
1111
use common::Generate;
1212
use core::fmt::Debug;
13-
use subtle::{ConditionallySelectable, ConstantTimeEq, CtOption};
1413
use zeroize::DefaultIsZeroes;
1514

1615
/// Elliptic curve with an arithmetic implementation.
@@ -19,8 +18,6 @@ pub trait CurveArithmetic: Curve {
1918
type AffinePoint: 'static
2019
+ AffineCoordinates<FieldRepr = FieldBytes<Self>>
2120
+ Copy
22-
+ ConditionallySelectable
23-
+ ConstantTimeEq
2421
+ CtEq
2522
+ CtSelect
2623
+ Debug
@@ -46,9 +43,7 @@ pub trait CurveArithmetic: Curve {
4643
/// - [`Sized`]
4744
/// - [`Send`]
4845
/// - [`Sync`]
49-
type ProjectivePoint: ConditionallySelectable
50-
+ ConstantTimeEq
51-
+ CtEq
46+
type ProjectivePoint: CtEq
5247
+ CtSelect
5348
+ Default
5449
+ DefaultIsZeroes
@@ -68,8 +63,8 @@ pub trait CurveArithmetic: Curve {
6863
/// - `'static`
6964
/// - [`Copy`]
7065
/// - [`Clone`]
71-
/// - [`ConditionallySelectable`]
72-
/// - [`ConstantTimeEq`]
66+
/// - [`CtSelect`]
67+
/// - [`CtEq`]
7368
/// - [`Debug`]
7469
/// - [`Default`]
7570
/// - [`Send`]

0 commit comments

Comments
 (0)