@@ -24,11 +24,11 @@ use std::{convert::TryFrom, ops::Add, sync::Mutex};
2424use digest:: { Digest , FixedOutput , Output } ;
2525use ecdsa:: {
2626 der:: { MaxOverhead , MaxSize , Signature as DerSignature } ,
27- hazmat:: { DigestPrimitive , SignPrimitive } ,
28- Signature , SignatureSize , VerifyingKey ,
27+ hazmat:: DigestPrimitive ,
28+ EcdsaCurve , Signature , SignatureSize , VerifyingKey ,
2929} ;
3030use elliptic_curve:: {
31- generic_array :: ArrayLength ,
31+ array :: ArraySize ,
3232 ops:: Invert ,
3333 sec1:: { FromEncodedPoint , ModulusSize , ToEncodedPoint } ,
3434 subtle:: CtOption ,
@@ -139,15 +139,15 @@ impl TpmSigner
139139#[ derive( Debug ) ]
140140pub struct EcSigner < C , Ctx >
141141where
142- C : PrimeCurve + CurveArithmetic ,
142+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
143143{
144144 context : Ctx ,
145145 verifying_key : VerifyingKey < C > ,
146146}
147147
148148impl < C , Ctx > EcSigner < C , Ctx >
149149where
150- C : PrimeCurve + CurveArithmetic ,
150+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
151151 C : AssociatedTpmCurve ,
152152 FieldBytesSize < C > : ModulusSize ,
153153 AffinePoint < C > : FromEncodedPoint < C > + ToEncodedPoint < C > ,
@@ -179,14 +179,14 @@ where
179179
180180impl < C , Ctx > EcSigner < C , Ctx >
181181where
182- C : PrimeCurve + CurveArithmetic ,
182+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
183183 C : AssociatedTpmCurve ,
184184{
185185 /// Key parameters for this curve, selected digest is the one selected by DigestPrimitive
186186 pub fn key_params_default ( ) -> KeyParams
187187 where
188188 C : DigestPrimitive ,
189- <C as DigestPrimitive >:: Digest : FixedOutput < OutputSize = FieldBytesSize < C > > ,
189+ <C as DigestPrimitive >:: Digest : FixedOutput ,
190190 <C as DigestPrimitive >:: Digest : AssociatedHashingAlgorithm ,
191191 {
192192 Self :: key_params :: < <C as DigestPrimitive >:: Digest > ( )
@@ -199,7 +199,7 @@ where
199199 /// The hashing algorithm `D` is the digest that will be used for signatures (SHA-256, SHA3-256, ...).
200200 pub fn key_params < D > ( ) -> KeyParams
201201 where
202- D : FixedOutput < OutputSize = FieldBytesSize < C > > ,
202+ D : FixedOutput ,
203203 D : AssociatedHashingAlgorithm ,
204204 {
205205 KeyParams :: Ecc {
@@ -212,9 +212,9 @@ where
212212
213213impl < C , Ctx > AsRef < VerifyingKey < C > > for EcSigner < C , Ctx >
214214where
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 ,
218218{
219219 fn as_ref ( & self ) -> & VerifyingKey < C > {
220220 & self . verifying_key
@@ -223,21 +223,21 @@ where
223223
224224impl < C , Ctx > KeypairRef for EcSigner < C , Ctx >
225225where
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 ,
229229{
230230 type VerifyingKey = VerifyingKey < C > ;
231231}
232232
233233impl < C , Ctx , D > DigestSigner < D , Signature < C > > for EcSigner < C , Ctx >
234234where
235- C : PrimeCurve + CurveArithmetic ,
235+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
236236 C : AssociatedTpmCurve ,
237- D : Digest + FixedOutput < OutputSize = FieldBytesSize < C > > ,
237+ D : Digest + FixedOutput ,
238238 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 ,
241241 TpmDigest : From < Output < D > > ,
242242 Ctx : TpmSigner ,
243243{
@@ -261,16 +261,16 @@ where
261261
262262impl < C , Ctx , D > DigestSigner < D , DerSignature < C > > for EcSigner < C , Ctx >
263263where
264- C : PrimeCurve + CurveArithmetic ,
264+ C : PrimeCurve + CurveArithmetic + EcdsaCurve ,
265265 C : AssociatedTpmCurve ,
266- D : Digest + FixedOutput < OutputSize = FieldBytesSize < C > > ,
266+ D : Digest + FixedOutput ,
267267 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 ,
270270 TpmDigest : From < Output < D > > ,
271271
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 ,
274274
275275 Ctx : TpmSigner ,
276276{
@@ -282,11 +282,11 @@ where
282282
283283impl < C , Ctx > Signer < Signature < C > > for EcSigner < C , Ctx >
284284where
285- C : PrimeCurve + CurveArithmetic + DigestPrimitive ,
285+ C : PrimeCurve + CurveArithmetic + EcdsaCurve + DigestPrimitive ,
286286 C : AssociatedTpmCurve ,
287287 <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 ,
290290 TpmDigest : From < Output < <C as DigestPrimitive >:: Digest > > ,
291291
292292 Ctx : TpmSigner ,
@@ -298,15 +298,15 @@ where
298298
299299impl < C , Ctx > Signer < DerSignature < C > > for EcSigner < C , Ctx >
300300where
301- C : PrimeCurve + CurveArithmetic + DigestPrimitive ,
301+ C : PrimeCurve + CurveArithmetic + EcdsaCurve + DigestPrimitive ,
302302 C : AssociatedTpmCurve ,
303303 <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 ,
306306 TpmDigest : From < Output < <C as DigestPrimitive >:: Digest > > ,
307307
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 ,
310310
311311 Ctx : TpmSigner ,
312312{
@@ -317,9 +317,9 @@ where
317317
318318impl < C , Ctx > SignatureAlgorithmIdentifier for EcSigner < C , Ctx >
319319where
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 ,
323323 Signature < C > : AssociatedAlgorithmIdentifier < Params = AnyRef < ' static > > ,
324324{
325325 type Params = AnyRef < ' static > ;
0 commit comments