mirror of
https://github.com/saymrwulf/risc0-curve25519-dalek-source.git
synced 2026-09-06 20:20:39 +00:00
Remove DecafPoint.to_edwards() method.
This commit is contained in:
parent
cb98a23230
commit
d39cb275c5
1 changed files with 4 additions and 9 deletions
13
src/decaf.rs
13
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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue