Skip to content

Commit 425e867

Browse files
authored
ed448-goldilocks: move Edwards and Montgomary to their own modules (#1300)
1 parent 86e55d0 commit 425e867

File tree

11 files changed

+14
-19
lines changed

11 files changed

+14
-19
lines changed

ed448-goldilocks/src/curve.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
pub mod edwards;
2-
pub mod montgomery;
3-
mod scalar;
41
pub(crate) mod scalar_mul;
52
pub(crate) mod twedwards;
6-
7-
pub use edwards::{AffinePoint, CompressedEdwardsY, EdwardsPoint};
8-
pub use montgomery::{MontgomeryPoint, ProjectiveMontgomeryPoint};
9-
pub use scalar::{EdwardsScalar, EdwardsScalarBytes, WideEdwardsScalarBytes};

ed448-goldilocks/src/curve/twedwards/extended.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![allow(non_snake_case)]
22
#![allow(dead_code)]
33

4-
use crate::curve::edwards::EdwardsPoint as EdwardsExtendedPoint;
54
use crate::curve::twedwards::affine::AffinePoint;
65
use crate::curve::twedwards::extensible::ExtensiblePoint;
6+
use crate::edwards::EdwardsPoint as EdwardsExtendedPoint;
77
use crate::field::FieldElement;
88
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq};
99

ed448-goldilocks/src/curve/edwards.rs renamed to ed448-goldilocks/src/edwards.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111
/// If this is a problem, one can use a different isogeny strategy (Decaf/Ristretto)
1212
pub(crate) mod affine;
1313
pub(crate) mod extended;
14+
mod scalar;
1415
pub use affine::AffinePoint;
1516
pub use extended::{CompressedEdwardsY, EdwardsPoint};
17+
pub use scalar::{EdwardsScalar, EdwardsScalarBytes, WideEdwardsScalarBytes};

ed448-goldilocks/src/curve/edwards/affine.rs renamed to ed448-goldilocks/src/edwards/affine.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::curve::edwards::EdwardsPoint;
21
use crate::field::FieldElement;
32
use crate::*;
43
use core::ops::Mul;

ed448-goldilocks/src/curve/edwards/extended.rs renamed to ed448-goldilocks/src/edwards/extended.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use core::iter::Sum;
44
use core::ops::{Add, AddAssign, Mul, MulAssign, Neg, Sub, SubAssign};
55

66
use crate::constants::EDWARDS_BASEPOINT_ORDER;
7-
use crate::curve::edwards::affine::AffinePoint;
8-
use crate::curve::montgomery::MontgomeryPoint; // XXX: need to fix this path
97
use crate::curve::scalar_mul::variable_base;
108
use crate::curve::twedwards::extended::ExtendedPoint as TwistedExtendedPoint;
119
use crate::field::FieldElement;

ed448-goldilocks/src/field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ pub use scalar::{
77
MODULUS_LIMBS, NZ_ORDER, ORDER, Scalar, ScalarBytes, WIDE_ORDER, WideScalarBytes,
88
};
99

10-
use crate::curve::edwards::EdwardsPoint;
1110
use crate::curve::twedwards::extended::ExtendedPoint as TwExtendedPoint;
11+
use crate::edwards::EdwardsPoint;
1212

1313
use elliptic_curve::bigint::{
1414
U448, const_monty_params,

ed448-goldilocks/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,25 @@ pub use subtle;
4343
pub(crate) mod constants;
4444
pub(crate) mod curve;
4545
pub(crate) mod decaf;
46+
pub(crate) mod edwards;
4647
pub(crate) mod field;
48+
pub(crate) mod montgomery;
4749
pub(crate) mod ristretto;
4850
#[cfg(feature = "signing")]
4951
pub(crate) mod sign;
5052

5153
pub(crate) use field::{GOLDILOCKS_BASE_POINT, TWISTED_EDWARDS_BASE_POINT};
5254

53-
pub use curve::{
54-
AffinePoint, CompressedEdwardsY, EdwardsPoint, EdwardsScalar, EdwardsScalarBytes,
55-
MontgomeryPoint, ProjectiveMontgomeryPoint, WideEdwardsScalarBytes,
56-
};
5755
pub use decaf::{
5856
AffinePoint as DecafAffinePoint, CompressedDecaf, DecafPoint, DecafScalar, DecafScalarBytes,
5957
WideDecafScalarBytes,
6058
};
59+
pub use edwards::{
60+
AffinePoint, CompressedEdwardsY, EdwardsPoint, EdwardsScalar, EdwardsScalarBytes,
61+
WideEdwardsScalarBytes,
62+
};
6163
pub use field::{MODULUS_LIMBS, ORDER, Scalar, WIDE_ORDER};
64+
pub use montgomery::{MontgomeryPoint, ProjectiveMontgomeryPoint};
6265
pub use ristretto::{CompressedRistretto, RistrettoPoint};
6366
#[cfg(feature = "signing")]
6467
pub use sign::*;

ed448-goldilocks/src/curve/montgomery.rs renamed to ed448-goldilocks/src/montgomery.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// use crate::constants::A_PLUS_TWO_OVER_FOUR;
1414
use crate::EdwardsScalar;
15-
use crate::curve::edwards::extended::EdwardsPoint;
15+
use crate::edwards::extended::EdwardsPoint;
1616
use crate::field::FieldElement;
1717
use core::fmt;
1818
use core::ops::Mul;

ed448-goldilocks/src/sign/signing_key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use signature::Error;
1414
use subtle::{Choice, ConstantTimeEq};
1515

1616
#[cfg(feature = "pkcs8")]
17-
use crate::{PUBLIC_KEY_LENGTH, curve::edwards::extended::PointBytes};
17+
use crate::{PUBLIC_KEY_LENGTH, edwards::extended::PointBytes};
1818

1919
/// Ed448 secret key as defined in [RFC8032 § 5.2.5]
2020
///

0 commit comments

Comments
 (0)