Skip to content

Commit 9a72cbf

Browse files
committed
Merge arithmetic into algorithm crate feature
1 parent a29a055 commit 9a72cbf

4 files changed

Lines changed: 15 additions & 19 deletions

File tree

ecdsa/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ default = ["digest"]
3939
alloc = ["elliptic-curve/alloc", "signature/alloc", "spki/alloc"]
4040
std = ["alloc", "elliptic-curve/std"]
4141

42-
arithmetic = ["dep:digest", "dep:rfc6979", "elliptic-curve/arithmetic"]
43-
algorithm = ["dep:rfc6979", "arithmetic", "digest", "hazmat"]
44-
dev = ["arithmetic", "digest", "elliptic-curve/dev", "hazmat"]
42+
algorithm = ["dep:rfc6979", "digest", "elliptic-curve/arithmetic", "hazmat"]
43+
dev = ["algorithm", "elliptic-curve/dev"]
4544
der = ["dep:der"]
4645
digest = ["dep:digest", "elliptic-curve/digest", "signature/digest"]
4746
hazmat = []

ecdsa/src/der.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ fn find_scalar_range(outer: &[u8], inner: &[u8]) -> Result<Range<usize>> {
393393
Ok(Range { start, end })
394394
}
395395

396-
#[cfg(all(test, feature = "arithmetic"))]
396+
#[cfg(all(test, feature = "algorithm"))]
397397
mod tests {
398398
use elliptic_curve::dev::MockCurve;
399399

ecdsa/src/hazmat.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ use crate::{EcdsaCurve, Error, Result};
1414
use core::cmp;
1515
use elliptic_curve::{FieldBytes, array::typenum::Unsigned};
1616

17-
#[cfg(feature = "arithmetic")]
17+
#[cfg(feature = "algorithm")]
1818
use {
19-
crate::{RecoveryId, SignatureSize},
19+
crate::{
20+
RecoveryId, Signature, SignatureSize,
21+
elliptic_curve::{FieldBytesEncoding, array::ArraySize},
22+
},
2023
elliptic_curve::{
2124
CurveArithmetic, NonZeroScalar, ProjectivePoint, Scalar,
2225
ff::PrimeField,
@@ -27,13 +30,7 @@ use {
2730
},
2831
};
2932

30-
#[cfg(feature = "arithmetic")]
31-
use crate::{
32-
Signature,
33-
elliptic_curve::{FieldBytesEncoding, array::ArraySize},
34-
};
35-
36-
#[cfg(any(feature = "arithmetic", feature = "digest"))]
33+
#[cfg(feature = "digest")]
3734
use digest::block_api::EagerHash;
3835

3936
/// Bind a preferred [`Digest`] algorithm to an elliptic curve type.
@@ -102,7 +99,7 @@ pub fn bits2field<C: EcdsaCurve>(bits: &[u8]) -> Result<FieldBytes<C>> {
10299
///
103100
/// This will return an error if a zero-scalar was generated. It can be tried again with a
104101
/// different `k`.
105-
#[cfg(feature = "arithmetic")]
102+
#[cfg(feature = "algorithm")]
106103
#[allow(non_snake_case)]
107104
pub fn sign_prehashed<C>(
108105
d: &NonZeroScalar<C>,
@@ -159,7 +156,7 @@ where
159156
/// entropy `ad`.
160157
///
161158
/// [RFC6979]: https://datatracker.ietf.org/doc/html/rfc6979
162-
#[cfg(feature = "arithmetic")]
159+
#[cfg(feature = "algorithm")]
163160
pub fn sign_prehashed_rfc6979<C, D>(
164161
d: &NonZeroScalar<C>,
165162
z: &FieldBytes<C>,
@@ -201,7 +198,7 @@ where
201198
/// # Low-S Normalization
202199
///
203200
/// This is a low-level function that does *NOT* apply the `EcdsaCurve::NORMALIZE_S` checks.
204-
#[cfg(feature = "arithmetic")]
201+
#[cfg(feature = "algorithm")]
205202
pub fn verify_prehashed<C>(
206203
q: &ProjectivePoint<C>,
207204
z: &FieldBytes<C>,

ecdsa/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ use elliptic_curve::{
9393
#[cfg(feature = "alloc")]
9494
use alloc::vec::Vec;
9595

96-
#[cfg(feature = "arithmetic")]
96+
#[cfg(feature = "algorithm")]
9797
use {
9898
core::str,
9999
elliptic_curve::{
@@ -300,7 +300,7 @@ where
300300
}
301301
}
302302

303-
#[cfg(feature = "arithmetic")]
303+
#[cfg(feature = "algorithm")]
304304
impl<C> Signature<C>
305305
where
306306
C: EcdsaCurve + CurveArithmetic,
@@ -423,7 +423,7 @@ where
423423
}
424424
}
425425

426-
#[cfg(feature = "arithmetic")]
426+
#[cfg(feature = "algorithm")]
427427
impl<C> str::FromStr for Signature<C>
428428
where
429429
C: EcdsaCurve + CurveArithmetic,

0 commit comments

Comments
 (0)