mirror of
https://github.com/saymrwulf/risc0-curve25519-dalek-source.git
synced 2026-09-04 20:03:40 +00:00
Remove unneeded check for negativity in edwards point decompression
The function `FieldElement::sqrt_ratio_i` always returns a positive root by definition. Therefore the test for negativity in the edwards point decompression function always returns false and we only need to flip its sign if `compressed_sign_bit` is set.
This commit is contained in:
parent
a659b92305
commit
53da2aaaf4
1 changed files with 1 additions and 3 deletions
|
|
@ -192,9 +192,7 @@ impl CompressedEdwardsY {
|
|||
|
||||
// Flip the sign of X if it's not correct
|
||||
let compressed_sign_bit = Choice::from(self.as_bytes()[31] >> 7);
|
||||
let current_sign_bit = X.is_negative();
|
||||
|
||||
X.conditional_negate(current_sign_bit ^ compressed_sign_bit);
|
||||
X.conditional_negate(compressed_sign_bit);
|
||||
|
||||
Some(EdwardsPoint{ X: X, Y: Y, Z: Z, T: &X * &Y })
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue