From 54394690cdc8b426c94f179c2a980c8b36e4f7ff Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Wed, 29 Jul 2020 11:21:23 -0700 Subject: [PATCH] signature: remove RNG generic parameter from RandomizedSigner ...replacing it with `impl CryptoRng + RngCore`. This is a SemVer breaking change, however per our policy around `*-preview` features, it will receive a minor version bump as these features are not part of the SemVer guarantees of this crate. The rationale for this change is the exact RNG method doesn't matter, especially to the point it needs to be a generic parameter of the trait signature. --- signature/src/signer.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/signature/src/signer.rs b/signature/src/signer.rs index a2fa588b8..9ecde4029 100644 --- a/signature/src/signer.rs +++ b/signature/src/signer.rs @@ -66,13 +66,9 @@ where /// Sign the given message using the provided external randomness source. #[cfg(feature = "rand-preview")] #[cfg_attr(docsrs, doc(cfg(feature = "rand-preview")))] -pub trait RandomizedSigner -where - R: CryptoRng + RngCore, - S: Signature, -{ +pub trait RandomizedSigner { /// Sign the given message and return a digital signature - fn sign_with_rng(&self, rng: &mut R, msg: &[u8]) -> S { + fn sign_with_rng(&self, rng: impl CryptoRng + RngCore, msg: &[u8]) -> S { self.try_sign_with_rng(rng, msg) .expect("signature operation failed") } @@ -82,5 +78,5 @@ where /// /// 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: &mut R, msg: &[u8]) -> Result; + fn try_sign_with_rng(&self, rng: impl CryptoRng + RngCore, msg: &[u8]) -> Result; }