@@ -68,7 +68,7 @@ pub use montgomery::{
6868pub use sign:: * ;
6969
7070use elliptic_curve:: {
71- Curve , FieldBytesEncoding , PrimeCurve ,
71+ Curve , CurveArithmetic , FieldBytes , FieldBytesEncoding , NonZeroScalar , PrimeCurve ,
7272 array:: typenum:: { U28 , U56 , U57 } ,
7373 bigint:: { ArrayEncoding , U448 } ,
7474 point:: PointCompression ,
@@ -80,14 +80,14 @@ use hash2curve::GroupDigest;
8080pub struct Ed448 ;
8181
8282/// Bytes of the Ed448 field
83- pub type Ed448FieldBytes = elliptic_curve :: FieldBytes < Ed448 > ;
83+ pub type Ed448FieldBytes = FieldBytes < Ed448 > ;
8484
8585/// Scalar bits of the Ed448 scalar
8686#[ cfg( feature = "bits" ) ]
8787pub type Ed448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Ed448 > ;
8888
8989/// Non-zero scalar of the Ed448 scalar
90- pub type Ed448NonZeroScalar = elliptic_curve :: NonZeroScalar < Ed448 > ;
90+ pub type Ed448NonZeroScalar = NonZeroScalar < Ed448 > ;
9191
9292impl Curve for Ed448 {
9393 type FieldBytesSize = U57 ;
@@ -114,7 +114,7 @@ impl FieldBytesEncoding<Ed448> for U448 {
114114 }
115115}
116116
117- impl elliptic_curve :: CurveArithmetic for Ed448 {
117+ impl CurveArithmetic for Ed448 {
118118 type AffinePoint = AffinePoint ;
119119 type ProjectivePoint = EdwardsPoint ;
120120 type Scalar = EdwardsScalar ;
@@ -129,14 +129,14 @@ impl GroupDigest for Ed448 {
129129pub struct Decaf448 ;
130130
131131/// Bytes of the Decaf448 field
132- pub type Decaf448FieldBytes = elliptic_curve :: FieldBytes < Decaf448 > ;
132+ pub type Decaf448FieldBytes = FieldBytes < Decaf448 > ;
133133
134134/// Scalar bits of the Decaf448 scalar
135135#[ cfg( feature = "bits" ) ]
136136pub type Decaf448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Decaf448 > ;
137137
138138/// Non-zero scalar of the Decaf448 scalar
139- pub type Decaf448NonZeroScalar = elliptic_curve :: NonZeroScalar < Decaf448 > ;
139+ pub type Decaf448NonZeroScalar = NonZeroScalar < Decaf448 > ;
140140
141141impl Curve for Decaf448 {
142142 type FieldBytesSize = U56 ;
@@ -163,7 +163,7 @@ impl FieldBytesEncoding<Decaf448> for U448 {
163163 }
164164}
165165
166- impl elliptic_curve :: CurveArithmetic for Decaf448 {
166+ impl CurveArithmetic for Decaf448 {
167167 type AffinePoint = DecafAffinePoint ;
168168 type ProjectivePoint = DecafPoint ;
169169 type Scalar = DecafScalar ;
@@ -176,3 +176,44 @@ impl GroupDigest for Decaf448 {
176176/// Curve448 curve.
177177#[ derive( Copy , Clone , Debug , Default , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
178178pub struct Curve448 ;
179+
180+ /// Bytes of the Curve448 field
181+ pub type Curve448FieldBytes = FieldBytes < Curve448 > ;
182+
183+ /// Scalar bits of the Curve448 scalar
184+ #[ cfg( feature = "bits" ) ]
185+ pub type Curve448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Curve448 > ;
186+
187+ /// Non-zero scalar of the Curve448 scalar
188+ pub type Curve448NonZeroScalar = NonZeroScalar < Curve448 > ;
189+
190+ impl Curve for Curve448 {
191+ type FieldBytesSize = U56 ;
192+ type Uint = U448 ;
193+
194+ const ORDER : U448 = ORDER ;
195+ }
196+
197+ impl PrimeCurve for Curve448 { }
198+
199+ impl PointCompression for Curve448 {
200+ const COMPRESS_POINTS : bool = true ;
201+ }
202+
203+ impl FieldBytesEncoding < Curve448 > for U448 {
204+ fn decode_field_bytes ( field_bytes : & Curve448FieldBytes ) -> Self {
205+ U448 :: from_le_slice ( field_bytes)
206+ }
207+
208+ fn encode_field_bytes ( & self ) -> Curve448FieldBytes {
209+ let mut data = Curve448FieldBytes :: default ( ) ;
210+ data. copy_from_slice ( & self . to_le_byte_array ( ) [ ..] ) ;
211+ data
212+ }
213+ }
214+
215+ impl CurveArithmetic for Curve448 {
216+ type AffinePoint = MontgomeryPoint ;
217+ type ProjectivePoint = ProjectiveMontgomeryPoint ;
218+ type Scalar = MontgomeryScalar ;
219+ }
0 commit comments