@@ -3,7 +3,7 @@ use crate::{AffinePoint, FieldBytes, NistP384, ProjectivePoint, Scalar};
33use elliptic_curve:: {
44 array:: Array ,
55 bigint:: { ArrayEncoding , U384 } ,
6- consts:: U72 ,
6+ consts:: { U24 , U72 } ,
77 hash2curve:: { FromOkm , GroupDigest , MapToCurve , OsswuMap , OsswuMapParams , Sgn0 } ,
88 ops:: Reduce ,
99 point:: DecompressPoint ,
@@ -12,6 +12,8 @@ use elliptic_curve::{
1212
1313impl GroupDigest for NistP384 {
1414 type FieldElement = FieldElement ;
15+
16+ type K = U24 ;
1517}
1618
1719impl FromOkm for FieldElement {
@@ -203,11 +205,10 @@ mod tests {
203205 for test_vector in TEST_VECTORS {
204206 // in parts
205207 let mut u = [ FieldElement :: default ( ) , FieldElement :: default ( ) ] ;
206- hash2curve:: hash_to_field :: < ExpandMsgXmd < Sha384 > , FieldElement > (
207- & [ test_vector. msg ] ,
208- & [ DST ] ,
209- & mut u,
210- )
208+ hash2curve:: hash_to_field :: <
209+ ExpandMsgXmd < Sha384 , <NistP384 as GroupDigest >:: K > ,
210+ FieldElement ,
211+ > ( & [ test_vector. msg ] , & [ DST ] , & mut u)
211212 . unwrap ( ) ;
212213
213214 /// Assert that the provided projective point matches the given test vector.
@@ -238,7 +239,11 @@ mod tests {
238239 assert_point_eq ! ( p, test_vector. p_x, test_vector. p_y) ;
239240
240241 // complete run
241- let pt = NistP384 :: hash_from_bytes :: < ExpandMsgXmd < Sha384 > > ( & [ test_vector. msg ] , & [ DST ] )
242+ let pt =
243+ NistP384 :: hash_from_bytes :: < ExpandMsgXmd < Sha384 , <NistP384 as GroupDigest >:: K > > (
244+ & [ test_vector. msg ] ,
245+ & [ DST ] ,
246+ )
242247 . unwrap ( ) ;
243248 assert_point_eq ! ( pt, test_vector. p_x, test_vector. p_y) ;
244249 }
@@ -287,16 +292,17 @@ mod tests {
287292 . to_be_bytes ( ) ;
288293
289294 for counter in 0_u8 ..=u8:: MAX {
290- let scalar = NistP384 :: hash_to_scalar :: < ExpandMsgXmd < Sha384 > > (
291- & [
292- test_vector. seed ,
293- & key_info_len,
294- test_vector. key_info ,
295- & counter. to_be_bytes ( ) ,
296- ] ,
297- & [ test_vector. dst ] ,
298- )
299- . unwrap ( ) ;
295+ let scalar =
296+ NistP384 :: hash_to_scalar :: < ExpandMsgXmd < Sha384 , <NistP384 as GroupDigest >:: K > > (
297+ & [
298+ test_vector. seed ,
299+ & key_info_len,
300+ test_vector. key_info ,
301+ & counter. to_be_bytes ( ) ,
302+ ] ,
303+ & [ test_vector. dst ] ,
304+ )
305+ . unwrap ( ) ;
300306
301307 if !bool:: from ( scalar. is_zero ( ) ) {
302308 assert_eq ! ( scalar. to_bytes( ) . as_slice( ) , test_vector. sk_sm) ;
0 commit comments