mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Hide fns using private types
This commit is contained in:
parent
78d9e70071
commit
9fda4739d0
2 changed files with 9 additions and 8 deletions
|
|
@ -280,6 +280,8 @@ impl ProjectivePoint {
|
|||
// Addition and Subtraction
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// These are doc(hidden) so they don't appear in the public API docs.
|
||||
#[doc(hidden)]
|
||||
impl<'a, 'b> Add<&'b ProjectiveNielsPoint> for &'a ExtendedPoint {
|
||||
type Output = CompletedPoint;
|
||||
|
||||
|
|
@ -301,6 +303,7 @@ impl<'a, 'b> Add<&'b ProjectiveNielsPoint> for &'a ExtendedPoint {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl<'a, 'b> Sub<&'b ProjectiveNielsPoint> for &'a ExtendedPoint {
|
||||
type Output = CompletedPoint;
|
||||
|
||||
|
|
@ -322,6 +325,7 @@ impl<'a, 'b> Sub<&'b ProjectiveNielsPoint> for &'a ExtendedPoint {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl<'a, 'b> Add<&'b AffineNielsPoint> for &'a ExtendedPoint {
|
||||
type Output = CompletedPoint;
|
||||
|
||||
|
|
@ -342,6 +346,7 @@ impl<'a, 'b> Add<&'b AffineNielsPoint> for &'a ExtendedPoint {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl<'a, 'b> Sub<&'b AffineNielsPoint> for &'a ExtendedPoint {
|
||||
type Output = CompletedPoint;
|
||||
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ impl Equal for ExtendedPoint {
|
|||
|
||||
impl ExtendedPoint {
|
||||
/// Convert to a ProjectiveNielsPoint
|
||||
pub fn to_projective_niels(&self) -> ProjectiveNielsPoint {
|
||||
pub(crate) fn to_projective_niels(&self) -> ProjectiveNielsPoint {
|
||||
ProjectiveNielsPoint{
|
||||
Y_plus_X: &self.Y + &self.X,
|
||||
Y_minus_X: &self.Y - &self.X,
|
||||
|
|
@ -247,7 +247,7 @@ impl ExtendedPoint {
|
|||
///
|
||||
/// Given a point in Ɛₑ, we can convert to projective coordinates
|
||||
/// cost-free by simply ignoring T.
|
||||
fn to_projective(&self) -> ProjectivePoint {
|
||||
pub(crate) fn to_projective(&self) -> ProjectivePoint {
|
||||
ProjectivePoint{
|
||||
X: self.X,
|
||||
Y: self.Y,
|
||||
|
|
@ -257,7 +257,7 @@ impl ExtendedPoint {
|
|||
|
||||
/// Dehomogenize to a AffineNielsPoint.
|
||||
/// Mainly for testing.
|
||||
pub fn to_affine_niels(&self) -> AffineNielsPoint {
|
||||
pub(crate) fn to_affine_niels(&self) -> AffineNielsPoint {
|
||||
let recip = self.Z.invert();
|
||||
let x = &self.X * &recip;
|
||||
let y = &self.Y * &recip;
|
||||
|
|
@ -647,17 +647,13 @@ impl EdwardsBasepointTable {
|
|||
|
||||
impl ExtendedPoint {
|
||||
/// Multiply by the cofactor: compute `8 * self`.
|
||||
///
|
||||
/// Convenience wrapper around `mult_by_pow_2`.
|
||||
#[inline]
|
||||
pub fn mult_by_cofactor(&self) -> ExtendedPoint {
|
||||
self.mult_by_pow_2(3)
|
||||
}
|
||||
|
||||
/// Compute `2^k * self` by successive doublings.
|
||||
/// Requires `k > 0`.
|
||||
#[inline]
|
||||
pub fn mult_by_pow_2(&self, k: u32) -> ExtendedPoint {
|
||||
pub(crate) fn mult_by_pow_2(&self, k: u32) -> ExtendedPoint {
|
||||
let mut r: CompletedPoint;
|
||||
let mut s = self.to_projective();
|
||||
for _ in 0..(k-1) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue