Implement Default for remaining point types.

* FIXES https://github.com/dalek-cryptography/curve25519-dalek/issues/154
This commit is contained in:
Isis Lovecruft 2018-07-20 00:47:33 +00:00
parent 9105d0977a
commit 38aa0ee2b7
Failed to extract signature
3 changed files with 30 additions and 0 deletions

View file

@ -257,6 +257,12 @@ impl Identity for CompressedEdwardsY {
} }
} }
impl Default for CompressedEdwardsY {
fn default() -> CompressedEdwardsY {
CompressedEdwardsY::identity()
}
}
impl Identity for EdwardsPoint { impl Identity for EdwardsPoint {
fn identity() -> EdwardsPoint { fn identity() -> EdwardsPoint {
EdwardsPoint{ X: FieldElement::zero(), EdwardsPoint{ X: FieldElement::zero(),
@ -266,6 +272,12 @@ impl Identity for EdwardsPoint {
} }
} }
impl Default for EdwardsPoint {
fn default() -> EdwardsPoint {
EdwardsPoint::identity()
}
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Validity checks (for debugging, not CT) // Validity checks (for debugging, not CT)
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------

View file

@ -155,6 +155,12 @@ impl Identity for ProjectivePoint {
} }
} }
impl Default for ProjectivePoint {
fn default() -> ProjectivePoint {
ProjectivePoint::identity()
}
}
impl ConditionallyAssignable for ProjectivePoint { impl ConditionallyAssignable for ProjectivePoint {
fn conditional_assign(&mut self, that: &ProjectivePoint, choice: Choice) { fn conditional_assign(&mut self, that: &ProjectivePoint, choice: Choice) {
self.U.conditional_assign(&that.U, choice); self.U.conditional_assign(&that.U, choice);

View file

@ -279,6 +279,12 @@ impl Identity for CompressedRistretto {
} }
} }
impl Default for CompressedRistretto {
fn default() -> CompressedRistretto {
CompressedRistretto::identity()
}
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Serde support // Serde support
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -661,6 +667,12 @@ impl Identity for RistrettoPoint {
} }
} }
impl Default for RistrettoPoint {
fn default() -> RistrettoPoint {
RistrettoPoint::identity()
}
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Equality // Equality
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------