Use conditional_negate in select_precomputed_point

This commit is contained in:
Henry de Valence 2017-02-20 15:22:28 -08:00
parent 8a1c13ef49
commit dc5621f527

View file

@ -87,6 +87,7 @@ use field::FieldElement;
use scalar::Scalar; use scalar::Scalar;
use util::bytes_equal_ct; use util::bytes_equal_ct;
use util::CTAssignable; use util::CTAssignable;
use util::CTNegateable;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Compressed points // Compressed points
@ -734,9 +735,8 @@ fn select_precomputed_point<T>(x: i8, points: &[T; 8]) -> T
} }
// Now t == |x| * P. // Now t == |x| * P.
let minus_t = -(&t);
let neg_mask = (xmask & 1) as u8; let neg_mask = (xmask & 1) as u8;
t.conditional_assign(&minus_t, neg_mask); t.conditional_negate(neg_mask);
// Now t == x * P. // Now t == x * P.
t t