@@ -92,16 +92,16 @@ pub trait Group:
9292 fn double ( & self ) -> Self ;
9393}
9494
95- /// Efficient representation of an elliptic curve point guaranteed.
96- pub trait Curve :
97- Group + GroupOps < <Self as Curve >:: AffineRepr > + GroupOpsOwned < <Self as Curve >:: AffineRepr >
98- {
95+ /// Efficient representation of an elliptic curve point.
96+ pub trait Curve : Group + GroupOps < Self :: Affine > + GroupOpsOwned < Self :: Affine > {
9997 /// The affine representation for this elliptic curve.
100- type AffineRepr ;
98+ type Affine : CurveAffine < Curve = Self , Scalar = Self :: Scalar >
99+ + Mul < Self :: Scalar , Output = Self >
100+ + for < ' r > Mul < & ' r Self :: Scalar , Output = Self > ;
101101
102102 /// Converts a batch of projective elements into affine elements. This function will
103103 /// panic if `p.len() != q.len()`.
104- fn batch_normalize ( p : & [ Self ] , q : & mut [ Self :: AffineRepr ] ) {
104+ fn batch_normalize ( p : & [ Self ] , q : & mut [ Self :: Affine ] ) {
105105 assert_eq ! ( p. len( ) , q. len( ) ) ;
106106
107107 for ( p, q) in p. iter ( ) . zip ( q. iter_mut ( ) ) {
@@ -110,7 +110,45 @@ pub trait Curve:
110110 }
111111
112112 /// Converts this element into its affine representation.
113- fn to_affine ( & self ) -> Self :: AffineRepr ;
113+ fn to_affine ( & self ) -> Self :: Affine ;
114+ }
115+
116+ /// Affine representation of an elliptic curve point.
117+ pub trait CurveAffine :
118+ GroupEncoding
119+ + Copy
120+ + Clone
121+ + Sized
122+ + Send
123+ + Sync
124+ + fmt:: Debug
125+ + PartialEq
126+ + Eq
127+ + ' static
128+ + Neg < Output = Self >
129+ + Mul < <Self :: Curve as Group >:: Scalar , Output = Self :: Curve >
130+ + for < ' r > Mul < & ' r <Self :: Curve as Group >:: Scalar , Output = Self :: Curve >
131+ {
132+ /// The efficient representation for this elliptic curve.
133+ type Curve : Curve < Affine = Self , Scalar = Self :: Scalar > ;
134+
135+ /// Scalars modulo the order of this group's scalar field.
136+ ///
137+ /// This associated type is temporary, and will be removed once downstream users have
138+ /// migrated to using `Curve` as the primary generic bound.
139+ type Scalar : PrimeField ;
140+
141+ /// Returns the additive identity.
142+ fn identity ( ) -> Self ;
143+
144+ /// Returns a fixed generator of unknown exponent.
145+ fn generator ( ) -> Self ;
146+
147+ /// Determines if this point represents the additive identity.
148+ fn is_identity ( & self ) -> Choice ;
149+
150+ /// Converts this affine point to its efficient representation.
151+ fn to_curve ( & self ) -> Self :: Curve ;
114152}
115153
116154pub trait GroupEncoding : Sized {
0 commit comments