@@ -25,11 +25,10 @@ use num_integer::Integer;
2525use num_traits:: { One , ToPrimitive , Zero } ;
2626use once_cell:: unsync:: Lazy ;
2727use p256_:: elliptic_curve:: group:: prime:: PrimeCurveAffine ;
28- use p256_:: elliptic_curve:: group:: GroupEncoding ;
2928use p256_:: elliptic_curve:: ops:: Reduce ;
3029use p256_:: elliptic_curve:: sec1:: { FromEncodedPoint , ToEncodedPoint } ;
3130use p256_:: elliptic_curve:: Field ;
32- use p256_:: { AffinePoint , EncodedPoint , NistP256 , ProjectivePoint , Scalar , SecretKey } ;
31+ use p256_:: { AffinePoint , EncodedPoint , NistP256 , ProjectivePoint , PublicKey , Scalar , SecretKey } ;
3332use rand_core:: { CryptoRng , RngCore } ;
3433use subtle:: { Choice , ConditionallySelectable } ;
3534
@@ -162,10 +161,10 @@ impl Group for NistP256 {
162161 Option :: from ( scalar. invert ( ) ) . unwrap ( )
163162 }
164163
165- fn from_element_slice_unchecked (
166- element_bits : & GenericArray < u8 , Self :: ElemLen > ,
167- ) -> Result < Self :: Elem > {
168- Option :: from ( ProjectivePoint :: from_bytes ( element_bits ) ) . ok_or ( Error :: PointError )
164+ fn deserialize_elem ( element_bits : & GenericArray < u8 , Self :: ElemLen > ) -> Result < Self :: Elem > {
165+ PublicKey :: from_sec1_bytes ( element_bits )
166+ . map ( |public_key| public_key . to_projective ( ) )
167+ . map_err ( |_| Error :: PointError )
169168 }
170169
171170 fn to_arr ( elem : Self :: Elem ) -> GenericArray < u8 , Self :: ElemLen > {
0 commit comments