From f9d4a223c48e5f9fe161f6a9a47c806c0752835b Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Fri, 25 May 2018 12:11:16 -0700 Subject: derive Eq and PartialEq too --- src/spake2.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/spake2.rs b/src/spake2.rs index 07c92a3..31be328 100644 --- a/src/spake2.rs +++ b/src/spake2.rs @@ -13,14 +13,14 @@ use std::fmt; //use hex::ToHex; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum ErrorType { BadSide, WrongLength, CorruptMessage, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct SPAKEErr { pub kind: ErrorType, } @@ -49,7 +49,7 @@ pub trait Group { fn add(a: &Self::Element, b: &Self::Element) -> Self::Element; } -#[derive(Debug)] +#[derive(Debug, PartialEq, Eq)] pub struct Ed25519Group; impl Group for Ed25519Group { @@ -257,13 +257,15 @@ fn ed25519_hash_symmetric( /* "session type pattern" */ -#[derive(Debug)] +#[derive(Debug, PartialEq, Eq)] enum Side { A, B, Symmetric, } +// we implement a custom Debug below, to avoid revealing secrets in a dump +#[derive(PartialEq, Eq)] pub struct SPAKE2 { //where &G::Scalar: Neg { side: Side, -- cgit v1.2.3