diff --git a/Cargo.toml b/Cargo.toml index 3562f0d..a437e7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "curve25519-dalek" -version = "1.0.2" +version = "1.0.3" authors = ["Isis Lovecruft ", "Henry de Valence "] readme = "README.md" diff --git a/src/edwards.rs b/src/edwards.rs index b37a9da..b750573 100644 --- a/src/edwards.rs +++ b/src/edwards.rs @@ -142,6 +142,12 @@ use traits::VartimeMultiscalarMul; #[derive(Copy, Clone, Eq, PartialEq)] pub struct CompressedEdwardsY(pub [u8; 32]); +impl ConstantTimeEq for CompressedEdwardsY { + fn ct_eq(&self, other: &CompressedEdwardsY) -> Choice { + self.as_bytes().ct_eq(other.as_bytes()) + } +} + impl Debug for CompressedEdwardsY { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { write!(f, "CompressedEdwardsY: {:?}", self.as_bytes()) @@ -377,9 +383,7 @@ impl ConditionallySelectable for EdwardsPoint { impl ConstantTimeEq for EdwardsPoint { fn ct_eq(&self, other: &EdwardsPoint) -> Choice { - self.compress() - .as_bytes() - .ct_eq(other.compress().as_bytes()) + self.compress().ct_eq(&other.compress()) } } diff --git a/src/ristretto.rs b/src/ristretto.rs index 234af93..dd1b3a5 100644 --- a/src/ristretto.rs +++ b/src/ristretto.rs @@ -202,6 +202,12 @@ use traits::{MultiscalarMul, VartimeMultiscalarMul}; #[derive(Copy, Clone, Eq, PartialEq)] pub struct CompressedRistretto(pub [u8; 32]); +impl ConstantTimeEq for CompressedRistretto { + fn ct_eq(&self, other: &CompressedRistretto) -> Choice { + self.as_bytes().ct_eq(other.as_bytes()) + } +} + impl CompressedRistretto { /// Copy the bytes of this `CompressedRistretto`. pub fn to_bytes(&self) -> [u8; 32] {