4
4
use super :: affine:: AffinePoint ;
5
5
use super :: extended:: ExtendedPoint ;
6
6
use crate :: field:: FieldElement ;
7
- use subtle:: { Choice , ConstantTimeEq } ;
7
+ use subtle:: { Choice , ConditionallySelectable , ConstantTimeEq } ;
8
8
9
9
/// This is the representation that we will do most of the group operations on.
10
10
// In affine (x,y) is the extensible point (X, Y, Z, T1, T2)
@@ -31,6 +31,17 @@ impl ConstantTimeEq for ExtensiblePoint {
31
31
XZ . ct_eq ( & ZX ) & YZ . ct_eq ( & ZY )
32
32
}
33
33
}
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
+ }
34
45
impl PartialEq for ExtensiblePoint {
35
46
fn eq ( & self , other : & ExtensiblePoint ) -> bool {
36
47
self . ct_eq ( other) . into ( )
0 commit comments