Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion elliptic-curve/src/point/non_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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<P> {
point: P,
}
Expand Down
11 changes: 11 additions & 0 deletions elliptic-curve/src/scalar/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ where
}
}

impl<C> Eq for NonZeroScalar<C> where C: CurveArithmetic {}

impl<C> From<NonZeroScalar<C>> for FieldBytes<C>
where
C: CurveArithmetic,
Expand Down Expand Up @@ -256,6 +258,15 @@ where
}
}

impl<C> PartialEq for NonZeroScalar<C>
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<C, I> Reduce<I> for NonZeroScalar<C>
where
Expand Down