@@ -24,11 +24,11 @@ use std::{convert::TryFrom, ops::Add, sync::Mutex};
24
24
use digest:: { Digest , FixedOutput , Output } ;
25
25
use ecdsa:: {
26
26
der:: { MaxOverhead , MaxSize , Signature as DerSignature } ,
27
- hazmat:: { DigestPrimitive , SignPrimitive } ,
28
- Signature , SignatureSize , VerifyingKey ,
27
+ hazmat:: DigestPrimitive ,
28
+ EcdsaCurve , Signature , SignatureSize , VerifyingKey ,
29
29
} ;
30
30
use elliptic_curve:: {
31
- generic_array :: ArrayLength ,
31
+ array :: ArraySize ,
32
32
ops:: Invert ,
33
33
sec1:: { FromEncodedPoint , ModulusSize , ToEncodedPoint } ,
34
34
subtle:: CtOption ,
@@ -139,15 +139,15 @@ impl TpmSigner
139
139
#[ derive( Debug ) ]
140
140
pub struct EcSigner < C , Ctx >
141
141
where
142
- C : PrimeCurve + CurveArithmetic ,
142
+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
143
143
{
144
144
context : Ctx ,
145
145
verifying_key : VerifyingKey < C > ,
146
146
}
147
147
148
148
impl < C , Ctx > EcSigner < C , Ctx >
149
149
where
150
- C : PrimeCurve + CurveArithmetic ,
150
+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
151
151
C : AssociatedTpmCurve ,
152
152
FieldBytesSize < C > : ModulusSize ,
153
153
AffinePoint < C > : FromEncodedPoint < C > + ToEncodedPoint < C > ,
@@ -179,14 +179,14 @@ where
179
179
180
180
impl < C , Ctx > EcSigner < C , Ctx >
181
181
where
182
- C : PrimeCurve + CurveArithmetic ,
182
+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
183
183
C : AssociatedTpmCurve ,
184
184
{
185
185
/// Key parameters for this curve, selected digest is the one selected by DigestPrimitive
186
186
pub fn key_params_default ( ) -> KeyParams
187
187
where
188
188
C : DigestPrimitive ,
189
- <C as DigestPrimitive >:: Digest : FixedOutput < OutputSize = FieldBytesSize < C > > ,
189
+ <C as DigestPrimitive >:: Digest : FixedOutput ,
190
190
<C as DigestPrimitive >:: Digest : AssociatedHashingAlgorithm ,
191
191
{
192
192
Self :: key_params :: < <C as DigestPrimitive >:: Digest > ( )
@@ -199,7 +199,7 @@ where
199
199
/// The hashing algorithm `D` is the digest that will be used for signatures (SHA-256, SHA3-256, ...).
200
200
pub fn key_params < D > ( ) -> KeyParams
201
201
where
202
- D : FixedOutput < OutputSize = FieldBytesSize < C > > ,
202
+ D : FixedOutput ,
203
203
D : AssociatedHashingAlgorithm ,
204
204
{
205
205
KeyParams :: Ecc {
@@ -212,9 +212,9 @@ where
212
212
213
213
impl < C , Ctx > AsRef < VerifyingKey < C > > for EcSigner < C , Ctx >
214
214
where
215
- C : PrimeCurve + CurveArithmetic ,
216
- Scalar < C > : Invert < Output = CtOption < Scalar < C > > > + SignPrimitive < C > ,
217
- SignatureSize < C > : ArrayLength < u8 > ,
215
+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
216
+ Scalar < C > : Invert < Output = CtOption < Scalar < C > > > ,
217
+ SignatureSize < C > : ArraySize ,
218
218
{
219
219
fn as_ref ( & self ) -> & VerifyingKey < C > {
220
220
& self . verifying_key
@@ -223,21 +223,21 @@ where
223
223
224
224
impl < C , Ctx > KeypairRef for EcSigner < C , Ctx >
225
225
where
226
- C : PrimeCurve + CurveArithmetic ,
227
- Scalar < C > : Invert < Output = CtOption < Scalar < C > > > + SignPrimitive < C > ,
228
- SignatureSize < C > : ArrayLength < u8 > ,
226
+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
227
+ Scalar < C > : Invert < Output = CtOption < Scalar < C > > > ,
228
+ SignatureSize < C > : ArraySize ,
229
229
{
230
230
type VerifyingKey = VerifyingKey < C > ;
231
231
}
232
232
233
233
impl < C , Ctx , D > DigestSigner < D , Signature < C > > for EcSigner < C , Ctx >
234
234
where
235
- C : PrimeCurve + CurveArithmetic ,
235
+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
236
236
C : AssociatedTpmCurve ,
237
- D : Digest + FixedOutput < OutputSize = FieldBytesSize < C > > ,
237
+ D : Digest + FixedOutput ,
238
238
D : AssociatedHashingAlgorithm ,
239
- Scalar < C > : Invert < Output = CtOption < Scalar < C > > > + SignPrimitive < C > ,
240
- SignatureSize < C > : ArrayLength < u8 > ,
239
+ Scalar < C > : Invert < Output = CtOption < Scalar < C > > > ,
240
+ SignatureSize < C > : ArraySize ,
241
241
TpmDigest : From < Output < D > > ,
242
242
Ctx : TpmSigner ,
243
243
{
@@ -261,16 +261,16 @@ where
261
261
262
262
impl < C , Ctx , D > DigestSigner < D , DerSignature < C > > for EcSigner < C , Ctx >
263
263
where
264
- C : PrimeCurve + CurveArithmetic ,
264
+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
265
265
C : AssociatedTpmCurve ,
266
- D : Digest + FixedOutput < OutputSize = FieldBytesSize < C > > ,
266
+ D : Digest + FixedOutput ,
267
267
D : AssociatedHashingAlgorithm ,
268
- Scalar < C > : Invert < Output = CtOption < Scalar < C > > > + SignPrimitive < C > ,
269
- SignatureSize < C > : ArrayLength < u8 > ,
268
+ Scalar < C > : Invert < Output = CtOption < Scalar < C > > > ,
269
+ SignatureSize < C > : ArraySize ,
270
270
TpmDigest : From < Output < D > > ,
271
271
272
- MaxSize < C > : ArrayLength < u8 > ,
273
- <FieldBytesSize < C > as Add >:: Output : Add < MaxOverhead > + ArrayLength < u8 > ,
272
+ MaxSize < C > : ArraySize ,
273
+ <FieldBytesSize < C > as Add >:: Output : Add < MaxOverhead > + ArraySize ,
274
274
275
275
Ctx : TpmSigner ,
276
276
{
@@ -282,11 +282,11 @@ where
282
282
283
283
impl < C , Ctx > Signer < Signature < C > > for EcSigner < C , Ctx >
284
284
where
285
- C : PrimeCurve + CurveArithmetic + DigestPrimitive ,
285
+ C : PrimeCurve + CurveArithmetic + EcdsaCurve + DigestPrimitive ,
286
286
C : AssociatedTpmCurve ,
287
287
<C as DigestPrimitive >:: Digest : AssociatedHashingAlgorithm ,
288
- Scalar < C > : Invert < Output = CtOption < Scalar < C > > > + SignPrimitive < C > ,
289
- SignatureSize < C > : ArrayLength < u8 > ,
288
+ Scalar < C > : Invert < Output = CtOption < Scalar < C > > > ,
289
+ SignatureSize < C > : ArraySize ,
290
290
TpmDigest : From < Output < <C as DigestPrimitive >:: Digest > > ,
291
291
292
292
Ctx : TpmSigner ,
@@ -298,15 +298,15 @@ where
298
298
299
299
impl < C , Ctx > Signer < DerSignature < C > > for EcSigner < C , Ctx >
300
300
where
301
- C : PrimeCurve + CurveArithmetic + DigestPrimitive ,
301
+ C : PrimeCurve + CurveArithmetic + EcdsaCurve + DigestPrimitive ,
302
302
C : AssociatedTpmCurve ,
303
303
<C as DigestPrimitive >:: Digest : AssociatedHashingAlgorithm ,
304
- Scalar < C > : Invert < Output = CtOption < Scalar < C > > > + SignPrimitive < C > ,
305
- SignatureSize < C > : ArrayLength < u8 > ,
304
+ Scalar < C > : Invert < Output = CtOption < Scalar < C > > > ,
305
+ SignatureSize < C > : ArraySize ,
306
306
TpmDigest : From < Output < <C as DigestPrimitive >:: Digest > > ,
307
307
308
- MaxSize < C > : ArrayLength < u8 > ,
309
- <FieldBytesSize < C > as Add >:: Output : Add < MaxOverhead > + ArrayLength < u8 > ,
308
+ MaxSize < C > : ArraySize ,
309
+ <FieldBytesSize < C > as Add >:: Output : Add < MaxOverhead > + ArraySize ,
310
310
311
311
Ctx : TpmSigner ,
312
312
{
@@ -317,9 +317,9 @@ where
317
317
318
318
impl < C , Ctx > SignatureAlgorithmIdentifier for EcSigner < C , Ctx >
319
319
where
320
- C : PrimeCurve + CurveArithmetic ,
321
- Scalar < C > : Invert < Output = CtOption < Scalar < C > > > + SignPrimitive < C > ,
322
- SignatureSize < C > : ArrayLength < u8 > ,
320
+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
321
+ Scalar < C > : Invert < Output = CtOption < Scalar < C > > > ,
322
+ SignatureSize < C > : ArraySize ,
323
323
Signature < C > : AssociatedAlgorithmIdentifier < Params = AnyRef < ' static > > ,
324
324
{
325
325
type Params = AnyRef < ' static > ;
0 commit comments