Skip to content

Commit

Permalink
clean up and get things organized for release
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwample committed Jun 26, 2024
1 parent 3a06819 commit 240b93d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
13 changes: 9 additions & 4 deletions curve25519-elligator2/src/elligator2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub trait MapToPointVariant {
}
}

/// Converts to/from a point on elliptic curve E (Curve25519) given an element of
/// Converts between a point on elliptic curve E (Curve25519) and an element of
/// the finite field F over which E is defined. See section 6.7.1 of
/// [RFC 9380 specification](https://datatracker.ietf.org/doc/rfc9380/).
///
Expand Down Expand Up @@ -205,6 +205,11 @@ impl MapToPointVariant for RFC9380 {
}
}

/// Converts between a point on elliptic curve E (Curve25519) and an element of
/// the finite field F over which E is defined. Ensures that generated field
/// elements are indistinguishable from uniform random at the cost of compatability
/// with RFC 9380.
///
/// Differs from [`RFC9380`] in the implementation of the `to_representative` function
/// as RFC9380 misses a computational distinguisher that would allow an attacker to
/// distinguish the representative from random bytes.
Expand All @@ -226,9 +231,9 @@ impl MapToPointVariant for Randomized {
}

#[cfg(feature = "digest")]
/// Calculates a point on elliptic curve E (Curve25519) from an element of
/// the finite field F over which E is defined. See section 6.7.1 of
/// [RFC 9380 specification](https://datatracker.ietf.org/doc/rfc9380/).
/// Converts between a point on elliptic curve E (Curve25519) and an element of
/// the finite field F over which E is defined. Supports older implementations
/// with a common implementation bug (Signal, Kleshni-C).
///
/// In contrast to the [`RFC9380`] variant, `Legacy` does NOT assume that input values are always
/// going to be the least-square-root representation of the field element.
Expand Down
2 changes: 1 addition & 1 deletion curve25519-elligator2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// Documentation:
//------------------------------------------------------------------------
#![doc(
html_logo_url = "https://cdn.jsdelivr.net/gh/dalek-cryptography/curve25519-elligator2/docs/assets/dalek-logo-clear.png"
html_logo_url = "https://cdn.jsdelivr.net/gh/dalek-cryptography/curve25519-dalek/docs/assets/dalek-logo-clear.png"
)]
#![doc = include_str!("../README.md")]
//------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions curve25519-elligator2/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1239,10 +1239,12 @@ impl Field for Scalar {
}

fn sqrt_ratio(num: &Self, div: &Self) -> (Choice, Self) {
#[allow(unused_qualifications)]
group::ff::helpers::sqrt_ratio_generic(num, div)
}

fn sqrt(&self) -> CtOption<Self> {
#[allow(unused_qualifications)]
group::ff::helpers::sqrt_tonelli_shanks(
self,
[
Expand Down

0 comments on commit 240b93d

Please sign in to comment.