Skip to content

Commit 96dfc4a

Browse files
authored
signature: Relax Sized requirements on async signer traits (#1766)
Follow up on #1765
1 parent f17b962 commit 96dfc4a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

signature/src/hazmat.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub trait RandomizedPrehashSigner<S> {
4343
///
4444
/// Allowed lengths are algorithm-dependent and up to a particular
4545
/// implementation to decide.
46-
fn sign_prehash_with_rng<R: TryCryptoRng>(
46+
fn sign_prehash_with_rng<R: TryCryptoRng + ?Sized>(
4747
&self,
4848
rng: &mut R,
4949
prehash: &[u8],
@@ -103,7 +103,7 @@ pub trait AsyncRandomizedPrehashSigner<S> {
103103
///
104104
/// Allowed lengths are algorithm-dependent and up to a particular
105105
/// implementation to decide.
106-
async fn sign_prehash_with_rng_async<R: TryCryptoRng>(
106+
async fn sign_prehash_with_rng_async<R: TryCryptoRng + ?Sized>(
107107
&self,
108108
rng: &mut R,
109109
prehash: &[u8],

signature/src/signer.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ where
201201
#[allow(async_fn_in_trait)]
202202
pub trait AsyncRandomizedSigner<S> {
203203
/// Sign the given message and return a digital signature
204-
async fn sign_with_rng_async<R: CryptoRng>(&self, rng: &mut R, msg: &[u8]) -> S {
204+
async fn sign_with_rng_async<R: CryptoRng + ?Sized>(&self, rng: &mut R, msg: &[u8]) -> S {
205205
self.try_sign_with_rng_async(rng, msg)
206206
.await
207207
.expect("signature operation failed")
@@ -212,7 +212,7 @@ pub trait AsyncRandomizedSigner<S> {
212212
///
213213
/// The main intended use case for signing errors is when communicating
214214
/// with external signers, e.g. cloud KMS, HSMs, or other hardware tokens.
215-
async fn try_sign_with_rng_async<R: CryptoRng>(
215+
async fn try_sign_with_rng_async<R: TryCryptoRng + ?Sized>(
216216
&self,
217217
rng: &mut R,
218218
msg: &[u8],
@@ -224,7 +224,7 @@ impl<S, T> AsyncRandomizedSigner<S> for T
224224
where
225225
T: RandomizedSigner<S>,
226226
{
227-
async fn try_sign_with_rng_async<R: CryptoRng>(
227+
async fn try_sign_with_rng_async<R: TryCryptoRng + ?Sized>(
228228
&self,
229229
rng: &mut R,
230230
msg: &[u8],

0 commit comments

Comments
 (0)