44use super :: affine:: AffinePoint ;
55use super :: extended:: ExtendedPoint ;
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)
@@ -31,6 +31,17 @@ impl ConstantTimeEq for ExtensiblePoint {
3131 XZ . ct_eq ( & ZX ) & YZ . ct_eq ( & ZY )
3232 }
3333}
34+ impl ConditionallySelectable for ExtensiblePoint {
35+ fn conditional_select ( a : & Self , b : & Self , choice : Choice ) -> Self {
36+ Self {
37+ X : FieldElement :: conditional_select ( & a. X , & b. X , choice) ,
38+ Y : FieldElement :: conditional_select ( & a. Y , & b. Y , choice) ,
39+ Z : FieldElement :: conditional_select ( & a. Z , & b. Z , choice) ,
40+ T1 : FieldElement :: conditional_select ( & a. T1 , & b. T1 , choice) ,
41+ T2 : FieldElement :: conditional_select ( & a. T2 , & b. T2 , choice) ,
42+ }
43+ }
44+ }
3445impl PartialEq for ExtensiblePoint {
3546 fn eq ( & self , other : & ExtensiblePoint ) -> bool {
3647 self . ct_eq ( other) . into ( )
0 commit comments