@@ -12,7 +12,7 @@ use crate::rand_core::{CryptoRng, TryCryptoRng};
1212/// or connection to an HSM), returning a digital signature.
1313pub trait Signer < S > {
1414 /// Sign the given message and return a digital signature
15- fn sign ( & self , msg : & [ u8 ] ) -> S {
15+ fn sign ( & self , msg : & [ & [ u8 ] ] ) -> S {
1616 self . try_sign ( msg) . expect ( "signature operation failed" )
1717 }
1818
@@ -21,15 +21,15 @@ pub trait Signer<S> {
2121 ///
2222 /// The main intended use case for signing errors is when communicating
2323 /// with external signers, e.g. cloud KMS, HSMs, or other hardware tokens.
24- fn try_sign ( & self , msg : & [ u8 ] ) -> Result < S , Error > ;
24+ fn try_sign ( & self , msg : & [ & [ u8 ] ] ) -> Result < S , Error > ;
2525}
2626
2727/// Sign the provided message bytestring using `&mut Self` (e.g. an evolving
2828/// cryptographic key such as a stateful hash-based signature), returning a
2929/// digital signature.
3030pub trait SignerMut < S > {
3131 /// Sign the given message, update the state, and return a digital signature.
32- fn sign ( & mut self , msg : & [ u8 ] ) -> S {
32+ fn sign ( & mut self , msg : & [ & [ u8 ] ] ) -> S {
3333 self . try_sign ( msg) . expect ( "signature operation failed" )
3434 }
3535
@@ -38,12 +38,12 @@ pub trait SignerMut<S> {
3838 ///
3939 /// Signing can fail, e.g., if the number of time periods allowed by the
4040 /// current key is exceeded.
41- fn try_sign ( & mut self , msg : & [ u8 ] ) -> Result < S , Error > ;
41+ fn try_sign ( & mut self , msg : & [ & [ u8 ] ] ) -> Result < S , Error > ;
4242}
4343
4444/// Blanket impl of [`SignerMut`] for all [`Signer`] types.
4545impl < S , T : Signer < S > > SignerMut < S > for T {
46- fn try_sign ( & mut self , msg : & [ u8 ] ) -> Result < S , Error > {
46+ fn try_sign ( & mut self , msg : & [ & [ u8 ] ] ) -> Result < S , Error > {
4747 T :: try_sign ( self , msg)
4848 }
4949}
@@ -86,7 +86,7 @@ pub trait DigestSigner<D: Digest, S> {
8686#[ cfg( feature = "rand_core" ) ]
8787pub trait RandomizedSigner < S > {
8888 /// Sign the given message and return a digital signature
89- fn sign_with_rng < R : CryptoRng + ?Sized > ( & self , rng : & mut R , msg : & [ u8 ] ) -> S {
89+ fn sign_with_rng < R : CryptoRng + ?Sized > ( & self , rng : & mut R , msg : & [ & [ u8 ] ] ) -> S {
9090 self . try_sign_with_rng ( rng, msg)
9191 . expect ( "signature operation failed" )
9292 }
@@ -99,7 +99,7 @@ pub trait RandomizedSigner<S> {
9999 fn try_sign_with_rng < R : TryCryptoRng + ?Sized > (
100100 & self ,
101101 rng : & mut R ,
102- msg : & [ u8 ] ,
102+ msg : & [ & [ u8 ] ] ,
103103 ) -> Result < S , Error > ;
104104}
105105
@@ -130,7 +130,7 @@ pub trait RandomizedDigestSigner<D: Digest, S> {
130130#[ cfg( feature = "rand_core" ) ]
131131pub trait RandomizedSignerMut < S > {
132132 /// Sign the given message, update the state, and return a digital signature.
133- fn sign_with_rng < R : CryptoRng + ?Sized > ( & mut self , rng : & mut R , msg : & [ u8 ] ) -> S {
133+ fn sign_with_rng < R : CryptoRng + ?Sized > ( & mut self , rng : & mut R , msg : & [ & [ u8 ] ] ) -> S {
134134 self . try_sign_with_rng ( rng, msg)
135135 . expect ( "signature operation failed" )
136136 }
@@ -143,7 +143,7 @@ pub trait RandomizedSignerMut<S> {
143143 fn try_sign_with_rng < R : TryCryptoRng + ?Sized > (
144144 & mut self ,
145145 rng : & mut R ,
146- msg : & [ u8 ] ,
146+ msg : & [ & [ u8 ] ] ,
147147 ) -> Result < S , Error > ;
148148}
149149
@@ -153,7 +153,7 @@ impl<S, T: RandomizedSigner<S>> RandomizedSignerMut<S> for T {
153153 fn try_sign_with_rng < R : TryCryptoRng + ?Sized > (
154154 & mut self ,
155155 rng : & mut R ,
156- msg : & [ u8 ] ,
156+ msg : & [ & [ u8 ] ] ,
157157 ) -> Result < S , Error > {
158158 T :: try_sign_with_rng ( self , rng, msg)
159159 }
@@ -169,14 +169,14 @@ pub trait AsyncSigner<S> {
169169 ///
170170 /// The main intended use case for signing errors is when communicating
171171 /// with external signers, e.g. cloud KMS, HSMs, or other hardware tokens.
172- async fn sign_async ( & self , msg : & [ u8 ] ) -> Result < S , Error > ;
172+ async fn sign_async ( & self , msg : & [ & [ u8 ] ] ) -> Result < S , Error > ;
173173}
174174
175175impl < S , T > AsyncSigner < S > for T
176176where
177177 T : Signer < S > ,
178178{
179- async fn sign_async ( & self , msg : & [ u8 ] ) -> Result < S , Error > {
179+ async fn sign_async ( & self , msg : & [ & [ u8 ] ] ) -> Result < S , Error > {
180180 self . try_sign ( msg)
181181 }
182182}
@@ -198,7 +198,7 @@ where
198198#[ cfg( feature = "rand_core" ) ]
199199pub trait AsyncRandomizedSigner < S > {
200200 /// Sign the given message and return a digital signature
201- async fn sign_with_rng_async < R : CryptoRng + ?Sized > ( & self , rng : & mut R , msg : & [ u8 ] ) -> S {
201+ async fn sign_with_rng_async < R : CryptoRng + ?Sized > ( & self , rng : & mut R , msg : & [ & [ u8 ] ] ) -> S {
202202 self . try_sign_with_rng_async ( rng, msg)
203203 . await
204204 . expect ( "signature operation failed" )
@@ -212,7 +212,7 @@ pub trait AsyncRandomizedSigner<S> {
212212 async fn try_sign_with_rng_async < R : TryCryptoRng + ?Sized > (
213213 & self ,
214214 rng : & mut R ,
215- msg : & [ u8 ] ,
215+ msg : & [ & [ u8 ] ] ,
216216 ) -> Result < S , Error > ;
217217}
218218
@@ -224,7 +224,7 @@ where
224224 async fn try_sign_with_rng_async < R : TryCryptoRng + ?Sized > (
225225 & self ,
226226 rng : & mut R ,
227- msg : & [ u8 ] ,
227+ msg : & [ & [ u8 ] ] ,
228228 ) -> Result < S , Error > {
229229 self . try_sign_with_rng ( rng, msg)
230230 }
0 commit comments