@@ -66,13 +66,13 @@ where
6666 /// Generate a random [`ScalarValue`].
6767 pub fn random < R : CryptoRng + ?Sized > ( rng : & mut R ) -> Self {
6868 Self {
69- inner : C :: Uint :: random_mod ( rng, Self :: MODULUS . as_nz_ref ( ) ) ,
69+ inner : C :: Uint :: random_mod_vartime ( rng, Self :: MODULUS . as_nz_ref ( ) ) ,
7070 }
7171 }
7272
7373 /// Create a new scalar from [`Curve::Uint`].
7474 pub fn new ( uint : C :: Uint ) -> CtOption < Self > {
75- CtOption :: new ( Self { inner : uint } , uint. ct_lt ( & Self :: MODULUS ) )
75+ CtOption :: new ( Self { inner : uint } , uint. ct_lt ( & Self :: MODULUS ) . into ( ) )
7676 }
7777
7878 /// Decode [`ScalarValue`] from a serialized field element
@@ -98,17 +98,17 @@ where
9898
9999 /// Is this [`ScalarValue`] value equal to zero?
100100 pub fn is_zero ( & self ) -> Choice {
101- self . inner . is_zero ( )
101+ self . inner . is_zero ( ) . into ( )
102102 }
103103
104104 /// Is this [`ScalarValue`] value even?
105105 pub fn is_even ( & self ) -> Choice {
106- self . inner . is_even ( )
106+ self . inner . is_even ( ) . into ( )
107107 }
108108
109109 /// Is this [`ScalarValue`] value odd?
110110 pub fn is_odd ( & self ) -> Choice {
111- self . inner . is_odd ( )
111+ self . inner . is_odd ( ) . into ( )
112112 }
113113
114114 /// Encode [`ScalarValue`] as a serialized field element.
@@ -160,7 +160,7 @@ where
160160{
161161 fn conditional_select ( a : & Self , b : & Self , choice : Choice ) -> Self {
162162 Self {
163- inner : C :: Uint :: conditional_select ( & a. inner , & b. inner , choice) ,
163+ inner : C :: Uint :: ct_select ( & a. inner , & b. inner , choice. into ( ) ) ,
164164 }
165165 }
166166}
@@ -170,7 +170,7 @@ where
170170 C : Curve ,
171171{
172172 fn ct_eq ( & self , other : & Self ) -> Choice {
173- self . inner . ct_eq ( & other. inner )
173+ self . inner . ct_eq ( & other. inner ) . into ( )
174174 }
175175}
176176
@@ -179,7 +179,7 @@ where
179179 C : Curve ,
180180{
181181 fn ct_lt ( & self , other : & Self ) -> Choice {
182- self . inner . ct_lt ( & other. inner )
182+ self . inner . ct_lt ( & other. inner ) . into ( )
183183 }
184184}
185185
@@ -188,7 +188,7 @@ where
188188 C : Curve ,
189189{
190190 fn ct_gt ( & self , other : & Self ) -> Choice {
191- self . inner . ct_gt ( & other. inner )
191+ self . inner . ct_gt ( & other. inner ) . into ( )
192192 }
193193}
194194
@@ -357,7 +357,7 @@ where
357357{
358358 fn is_high ( & self ) -> Choice {
359359 let n_2 = Self :: MODULUS . get ( ) >> 1u32 ;
360- self . inner . ct_gt ( & n_2)
360+ self . inner . ct_gt ( & n_2) . into ( )
361361 }
362362}
363363
0 commit comments