44use crate :: curve:: twedwards:: { affine:: AffinePoint , extended:: ExtendedPoint } ;
55use crate :: edwards:: EdwardsPoint as EdwardsExtendedPoint ;
66use crate :: field:: FieldElement ;
7- use subtle:: { Choice , ConstantTimeEq } ;
7+ use subtle:: { Choice , ConditionallySelectable , ConstantTimeEq } ;
88
99/// This is the representation that we will do most of the group operations on.
1010// In affine (x,y) is the extensible point (X, Y, Z, T1, T2)
@@ -20,6 +20,17 @@ pub struct ExtensiblePoint {
2020 pub ( crate ) T2 : FieldElement ,
2121}
2222
23+ impl ConditionallySelectable for ExtensiblePoint {
24+ fn conditional_select ( a : & Self , b : & Self , choice : Choice ) -> Self {
25+ Self {
26+ X : FieldElement :: conditional_select ( & a. X , & b. X , choice) ,
27+ Y : FieldElement :: conditional_select ( & a. Y , & b. Y , choice) ,
28+ Z : FieldElement :: conditional_select ( & a. Z , & b. Z , choice) ,
29+ T1 : FieldElement :: conditional_select ( & a. T1 , & b. T1 , choice) ,
30+ T2 : FieldElement :: conditional_select ( & a. T2 , & b. T2 , choice) ,
31+ }
32+ }
33+ }
2334impl ConstantTimeEq for ExtensiblePoint {
2435 fn ct_eq ( & self , other : & Self ) -> Choice {
2536 let XZ = self . X * other. Z ;
0 commit comments