aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Warner <warner@lothar.com>2018-05-25 12:11:16 -0700
committerBrian Warner <warner@lothar.com>2018-05-25 12:11:16 -0700
commitf9d4a223c48e5f9fe161f6a9a47c806c0752835b (patch)
treeb8f3fad4b718d16623d97452b757937c76ab961c
parent6b8be3f04ee580c7962f508c5725865f14ef0951 (diff)
downloadPAKEs-f9d4a223c48e5f9fe161f6a9a47c806c0752835b.tar.xz
derive Eq and PartialEq too
-rw-r--r--src/spake2.rs10
1 files 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<G: Group> {
//where &G::Scalar: Neg {
side: Side,