@@ -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,42 @@ 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+ + fmt:: Debug
121+ + Eq
122+ + Send
123+ + Sync
124+ + ' static
125+ + Neg < Output = Self >
126+ + Mul < <Self :: Curve as Group >:: Scalar , Output = Self :: Curve >
127+ + for < ' r > Mul < & ' r <Self :: Curve as Group >:: Scalar , Output = Self :: Curve >
128+ {
129+ /// The efficient representation for this elliptic curve.
130+ type Curve : Curve < Affine = Self , Scalar = Self :: Scalar > ;
131+
132+ /// Scalars modulo the order of this group's scalar field.
133+ ///
134+ /// This associated type is temporary, and will be removed once downstream users have
135+ /// migrated to using `Curve` as the primary generic bound.
136+ type Scalar : PrimeField ;
137+
138+ /// Returns the additive identity.
139+ fn identity ( ) -> Self ;
140+
141+ /// Returns a fixed generator of unknown exponent.
142+ fn generator ( ) -> Self ;
143+
144+ /// Determines if this point represents the additive identity.
145+ fn is_identity ( & self ) -> Choice ;
146+
147+ /// Converts this affine point to its efficient representation.
148+ fn to_curve ( & self ) -> Self :: Curve ;
114149}
115150
116151pub trait GroupEncoding : Sized {
0 commit comments