Skip to content

Commit ce2dc02

Browse files
authored
elliptic-curve: move BatchNormalize trait under point (#1404)
Since it's functionality related to elliptic curve points, put it under the corresponding module.
1 parent 4a66334 commit ce2dc02

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

elliptic-curve/src/arithmetic.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,3 @@ pub trait PrimeCurveArithmetic:
8484
/// Prime order elliptic curve group.
8585
type CurveGroup: group::prime::PrimeCurve<Affine = <Self as CurveArithmetic>::AffinePoint>;
8686
}
87-
88-
/// Normalize point(s) in projective representation by converting them to their affine ones.
89-
pub trait BatchNormalize<Points: ?Sized>: group::Curve {
90-
/// The output of the batch normalization; a container of affine points.
91-
type Output: AsRef<[Self::AffineRepr]>;
92-
93-
/// Perform a batched conversion to affine representation on a sequence of projective points
94-
/// at an amortized cost that should be practically as efficient as a single conversion.
95-
/// Internally, implementors should rely upon `InvertBatch`.
96-
fn batch_normalize(points: &Points) -> <Self as BatchNormalize<Points>>::Output;
97-
}

elliptic-curve/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ pub use zeroize;
127127
#[cfg(feature = "arithmetic")]
128128
pub use {
129129
crate::{
130-
arithmetic::{BatchNormalize, CurveArithmetic, PrimeCurveArithmetic},
131-
point::{AffinePoint, ProjectivePoint},
130+
arithmetic::{CurveArithmetic, PrimeCurveArithmetic},
131+
point::{AffinePoint, BatchNormalize, ProjectivePoint},
132132
public_key::PublicKey,
133133
scalar::{NonZeroScalar, Scalar},
134134
},

elliptic-curve/src/point.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ pub trait AffineCoordinates {
3232
fn y_is_odd(&self) -> Choice;
3333
}
3434

35+
/// Normalize point(s) in projective representation by converting them to their affine ones.
36+
#[cfg(feature = "arithmetic")]
37+
pub trait BatchNormalize<Points: ?Sized>: group::Curve {
38+
/// The output of the batch normalization; a container of affine points.
39+
type Output: AsRef<[Self::AffineRepr]>;
40+
41+
/// Perform a batched conversion to affine representation on a sequence of projective points
42+
/// at an amortized cost that should be practically as efficient as a single conversion.
43+
/// Internally, implementors should rely upon `InvertBatch`.
44+
fn batch_normalize(points: &Points) -> <Self as BatchNormalize<Points>>::Output;
45+
}
46+
3547
/// Double a point (i.e. add it to itself)
3648
pub trait Double {
3749
/// Double this point.

0 commit comments

Comments
 (0)