diff --git a/signature/Cargo.toml b/signature/Cargo.toml index 83d673b8a..800207173 100644 --- a/signature/Cargo.toml +++ b/signature/Cargo.toml @@ -14,7 +14,7 @@ categories = ["cryptography", "no-std"] [dependencies] digest = { version = "0.10.3", optional = true, default-features = false } -rand_core = { version = "0.6", optional = true, default-features = false } +rand_core = { version = "0.6.4", optional = true, default-features = false } derive = { package = "signature_derive", version = "=2.0.0-pre.0", optional = true, path = "derive" } [dev-dependencies] diff --git a/signature/src/signer.rs b/signature/src/signer.rs index 25c6614a2..be3de2ec5 100644 --- a/signature/src/signer.rs +++ b/signature/src/signer.rs @@ -6,7 +6,7 @@ use crate::error::Error; use crate::digest::Digest; #[cfg(feature = "rand-preview")] -use crate::rand_core::{CryptoRng, RngCore}; +use crate::rand_core::CryptoRngCore; /// Sign the provided message bytestring using `Self` (e.g. a cryptographic key /// or connection to an HSM), returning a digital signature. @@ -87,7 +87,7 @@ pub trait DigestSigner { #[cfg_attr(docsrs, doc(cfg(feature = "rand-preview")))] pub trait RandomizedSigner { /// Sign the given message and return a digital signature - fn sign_with_rng(&self, rng: impl CryptoRng + RngCore, msg: &[u8]) -> S { + fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S { self.try_sign_with_rng(rng, msg) .expect("signature operation failed") } @@ -97,7 +97,7 @@ pub trait RandomizedSigner { /// /// The main intended use case for signing errors is when communicating /// with external signers, e.g. cloud KMS, HSMs, or other hardware tokens. - fn try_sign_with_rng(&self, rng: impl CryptoRng + RngCore, msg: &[u8]) -> Result; + fn try_sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> Result; } /// Combination of [`DigestSigner`] and [`RandomizedSigner`] with support for @@ -109,16 +109,13 @@ pub trait RandomizedDigestSigner { /// Sign the given prehashed message `Digest`, returning a signature. /// /// Panics in the event of a signing error. - fn sign_digest_with_rng(&self, rng: impl CryptoRng + RngCore, digest: D) -> S { + fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S { self.try_sign_digest_with_rng(rng, digest) .expect("signature operation failed") } /// Attempt to sign the given prehashed message `Digest`, returning a /// digital signature on success, or an error if something went wrong. - fn try_sign_digest_with_rng( - &self, - rng: impl CryptoRng + RngCore, - digest: D, - ) -> Result; + fn try_sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) + -> Result; }