@@ -12,7 +12,7 @@ use crate::rand_core::{CryptoRng, TryCryptoRng};
12
12
/// or connection to an HSM), returning a digital signature.
13
13
pub trait Signer < S > {
14
14
/// Sign the given message and return a digital signature
15
- fn sign ( & self , msg : & [ u8 ] ) -> S {
15
+ fn sign ( & self , msg : & [ & [ u8 ] ] ) -> S {
16
16
self . try_sign ( msg) . expect ( "signature operation failed" )
17
17
}
18
18
@@ -21,15 +21,15 @@ pub trait Signer<S> {
21
21
///
22
22
/// The main intended use case for signing errors is when communicating
23
23
/// 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 > ;
25
25
}
26
26
27
27
/// Sign the provided message bytestring using `&mut Self` (e.g. an evolving
28
28
/// cryptographic key such as a stateful hash-based signature), returning a
29
29
/// digital signature.
30
30
pub trait SignerMut < S > {
31
31
/// 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 {
33
33
self . try_sign ( msg) . expect ( "signature operation failed" )
34
34
}
35
35
@@ -38,12 +38,12 @@ pub trait SignerMut<S> {
38
38
///
39
39
/// Signing can fail, e.g., if the number of time periods allowed by the
40
40
/// 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 > ;
42
42
}
43
43
44
44
/// Blanket impl of [`SignerMut`] for all [`Signer`] types.
45
45
impl < 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 > {
47
47
T :: try_sign ( self , msg)
48
48
}
49
49
}
@@ -86,7 +86,7 @@ pub trait DigestSigner<D: Digest, S> {
86
86
#[ cfg( feature = "rand_core" ) ]
87
87
pub trait RandomizedSigner < S > {
88
88
/// 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 {
90
90
self . try_sign_with_rng ( rng, msg)
91
91
. expect ( "signature operation failed" )
92
92
}
@@ -99,7 +99,7 @@ pub trait RandomizedSigner<S> {
99
99
fn try_sign_with_rng < R : TryCryptoRng + ?Sized > (
100
100
& self ,
101
101
rng : & mut R ,
102
- msg : & [ u8 ] ,
102
+ msg : & [ & [ u8 ] ] ,
103
103
) -> Result < S , Error > ;
104
104
}
105
105
@@ -130,7 +130,7 @@ pub trait RandomizedDigestSigner<D: Digest, S> {
130
130
#[ cfg( feature = "rand_core" ) ]
131
131
pub trait RandomizedSignerMut < S > {
132
132
/// 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 {
134
134
self . try_sign_with_rng ( rng, msg)
135
135
. expect ( "signature operation failed" )
136
136
}
@@ -143,7 +143,7 @@ pub trait RandomizedSignerMut<S> {
143
143
fn try_sign_with_rng < R : TryCryptoRng + ?Sized > (
144
144
& mut self ,
145
145
rng : & mut R ,
146
- msg : & [ u8 ] ,
146
+ msg : & [ & [ u8 ] ] ,
147
147
) -> Result < S , Error > ;
148
148
}
149
149
@@ -153,7 +153,7 @@ impl<S, T: RandomizedSigner<S>> RandomizedSignerMut<S> for T {
153
153
fn try_sign_with_rng < R : TryCryptoRng + ?Sized > (
154
154
& mut self ,
155
155
rng : & mut R ,
156
- msg : & [ u8 ] ,
156
+ msg : & [ & [ u8 ] ] ,
157
157
) -> Result < S , Error > {
158
158
T :: try_sign_with_rng ( self , rng, msg)
159
159
}
@@ -169,14 +169,14 @@ pub trait AsyncSigner<S> {
169
169
///
170
170
/// The main intended use case for signing errors is when communicating
171
171
/// 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 > ;
173
173
}
174
174
175
175
impl < S , T > AsyncSigner < S > for T
176
176
where
177
177
T : Signer < S > ,
178
178
{
179
- async fn sign_async ( & self , msg : & [ u8 ] ) -> Result < S , Error > {
179
+ async fn sign_async ( & self , msg : & [ & [ u8 ] ] ) -> Result < S , Error > {
180
180
self . try_sign ( msg)
181
181
}
182
182
}
@@ -198,7 +198,7 @@ where
198
198
#[ cfg( feature = "rand_core" ) ]
199
199
pub trait AsyncRandomizedSigner < S > {
200
200
/// 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 {
202
202
self . try_sign_with_rng_async ( rng, msg)
203
203
. await
204
204
. expect ( "signature operation failed" )
@@ -212,7 +212,7 @@ pub trait AsyncRandomizedSigner<S> {
212
212
async fn try_sign_with_rng_async < R : TryCryptoRng + ?Sized > (
213
213
& self ,
214
214
rng : & mut R ,
215
- msg : & [ u8 ] ,
215
+ msg : & [ & [ u8 ] ] ,
216
216
) -> Result < S , Error > ;
217
217
}
218
218
@@ -224,7 +224,7 @@ where
224
224
async fn try_sign_with_rng_async < R : TryCryptoRng + ?Sized > (
225
225
& self ,
226
226
rng : & mut R ,
227
- msg : & [ u8 ] ,
227
+ msg : & [ & [ u8 ] ] ,
228
228
) -> Result < S , Error > {
229
229
self . try_sign_with_rng ( rng, msg)
230
230
}
0 commit comments