diff --git a/src/dhke.rs b/src/dhke.rs index 0ab1c6c..8f524d6 100644 --- a/src/dhke.rs +++ b/src/dhke.rs @@ -18,7 +18,7 @@ use zeroize::{Zeroize, ZeroizeOnDrop}; use crate::keys::PublicKey; /// The result of a Diffie-Hellman key exchange -#[derive(PartialEq, Eq, Zeroize, ZeroizeOnDrop)] +#[derive(Zeroize, ZeroizeOnDrop)] pub struct DiffieHellmanSharedSecret
(P) where P: PublicKey; @@ -52,6 +52,16 @@ where P: PublicKey } } +impl
Eq for DiffieHellmanSharedSecret
where P: PublicKey {} + +impl
PartialEq for DiffieHellmanSharedSecret
+where P: PublicKey +{ + fn eq(&self, other: &Self) -> bool { + self.0.ct_eq(&other.0).into() + } +} + #[cfg(test)] mod test { use rand_core::OsRng;