@@ -7,6 +7,7 @@ use crate::{
77 BatchNormalize , Curve , CurveArithmetic , CurveGroup , FieldBytesEncoding , PrimeCurve ,
88 array:: typenum:: U32 ,
99 bigint:: { Limb , Odd , U256 } ,
10+ ctutils,
1011 error:: { Error , Result } ,
1112 ops:: { Invert , LinearCombination , Reduce , ShrAssign } ,
1213 point:: { AffineCoordinates , NonIdentity } ,
@@ -516,14 +517,14 @@ impl From<NonIdentity<AffinePoint>> for AffinePoint {
516517}
517518
518519impl FromEncodedPoint < MockCurve > for AffinePoint {
519- fn from_encoded_point ( encoded_point : & EncodedPoint ) -> CtOption < Self > {
520+ fn from_encoded_point ( encoded_point : & EncodedPoint ) -> ctutils :: CtOption < Self > {
520521 let point = if encoded_point. is_identity ( ) {
521522 Self :: Identity
522523 } else {
523524 Self :: Other ( * encoded_point)
524525 } ;
525526
526- CtOption :: new ( point, Choice :: from ( 1 ) )
527+ ctutils :: CtOption :: new ( point, ctutils :: Choice :: TRUE )
527528 }
528529}
529530
@@ -642,7 +643,7 @@ impl From<ProjectivePoint> for AffinePoint {
642643}
643644
644645impl FromEncodedPoint < MockCurve > for ProjectivePoint {
645- fn from_encoded_point ( _point : & EncodedPoint ) -> CtOption < Self > {
646+ fn from_encoded_point ( _point : & EncodedPoint ) -> ctutils :: CtOption < Self > {
646647 unimplemented ! ( ) ;
647648 }
648649}
@@ -690,12 +691,14 @@ impl group::GroupEncoding for AffinePoint {
690691
691692 fn from_bytes ( bytes : & Self :: Repr ) -> CtOption < Self > {
692693 EncodedPoint :: from_bytes ( bytes)
693- . map ( |point| CtOption :: new ( point, Choice :: from ( 1 ) ) )
694+ . map ( |point| ctutils :: CtOption :: new ( point, ctutils :: Choice :: TRUE ) )
694695 . unwrap_or_else ( |_| {
695- let is_identity = bytes. ct_eq ( & Self :: Repr :: default ( ) ) ;
696- CtOption :: new ( EncodedPoint :: identity ( ) , is_identity)
696+ let is_identity =
697+ ctutils:: CtEq :: ct_eq ( bytes. as_slice ( ) , Self :: Repr :: default ( ) . as_slice ( ) ) ;
698+ ctutils:: CtOption :: new ( EncodedPoint :: identity ( ) , is_identity)
697699 } )
698700 . and_then ( |point| Self :: from_encoded_point ( & point) )
701+ . into ( )
699702 }
700703
701704 fn from_bytes_unchecked ( bytes : & Self :: Repr ) -> CtOption < Self > {
0 commit comments