@@ -170,12 +170,11 @@ where
170170impl < H , I > fmt:: Debug for HkdfExtract < H , I >
171171where
172172 H : OutputSizeUser ,
173- I : HmacImpl < H > ,
174- I :: Core : AlgorithmName ,
173+ I : HmacImpl < H > + AlgorithmName ,
175174{
176175 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
177176 f. write_str ( "HkdfExtract<" ) ?;
178- <I :: Core as AlgorithmName >:: write_alg_name ( f) ?;
177+ <I as AlgorithmName >:: write_alg_name ( f) ?;
179178 f. write_str ( "> { ... }" )
180179 }
181180}
@@ -185,7 +184,7 @@ where
185184/// [crate root](index.html#usage).
186185#[ derive( Clone ) ]
187186pub struct Hkdf < H : OutputSizeUser , I : HmacImpl < H > = Hmac < H > > {
188- hmac : I :: Core ,
187+ hmac : I ,
189188 _pd : PhantomData < H > ,
190189}
191190
@@ -206,7 +205,7 @@ impl<H: OutputSizeUser, I: HmacImpl<H>> Hkdf<H, I> {
206205 return Err ( InvalidPrkLength ) ;
207206 }
208207 Ok ( Self {
209- hmac : I :: new_core ( prk) ,
208+ hmac : I :: new_from_slice ( prk) ,
210209 _pd : PhantomData ,
211210 } )
212211 }
@@ -235,7 +234,7 @@ impl<H: OutputSizeUser, I: HmacImpl<H>> Hkdf<H, I> {
235234 }
236235
237236 for ( block_n, block) in okm. chunks_mut ( chunk_len) . enumerate ( ) {
238- let mut hmac = I :: from_core ( & self . hmac ) ;
237+ let mut hmac = self . hmac . clone ( ) ;
239238
240239 if let Some ( ref prev) = prev {
241240 hmac. update ( prev)
@@ -272,16 +271,16 @@ impl<H, I> fmt::Debug for Hkdf<H, I>
272271where
273272 H : OutputSizeUser ,
274273 I : HmacImpl < H > ,
275- I :: Core : AlgorithmName ,
274+ I : AlgorithmName ,
276275{
277276 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
278277 f. write_str ( "Hkdf<" ) ?;
279- <I :: Core as AlgorithmName >:: write_alg_name ( f) ?;
278+ <I as AlgorithmName >:: write_alg_name ( f) ?;
280279 f. write_str ( "> { ... }" )
281280 }
282281}
283282
284283/// Sealed trait implemented for [`Hmac`] and [`SimpleHmac`].
285- pub trait HmacImpl < H : OutputSizeUser > : sealed:: Sealed < H > { }
284+ pub trait HmacImpl < H : OutputSizeUser > : sealed:: Sealed < H > + Clone { }
286285
287- impl < H : OutputSizeUser , T : sealed:: Sealed < H > > HmacImpl < H > for T { }
286+ impl < H : OutputSizeUser , T : sealed:: Sealed < H > + Clone > HmacImpl < H > for T { }
0 commit comments