From d39cb275c5a8d8c315d916760753dc9604a015fd Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Thu, 5 Oct 2017 00:56:40 +0000 Subject: [PATCH] Remove DecafPoint.to_edwards() method. --- src/decaf.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/decaf.rs b/src/decaf.rs index 23511dd..9bc2c8a 100644 --- a/src/decaf.rs +++ b/src/decaf.rs @@ -189,16 +189,11 @@ impl<'de> Deserialize<'de> for DecafPoint { /// A point in a prime-order group. /// -/// XXX think about how this API should work +// XXX think about how this API should work #[derive(Copy, Clone)] pub struct DecafPoint(pub ExtendedPoint); impl DecafPoint { - /// Convert this `DecafPoint` to its underlying `ExtendedPoint`. - pub fn to_edwards(&self) -> ExtendedPoint { - self.0 - } - /// Compress in Decaf format. pub fn compress(&self) -> CompressedDecaf { // Q: Do we want to encode twisted or untwisted? @@ -757,7 +752,7 @@ mod test { fn decaf_decompress_id() { let compressed_id = CompressedDecaf::identity(); let id = compressed_id.decompress().unwrap(); - assert_eq!(id.to_edwards().compress(), CompressedEdwardsY::identity()); + assert_eq!(id.0.compress(), CompressedEdwardsY::identity()); } #[test] @@ -769,7 +764,7 @@ mod test { #[test] fn decaf_basepoint_roundtrip() { let bp_compressed_decaf = constants::DECAF_ED25519_BASEPOINT_POINT.compress(); - let bp_recaf = bp_compressed_decaf.decompress().unwrap().to_edwards(); + let bp_recaf = bp_compressed_decaf.decompress().unwrap().0; // Check that bp_recaf differs from bp by a point of order 4 let diff = &constants::ED25519_BASEPOINT_POINT - &bp_recaf; let diff4 = diff.mult_by_pow_2(4); // XXX this is wrong @@ -843,7 +838,7 @@ mod test { for _ in 0..100 { let P = DecafPoint::random(&mut rng); // Check that P is on the curve - assert!(P.to_edwards().is_valid()); + assert!(P.0.is_valid()); // Check that P is in the image of the decaf map P.compress(); }