Skip to content

Commit

Permalink
signature: async rand_core v0.9 updates (#1749)
Browse files Browse the repository at this point in the history
Followup to #1720
  • Loading branch information
tarcieri authored Feb 12, 2025
1 parent 2992066 commit 2e4bd57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions signature/src/hazmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ pub trait AsyncRandomizedPrehashSigner<S> {
///
/// Allowed lengths are algorithm-dependent and up to a particular
/// implementation to decide.
async fn sign_prehash_with_rng_async(
async fn sign_prehash_with_rng_async<R: CryptoRng>(
&self,
rng: &mut impl CryptoRngCore,
rng: &mut R,
prehash: &[u8],
) -> Result<S, Error>;
}
10 changes: 5 additions & 5 deletions signature/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,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(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S {
async fn sign_with_rng_async<R: CryptoRng>(&self, rng: &mut R, msg: &[u8]) -> S {
self.try_sign_with_rng_async(rng, msg)
.await
.expect("signature operation failed")
Expand All @@ -197,9 +197,9 @@ 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(
async fn try_sign_with_rng_async<R: CryptoRng>(
&self,
rng: &mut impl CryptoRngCore,
rng: &mut R,
msg: &[u8],
) -> Result<S, Error>;
}
Expand All @@ -209,9 +209,9 @@ impl<S, T> AsyncRandomizedSigner<S> for T
where
T: RandomizedSigner<S>,
{
async fn try_sign_with_rng_async(
async fn try_sign_with_rng_async<R: CryptoRng>(
&self,
rng: &mut impl CryptoRngCore,
rng: &mut R,
msg: &[u8],
) -> Result<S, Error> {
self.try_sign_with_rng(rng, msg)
Expand Down

0 comments on commit 2e4bd57

Please sign in to comment.