@@ -87,7 +87,7 @@ pub trait DigestSigner<D: Digest, S> {
87
87
#[ cfg_attr( docsrs, doc( cfg( feature = "rand-preview" ) ) ) ]
88
88
pub trait RandomizedSigner < S > {
89
89
/// Sign the given message and return a digital signature
90
- fn sign_with_rng ( & self , rng : & mut impl CryptoRngCore , msg : & [ u8 ] ) -> S {
90
+ fn sign_with_rng < R : CryptoRngCore + ? Sized > ( & self , rng : & mut R , msg : & [ u8 ] ) -> S {
91
91
self . try_sign_with_rng ( rng, msg)
92
92
. expect ( "signature operation failed" )
93
93
}
@@ -97,7 +97,11 @@ pub trait RandomizedSigner<S> {
97
97
///
98
98
/// The main intended use case for signing errors is when communicating
99
99
/// with external signers, e.g. cloud KMS, HSMs, or other hardware tokens.
100
- fn try_sign_with_rng ( & self , rng : & mut impl CryptoRngCore , msg : & [ u8 ] ) -> Result < S , Error > ;
100
+ fn try_sign_with_rng < R : CryptoRngCore + ?Sized > (
101
+ & self ,
102
+ rng : & mut R ,
103
+ msg : & [ u8 ] ,
104
+ ) -> Result < S , Error > ;
101
105
}
102
106
103
107
/// Combination of [`DigestSigner`] and [`RandomizedSigner`] with support for
@@ -109,13 +113,16 @@ pub trait RandomizedDigestSigner<D: Digest, S> {
109
113
/// Sign the given prehashed message `Digest`, returning a signature.
110
114
///
111
115
/// Panics in the event of a signing error.
112
- fn sign_digest_with_rng ( & self , rng : & mut impl CryptoRngCore , digest : D ) -> S {
116
+ fn sign_digest_with_rng < R : CryptoRngCore + ? Sized > ( & self , rng : & mut R , digest : D ) -> S {
113
117
self . try_sign_digest_with_rng ( rng, digest)
114
118
. expect ( "signature operation failed" )
115
119
}
116
120
117
121
/// Attempt to sign the given prehashed message `Digest`, returning a
118
122
/// digital signature on success, or an error if something went wrong.
119
- fn try_sign_digest_with_rng ( & self , rng : & mut impl CryptoRngCore , digest : D )
120
- -> Result < S , Error > ;
123
+ fn try_sign_digest_with_rng < R : CryptoRngCore + ?Sized > (
124
+ & self ,
125
+ rng : & mut R ,
126
+ digest : D ,
127
+ ) -> Result < S , Error > ;
121
128
}
0 commit comments