From fcf1a9f49728b2a076027457521faacf960124fb Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Tue, 8 Sep 2020 12:25:46 -0700 Subject: [PATCH] elliptic-curve: add `ff` and `group` bounds on Arithmetic trait Adds the following: - `Arithmetic::ProjectivePoint` associated type with `group::Curve` and `group::Group` bounds - `Arithmetic::Scalar` is now bounded by `ff::PrimeField` --- elliptic-curve/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/elliptic-curve/src/lib.rs b/elliptic-curve/src/lib.rs index 1f49f1267..3bcd5b974 100644 --- a/elliptic-curve/src/lib.rs +++ b/elliptic-curve/src/lib.rs @@ -84,13 +84,17 @@ pub trait Curve: Clone + Debug + Default + Eq + Ord + Send + Sync { /// Elliptic curve with curve arithmetic support pub trait Arithmetic: Curve { - /// Scalar type for a given curve - type Scalar: ConditionallySelectable + /// Scalar type for a given curve. + type Scalar: ff::PrimeField + ConstantTimeEq + Default + FromBytes + Into>; + /// Elliptic curve point in projective coordinates. + type ProjectivePoint: group::Curve + + group::Group; + /// Affine point type for a given curve type AffinePoint: ConditionallySelectable + Mul, Output = Self::AffinePoint>