Skip to content

Commit

Permalink
signature: Relax Sized requirements on async signer traits
Browse files Browse the repository at this point in the history
Follow up on RustCrypto#1765
  • Loading branch information
baloo committed Feb 22, 2025
1 parent f17b962 commit 2558652
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions signature/src/hazmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub trait RandomizedPrehashSigner<S> {
///
/// Allowed lengths are algorithm-dependent and up to a particular
/// implementation to decide.
fn sign_prehash_with_rng<R: TryCryptoRng>(
fn sign_prehash_with_rng<R: TryCryptoRng + ?Sized>(
&self,
rng: &mut R,
prehash: &[u8],
Expand Down Expand Up @@ -103,7 +103,7 @@ pub trait AsyncRandomizedPrehashSigner<S> {
///
/// Allowed lengths are algorithm-dependent and up to a particular
/// implementation to decide.
async fn sign_prehash_with_rng_async<R: TryCryptoRng>(
async fn sign_prehash_with_rng_async<R: TryCryptoRng + ?Sized>(
&self,
rng: &mut R,
prehash: &[u8],
Expand Down
6 changes: 3 additions & 3 deletions signature/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ where
#[allow(async_fn_in_trait)]
pub trait AsyncRandomizedSigner<S> {
/// Sign the given message and return a digital signature
async fn sign_with_rng_async<R: CryptoRng>(&self, rng: &mut R, msg: &[u8]) -> S {
async fn sign_with_rng_async<R: CryptoRng + ?Sized>(&self, rng: &mut R, msg: &[u8]) -> S {
self.try_sign_with_rng_async(rng, msg)
.await
.expect("signature operation failed")
Expand All @@ -212,7 +212,7 @@ pub trait AsyncRandomizedSigner<S> {
///
/// The main intended use case for signing errors is when communicating
/// with external signers, e.g. cloud KMS, HSMs, or other hardware tokens.
async fn try_sign_with_rng_async<R: CryptoRng>(
async fn try_sign_with_rng_async<R: TryCryptoRng + ?Sized>(
&self,
rng: &mut R,
msg: &[u8],
Expand All @@ -224,7 +224,7 @@ impl<S, T> AsyncRandomizedSigner<S> for T
where
T: RandomizedSigner<S>,
{
async fn try_sign_with_rng_async<R: CryptoRng>(
async fn try_sign_with_rng_async<R: TryCryptoRng + ?Sized>(
&self,
rng: &mut R,
msg: &[u8],
Expand Down

0 comments on commit 2558652

Please sign in to comment.