diff --git a/elliptic-curve/src/point/non_identity.rs b/elliptic-curve/src/point/non_identity.rs index d76463e8..f938a2eb 100644 --- a/elliptic-curve/src/point/non_identity.rs +++ b/elliptic-curve/src/point/non_identity.rs @@ -17,7 +17,7 @@ use crate::{CurveArithmetic, NonZeroScalar, Scalar}; /// /// In the context of ECC, it's useful for ensuring that certain arithmetic /// cannot result in the identity point. -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct NonIdentity

{ point: P, } diff --git a/elliptic-curve/src/scalar/nonzero.rs b/elliptic-curve/src/scalar/nonzero.rs index 4d2e4c51..550ef183 100644 --- a/elliptic-curve/src/scalar/nonzero.rs +++ b/elliptic-curve/src/scalar/nonzero.rs @@ -128,6 +128,8 @@ where } } +impl Eq for NonZeroScalar where C: CurveArithmetic {} + impl From> for FieldBytes where C: CurveArithmetic, @@ -256,6 +258,15 @@ where } } +impl PartialEq for NonZeroScalar +where + C: CurveArithmetic, +{ + fn eq(&self, other: &Self) -> bool { + self.scalar.eq(&other.scalar) + } +} + /// Note: this is a non-zero reduction, as it's impl'd for [`NonZeroScalar`]. impl Reduce for NonZeroScalar where