mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-05 20:30:57 +00:00
Apply suggestion by @hdevalence
Co-Authored-By: Henry de Valence <hdevalence@hdevalence.ca>
This commit is contained in:
parent
53da2aaaf4
commit
26ae185bc9
1 changed files with 2 additions and 1 deletions
|
|
@ -190,7 +190,8 @@ impl CompressedEdwardsY {
|
||||||
|
|
||||||
if is_valid_y_coord.unwrap_u8() != 1u8 { return None; }
|
if is_valid_y_coord.unwrap_u8() != 1u8 { return None; }
|
||||||
|
|
||||||
// Flip the sign of X if it's not correct
|
// FieldElement::sqrt_ratio_i always returns the nonnegative square root,
|
||||||
|
// so we negate according to the supplied sign bit.
|
||||||
let compressed_sign_bit = Choice::from(self.as_bytes()[31] >> 7);
|
let compressed_sign_bit = Choice::from(self.as_bytes()[31] >> 7);
|
||||||
X.conditional_negate(compressed_sign_bit);
|
X.conditional_negate(compressed_sign_bit);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue