@@ -66,7 +66,7 @@ pub use montgomery::{
6666pub use sign:: * ;
6767
6868use elliptic_curve:: {
69- Curve , FieldBytesEncoding , PrimeCurve ,
69+ Curve , CurveArithmetic , FieldBytes , FieldBytesEncoding , NonZeroScalar , PrimeCurve ,
7070 array:: typenum:: { U28 , U56 , U57 } ,
7171 bigint:: { ArrayEncoding , Odd , U448 } ,
7272 point:: PointCompression ,
@@ -78,14 +78,14 @@ use hash2curve::GroupDigest;
7878pub struct Ed448 ;
7979
8080/// Bytes of the Ed448 field
81- pub type Ed448FieldBytes = elliptic_curve :: FieldBytes < Ed448 > ;
81+ pub type Ed448FieldBytes = FieldBytes < Ed448 > ;
8282
8383/// Scalar bits of the Ed448 scalar
8484#[ cfg( feature = "bits" ) ]
8585pub type Ed448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Ed448 > ;
8686
8787/// Non-zero scalar of the Ed448 scalar
88- pub type Ed448NonZeroScalar = elliptic_curve :: NonZeroScalar < Ed448 > ;
88+ pub type Ed448NonZeroScalar = NonZeroScalar < Ed448 > ;
8989
9090impl Curve for Ed448 {
9191 type FieldBytesSize = U57 ;
@@ -112,7 +112,7 @@ impl FieldBytesEncoding<Ed448> for U448 {
112112 }
113113}
114114
115- impl elliptic_curve :: CurveArithmetic for Ed448 {
115+ impl CurveArithmetic for Ed448 {
116116 type AffinePoint = AffinePoint ;
117117 type ProjectivePoint = EdwardsPoint ;
118118 type Scalar = EdwardsScalar ;
@@ -127,14 +127,14 @@ impl GroupDigest for Ed448 {
127127pub struct Decaf448 ;
128128
129129/// Bytes of the Decaf448 field
130- pub type Decaf448FieldBytes = elliptic_curve :: FieldBytes < Decaf448 > ;
130+ pub type Decaf448FieldBytes = FieldBytes < Decaf448 > ;
131131
132132/// Scalar bits of the Decaf448 scalar
133133#[ cfg( feature = "bits" ) ]
134134pub type Decaf448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Decaf448 > ;
135135
136136/// Non-zero scalar of the Decaf448 scalar
137- pub type Decaf448NonZeroScalar = elliptic_curve :: NonZeroScalar < Decaf448 > ;
137+ pub type Decaf448NonZeroScalar = NonZeroScalar < Decaf448 > ;
138138
139139impl Curve for Decaf448 {
140140 type FieldBytesSize = U56 ;
@@ -161,7 +161,7 @@ impl FieldBytesEncoding<Decaf448> for U448 {
161161 }
162162}
163163
164- impl elliptic_curve :: CurveArithmetic for Decaf448 {
164+ impl CurveArithmetic for Decaf448 {
165165 type AffinePoint = DecafAffinePoint ;
166166 type ProjectivePoint = DecafPoint ;
167167 type Scalar = DecafScalar ;
@@ -174,3 +174,44 @@ impl GroupDigest for Decaf448 {
174174/// Curve448 curve.
175175#[ derive( Copy , Clone , Debug , Default , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
176176pub struct Curve448 ;
177+
178+ /// Bytes of the Curve448 field
179+ pub type Curve448FieldBytes = FieldBytes < Curve448 > ;
180+
181+ /// Scalar bits of the Curve448 scalar
182+ #[ cfg( feature = "bits" ) ]
183+ pub type Curve448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Curve448 > ;
184+
185+ /// Non-zero scalar of the Curve448 scalar
186+ pub type Curve448NonZeroScalar = NonZeroScalar < Curve448 > ;
187+
188+ impl Curve for Curve448 {
189+ type FieldBytesSize = U56 ;
190+ type Uint = U448 ;
191+
192+ const ORDER : NonZero < U448 > = ORDER ;
193+ }
194+
195+ impl PrimeCurve for Curve448 { }
196+
197+ impl PointCompression for Curve448 {
198+ const COMPRESS_POINTS : bool = true ;
199+ }
200+
201+ impl FieldBytesEncoding < Curve448 > for U448 {
202+ fn decode_field_bytes ( field_bytes : & Curve448FieldBytes ) -> Self {
203+ U448 :: from_le_slice ( field_bytes)
204+ }
205+
206+ fn encode_field_bytes ( & self ) -> Curve448FieldBytes {
207+ let mut data = Curve448FieldBytes :: default ( ) ;
208+ data. copy_from_slice ( & self . to_le_byte_array ( ) [ ..] ) ;
209+ data
210+ }
211+ }
212+
213+ impl CurveArithmetic for Curve448 {
214+ type AffinePoint = MontgomeryPoint ;
215+ type ProjectivePoint = ProjectiveMontgomeryPoint ;
216+ type Scalar = MontgomeryScalar ;
217+ }
0 commit comments