From 26ae185bc9a7efe5eb0ce8ef1eede7a64bb9ff1f Mon Sep 17 00:00:00 2001 From: Fabian Drinck Date: Wed, 7 Aug 2019 19:43:10 +0200 Subject: [PATCH] Apply suggestion by @hdevalence Co-Authored-By: Henry de Valence --- src/edwards.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/edwards.rs b/src/edwards.rs index d8f83a5..3f9e1e3 100644 --- a/src/edwards.rs +++ b/src/edwards.rs @@ -190,7 +190,8 @@ impl CompressedEdwardsY { 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); X.conditional_negate(compressed_sign_bit);