Use clearer identity check in equality

This commit is contained in:
Luke Parker 2025-01-30 00:13:55 -05:00
parent 315d4fb356
commit 3655dc723f
No known key found for this signature in database
2 changed files with 4 additions and 2 deletions
crypto/evrf
embedwards25519/src
secq256k1/src

View file

@ -46,7 +46,8 @@ impl ConstantTimeEq for Point {
let y1 = self.y * other.z;
let y2 = other.y * self.z;
(self.x.is_zero() & other.x.is_zero()) | (x1.ct_eq(&x2) & y1.ct_eq(&y2))
// Both identity or equivalent over their denominators
(self.z.is_zero() & other.z.is_zero()) | (x1.ct_eq(&x2) & y1.ct_eq(&y2))
}
}

View file

@ -40,7 +40,8 @@ impl ConstantTimeEq for Point {
let y1 = self.y * other.z;
let y2 = other.y * self.z;
(self.x.is_zero() & other.x.is_zero()) | (x1.ct_eq(&x2) & y1.ct_eq(&y2))
// Identity or equivalent
(self.z.is_zero() & other.z.is_zero()) | (x1.ct_eq(&x2) & y1.ct_eq(&y2))
}
}