diff --git a/CHANGELOG.md b/CHANGELOG.md index fe33e88..3c611da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to Rust's notion of ### Removed - `pasta_curves::arithmetic`: + - `FieldExt` (use `ff::PrimeField` or `ff::WithSmallOrderMulGroup` instead). - `Group` - `SqrtRatio` (use `ff::Field::{sqrt_ratio, sqrt_alt}` instead). - `SqrtTables` (from public API, as it isn't suitable for generic usage). diff --git a/src/arithmetic.rs b/src/arithmetic.rs index 39613a6..faf5872 100644 --- a/src/arithmetic.rs +++ b/src/arithmetic.rs @@ -8,4 +8,4 @@ mod curves; mod fields; pub use curves::*; -pub use fields::*; +pub(crate) use fields::*; diff --git a/src/arithmetic/curves.rs b/src/arithmetic/curves.rs index ade9dbf..636f080 100644 --- a/src/arithmetic/curves.rs +++ b/src/arithmetic/curves.rs @@ -6,9 +6,6 @@ use group::prime::{PrimeCurve, PrimeCurveAffine}; #[cfg(feature = "alloc")] use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption}; -#[cfg(feature = "alloc")] -use super::FieldExt; - #[cfg(feature = "alloc")] use alloc::boxed::Box; #[cfg(feature = "alloc")] @@ -30,9 +27,9 @@ pub trait CurveExt: + From<::Affine> { /// The scalar field of this elliptic curve. - type ScalarExt: FieldExt; + type ScalarExt: ff::WithSmallOrderMulGroup<3>; /// The base field over which this elliptic curve is constructed. - type Base: FieldExt; + type Base: ff::WithSmallOrderMulGroup<3>; /// The affine version of the curve type AffineExt: CurveAffine::ScalarExt> + Mul @@ -102,9 +99,9 @@ pub trait CurveAffine: + From<::Curve> { /// The scalar field of this elliptic curve. - type ScalarExt: FieldExt + Ord; + type ScalarExt: ff::WithSmallOrderMulGroup<3> + Ord; /// The base field over which this elliptic curve is constructed. - type Base: FieldExt + Ord; + type Base: ff::WithSmallOrderMulGroup<3> + Ord; /// The projective form of the curve type CurveExt: CurveExt::ScalarExt>; diff --git a/src/arithmetic/fields.rs b/src/arithmetic/fields.rs index d42419d..bd356a2 100644 --- a/src/arithmetic/fields.rs +++ b/src/arithmetic/fields.rs @@ -28,10 +28,6 @@ pub(crate) trait SqrtTableHelpers: ff::PrimeField { fn get_lower_32(&self) -> u32; } -/// This trait is a common interface for dealing with elements of a finite -/// field. -pub trait FieldExt: ff::WithSmallOrderMulGroup<3> {} - /// Parameters for a perfect hash function used in square root computation. #[cfg(feature = "sqrt-table")] #[cfg_attr(docsrs, doc(cfg(feature = "sqrt-table")))] diff --git a/src/fields/fp.rs b/src/fields/fp.rs index e97ae2c..2c2c9b5 100644 --- a/src/fields/fp.rs +++ b/src/fields/fp.rs @@ -11,7 +11,7 @@ use lazy_static::lazy_static; #[cfg(feature = "bits")] use ff::{FieldBits, PrimeFieldBits}; -use crate::arithmetic::{adc, mac, sbb, FieldExt, SqrtTableHelpers}; +use crate::arithmetic::{adc, mac, sbb, SqrtTableHelpers}; #[cfg(feature = "sqrt-table")] use crate::arithmetic::SqrtTables; @@ -728,8 +728,6 @@ impl SqrtTableHelpers for Fp { } } -impl FieldExt for Fp {} - impl WithSmallOrderMulGroup<3> for Fp { const ZETA: Self = Fp::from_raw([ 0x1dad5ebdfdfe4ab9, diff --git a/src/fields/fq.rs b/src/fields/fq.rs index 8a3ac47..9417d2e 100644 --- a/src/fields/fq.rs +++ b/src/fields/fq.rs @@ -11,7 +11,7 @@ use lazy_static::lazy_static; #[cfg(feature = "bits")] use ff::{FieldBits, PrimeFieldBits}; -use crate::arithmetic::{adc, mac, sbb, FieldExt, SqrtTableHelpers}; +use crate::arithmetic::{adc, mac, sbb, SqrtTableHelpers}; #[cfg(feature = "sqrt-table")] use crate::arithmetic::SqrtTables; @@ -727,8 +727,6 @@ impl SqrtTableHelpers for Fq { } } -impl FieldExt for Fq {} - impl WithSmallOrderMulGroup<3> for Fq { const ZETA: Self = Fq::from_raw([ 0x2aa9d2e050aa0e4f,