Skip to content

Commit

Permalink
add proper is_on_curve is_identity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dragan2234 committed Mar 29, 2024
1 parent 38076b7 commit ca87ba3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bandersnatch/te_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl BandersnatchTEAffine {

/// Determines if this point is the identity.
pub fn is_identity(&self) -> Choice {
BandersnatchTE::from(*self).is_identity()
self.x.is_zero() & self.y.is_zero()
}

pub fn generator() -> Self {
Expand Down Expand Up @@ -727,7 +727,7 @@ impl CurveAffine for BandersnatchTEAffine {
let ax2 = self.x.square() * TE_A_PARAMETER;
let y2 = self.y.square();

(ax2 + y2).ct_eq(&(Fp::one() + TE_D_PARAMETER * x2 * y2))
(ax2 + y2).ct_eq(&(Fp::one() + TE_D_PARAMETER * x2 * y2)) | self.is_identity()
}

fn coordinates(&self) -> CtOption<Coordinates<Self>> {
Expand Down

0 comments on commit ca87ba3

Please sign in to comment.