4
4
use crate :: curve:: twedwards:: { affine:: AffinePoint , extended:: ExtendedPoint } ;
5
5
use crate :: edwards:: EdwardsPoint as EdwardsExtendedPoint ;
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)
@@ -20,6 +20,17 @@ pub struct ExtensiblePoint {
20
20
pub ( crate ) T2 : FieldElement ,
21
21
}
22
22
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
+ }
23
34
impl ConstantTimeEq for ExtensiblePoint {
24
35
fn ct_eq ( & self , other : & Self ) -> Choice {
25
36
let XZ = self . X * other. Z ;
0 commit comments