Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dsa/src/generate/secret_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{Components, signing_key::SigningKey};
use alloc::vec;
use core::cmp::min;
use crypto_bigint::{BoxedUint, NonZero, RandomBits, Resize};
use rfc6979::hmac::EagerHash;
use digest::block_api::EagerHash;
use signature::rand_core::TryCryptoRng;
use zeroize::Zeroizing;

Expand Down
3 changes: 1 addition & 2 deletions dsa/src/signing_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use crypto_bigint::{
BoxedUint, NonZero, Resize,
modular::{BoxedMontyForm, BoxedMontyParams},
};
use digest::Update;
use rfc6979::hmac::EagerHash;
use digest::{Update, block_api::EagerHash};
use signature::{
DigestSigner, MultipartSigner, RandomizedDigestSigner, Signer,
hazmat::{PrehashSigner, RandomizedPrehashSigner},
Expand Down
3 changes: 1 addition & 2 deletions dsa/src/verifying_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use crypto_bigint::{
BoxedUint, NonZero, Resize,
modular::{BoxedMontyForm, BoxedMontyParams},
};
use digest::Update;
use rfc6979::hmac::EagerHash;
use digest::{Update, block_api::EagerHash};
use signature::{DigestVerifier, MultipartVerifier, Verifier, hazmat::PrehashVerifier};

#[cfg(feature = "pkcs8")]
Expand Down
3 changes: 1 addition & 2 deletions dsa/tests/deterministic.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#![cfg(feature = "hazmat")]
use crypto_bigint::BoxedUint;
use digest::Update;
use digest::{Update, block_api::EagerHash};
use dsa::{Components, Signature, SigningKey, VerifyingKey};
use rfc6979::hmac::EagerHash;
use sha1::Sha1;
use sha2::{Sha224, Sha256, Sha384, Sha512};
use signature::DigestSigner;
Expand Down
10 changes: 4 additions & 6 deletions ecdsa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ zeroize = { version = "1.5", default-features = false }

# optional dependencies
der = { version = "0.8.0-rc.8", optional = true }
digest = { version = "0.11.0-rc.1", optional = true, default-features = false, features = ["oid"] }
hmac = { version = "0.13.0-rc.1", default-features = false, optional = true }
digest = { version = "0.11.0-rc.2", optional = true, default-features = false, features = ["oid"] }
rfc6979 = { version = "0.5.0-rc.1", optional = true }
serdect = { version = "0.4", optional = true, default-features = false, features = ["alloc"] }
sha2 = { version = "0.11.0-rc.2", optional = true, default-features = false, features = ["oid"] }
Expand All @@ -40,11 +39,10 @@ default = ["digest"]
alloc = ["elliptic-curve/alloc", "signature/alloc", "spki/alloc"]
std = ["alloc", "elliptic-curve/std"]

arithmetic = ["dep:hmac", "dep:rfc6979", "elliptic-curve/arithmetic"]
algorithm = ["dep:rfc6979", "arithmetic", "digest", "hazmat"]
dev = ["arithmetic", "digest", "elliptic-curve/dev", "hazmat"]
algorithm = ["dep:rfc6979", "digest", "elliptic-curve/arithmetic", "hazmat"]
dev = ["algorithm", "elliptic-curve/dev"]
der = ["dep:der"]
digest = ["dep:digest", "dep:hmac", "elliptic-curve/digest", "signature/digest"]
digest = ["dep:digest", "elliptic-curve/digest", "signature/digest"]
hazmat = []
pkcs8 = ["der", "digest", "elliptic-curve/pkcs8"]
pem = ["elliptic-curve/pem", "pkcs8"]
Expand Down
2 changes: 1 addition & 1 deletion ecdsa/src/der.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ fn find_scalar_range(outer: &[u8], inner: &[u8]) -> Result<Range<usize>> {
Ok(Range { start, end })
}

#[cfg(all(test, feature = "arithmetic"))]
#[cfg(all(test, feature = "algorithm"))]
mod tests {
use elliptic_curve::dev::MockCurve;

Expand Down
23 changes: 10 additions & 13 deletions ecdsa/src/hazmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ use crate::{EcdsaCurve, Error, Result};
use core::cmp;
use elliptic_curve::{FieldBytes, array::typenum::Unsigned};

#[cfg(feature = "arithmetic")]
#[cfg(feature = "algorithm")]
use {
crate::{RecoveryId, SignatureSize},
crate::{
RecoveryId, Signature, SignatureSize,
elliptic_curve::{FieldBytesEncoding, array::ArraySize},
},
elliptic_curve::{
CurveArithmetic, NonZeroScalar, ProjectivePoint, Scalar,
ff::PrimeField,
Expand All @@ -27,14 +30,8 @@ use {
},
};

#[cfg(feature = "arithmetic")]
use crate::{
Signature,
elliptic_curve::{FieldBytesEncoding, array::ArraySize},
};

#[cfg(any(feature = "arithmetic", feature = "digest"))]
use hmac::EagerHash;
#[cfg(feature = "digest")]
use digest::block_api::EagerHash;

/// Bind a preferred [`Digest`] algorithm to an elliptic curve type.
///
Expand Down Expand Up @@ -102,7 +99,7 @@ pub fn bits2field<C: EcdsaCurve>(bits: &[u8]) -> Result<FieldBytes<C>> {
///
/// This will return an error if a zero-scalar was generated. It can be tried again with a
/// different `k`.
#[cfg(feature = "arithmetic")]
#[cfg(feature = "algorithm")]
#[allow(non_snake_case)]
pub fn sign_prehashed<C>(
d: &NonZeroScalar<C>,
Expand Down Expand Up @@ -159,7 +156,7 @@ where
/// entropy `ad`.
///
/// [RFC6979]: https://datatracker.ietf.org/doc/html/rfc6979
#[cfg(feature = "arithmetic")]
#[cfg(feature = "algorithm")]
pub fn sign_prehashed_rfc6979<C, D>(
d: &NonZeroScalar<C>,
z: &FieldBytes<C>,
Expand Down Expand Up @@ -201,7 +198,7 @@ where
/// # Low-S Normalization
///
/// This is a low-level function that does *NOT* apply the `EcdsaCurve::NORMALIZE_S` checks.
#[cfg(feature = "arithmetic")]
#[cfg(feature = "algorithm")]
pub fn verify_prehashed<C>(
q: &ProjectivePoint<C>,
z: &FieldBytes<C>,
Expand Down
6 changes: 3 additions & 3 deletions ecdsa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ use elliptic_curve::{
#[cfg(feature = "alloc")]
use alloc::vec::Vec;

#[cfg(feature = "arithmetic")]
#[cfg(feature = "algorithm")]
use {
core::str,
elliptic_curve::{
Expand Down Expand Up @@ -300,7 +300,7 @@ where
}
}

#[cfg(feature = "arithmetic")]
#[cfg(feature = "algorithm")]
impl<C> Signature<C>
where
C: EcdsaCurve + CurveArithmetic,
Expand Down Expand Up @@ -423,7 +423,7 @@ where
}
}

#[cfg(feature = "arithmetic")]
#[cfg(feature = "algorithm")]
impl<C> str::FromStr for Signature<C>
where
C: EcdsaCurve + CurveArithmetic,
Expand Down
3 changes: 1 addition & 2 deletions ecdsa/src/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use {
EcdsaCurve, Signature, SignatureSize, SigningKey, VerifyingKey,
hazmat::{DigestAlgorithm, bits2field, sign_prehashed_rfc6979, verify_prehashed},
},
digest::{Digest, block_api::EagerHash},
elliptic_curve::{
AffinePoint, FieldBytesEncoding, FieldBytesSize, Group, PrimeField, ProjectivePoint,
bigint::CheckedAdd,
Expand All @@ -18,10 +19,8 @@ use {
elliptic_curve::{
CurveArithmetic, FieldBytes, Scalar, array::ArraySize, ops::Invert, subtle::CtOption,
},
rfc6979::hmac::EagerHash,
signature::{
DigestSigner, MultipartSigner, RandomizedDigestSigner, Signer,
digest::Digest,
hazmat::{PrehashSigner, RandomizedPrehashSigner},
rand_core::TryCryptoRng,
},
Expand Down
3 changes: 1 addition & 2 deletions ecdsa/src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
hazmat::{DigestAlgorithm, bits2field, sign_prehashed_rfc6979},
};
use core::fmt::{self, Debug};
use digest::{Update, const_oid::AssociatedOid};
use digest::{Update, block_api::EagerHash, const_oid::AssociatedOid};
use elliptic_curve::{
CurveArithmetic, FieldBytes, NonZeroScalar, Scalar, SecretKey,
array::ArraySize,
Expand All @@ -14,7 +14,6 @@ use elliptic_curve::{
subtle::{Choice, ConstantTimeEq, CtOption},
zeroize::{Zeroize, ZeroizeOnDrop},
};
use rfc6979::hmac::EagerHash;
use signature::{
DigestSigner, MultipartSigner, RandomizedDigestSigner, RandomizedMultipartSigner,
RandomizedSigner, Signer,
Expand Down
3 changes: 1 addition & 2 deletions ecdsa/src/verifying.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ use crate::{
hazmat::{self, DigestAlgorithm, bits2field},
};
use core::{cmp::Ordering, fmt::Debug};
use digest::Update;
use digest::{Update, block_api::EagerHash};
use elliptic_curve::{
AffinePoint, CurveArithmetic, FieldBytesSize, ProjectivePoint, PublicKey,
array::ArraySize,
point::PointCompression,
scalar::IsHigh,
sec1::{self, CompressedPoint, EncodedPoint, FromEncodedPoint, ToEncodedPoint},
};
use rfc6979::hmac::EagerHash;
use signature::{DigestVerifier, MultipartVerifier, Verifier, hazmat::PrehashVerifier};

#[cfg(feature = "alloc")]
Expand Down
3 changes: 2 additions & 1 deletion rfc6979/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ pub use hmac;
pub use hmac::digest::array::typenum::consts;

use hmac::{
EagerHash, HmacReset,
HmacReset,
digest::{
KeyInit, Mac, OutputSizeUser,
array::{Array, ArraySize},
block_api::EagerHash,
},
};

Expand Down
Loading