diff --git a/givre/src/ciphersuite.rs b/givre/src/ciphersuite.rs index 954f5f7..e1ca167 100644 --- a/givre/src/ciphersuite.rs +++ b/givre/src/ciphersuite.rs @@ -33,7 +33,7 @@ pub use secp256k1::Secp256k1; /// For the details, refer to [Section 6] of the draft /// /// [Section 6]: https://www.ietf.org/archive/id/draft-irtf-cfrg-frost-15.html#name-ciphersuites -pub trait Ciphersuite: Sized + Clone + Copy + core::fmt::Debug { +pub trait Ciphersuite: Sized + Clone + Copy + Eq + core::fmt::Debug { /// Name of the ciphersuite, also known as `contextString` in the draft const NAME: &'static str; @@ -238,7 +238,7 @@ impl> AdditionalEntropy for &T { /// /// Point that satisfies [`Ciphersuite::is_normalized`]. Can wrap both `Point` and /// `NonZero>`. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct NormalizedPoint(P, core::marker::PhantomData); impl>> NormalizedPoint { @@ -287,12 +287,6 @@ where self.0.as_ref() } } -impl core::cmp::PartialEq for NormalizedPoint { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} -impl core::cmp::Eq for NormalizedPoint {} #[cfg(feature = "serde")] impl serde::Serialize for NormalizedPoint { diff --git a/givre/src/ciphersuite/bitcoin.rs b/givre/src/ciphersuite/bitcoin.rs index d493cec..6925a0b 100644 --- a/givre/src/ciphersuite/bitcoin.rs +++ b/givre/src/ciphersuite/bitcoin.rs @@ -6,7 +6,7 @@ use super::{Ciphersuite, Secp256k1}; /// FROST ciphersuite that outputs [BIP-340] compliant signatures /// /// [BIP-340]: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Bitcoin; impl Ciphersuite for Bitcoin { diff --git a/givre/src/ciphersuite/ed25519.rs b/givre/src/ciphersuite/ed25519.rs index dbec0e4..9da8a13 100644 --- a/givre/src/ciphersuite/ed25519.rs +++ b/givre/src/ciphersuite/ed25519.rs @@ -4,7 +4,7 @@ use generic_ec::{NonZero, Point}; use crate::Ciphersuite; /// FROST(Ed25519, SHA-512) ciphersuite that produces Ed25519-compliant signatures -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Ed25519; impl Ciphersuite for Ed25519 { diff --git a/givre/src/ciphersuite/secp256k1.rs b/givre/src/ciphersuite/secp256k1.rs index 81a4ee3..0879197 100644 --- a/givre/src/ciphersuite/secp256k1.rs +++ b/givre/src/ciphersuite/secp256k1.rs @@ -4,7 +4,7 @@ use generic_ec::{NonZero, Point}; use crate::Ciphersuite; /// FROST(secp256k1, SHA-256) ciphersuite -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Secp256k1; impl Ciphersuite for Secp256k1 { diff --git a/givre/src/signing/aggregate.rs b/givre/src/signing/aggregate.rs index 0f98c51..991f6ba 100644 --- a/givre/src/signing/aggregate.rs +++ b/givre/src/signing/aggregate.rs @@ -15,7 +15,7 @@ use crate::{ciphersuite::NormalizedPoint, Ciphersuite, SignerIndex}; use super::{round1::PublicCommitments, round2::SigShare, utils}; -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[cfg_attr( feature = "serde", derive(serde::Serialize, serde::Deserialize), @@ -86,14 +86,6 @@ impl Signature { } } -impl PartialEq for Signature { - fn eq(&self, other: &Self) -> bool { - let Signature { r, z } = self; - *r == other.r && *z == other.z - } -} -impl Eq for Signature {} - /// Aggregation options /// /// Like [`aggregate`] but allows to specify additional options like the HD derivation path