@@ -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:: { U56 , U57 } ,
7171 bigint:: { ArrayEncoding , Odd , U448 } ,
7272 point:: PointCompression ,
@@ -79,14 +79,14 @@ use sha3::Shake256;
7979pub struct Ed448 ;
8080
8181/// Bytes of the Ed448 field
82- pub type Ed448FieldBytes = elliptic_curve :: FieldBytes < Ed448 > ;
82+ pub type Ed448FieldBytes = FieldBytes < Ed448 > ;
8383
8484/// Scalar bits of the Ed448 scalar
8585#[ cfg( feature = "bits" ) ]
8686pub type Ed448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Ed448 > ;
8787
8888/// Non-zero scalar of the Ed448 scalar
89- pub type Ed448NonZeroScalar = elliptic_curve :: NonZeroScalar < Ed448 > ;
89+ pub type Ed448NonZeroScalar = NonZeroScalar < Ed448 > ;
9090
9191impl Curve for Ed448 {
9292 type FieldBytesSize = U57 ;
@@ -113,7 +113,7 @@ impl FieldBytesEncoding<Ed448> for U448 {
113113 }
114114}
115115
116- impl elliptic_curve :: CurveArithmetic for Ed448 {
116+ impl CurveArithmetic for Ed448 {
117117 type AffinePoint = AffinePoint ;
118118 type ProjectivePoint = EdwardsPoint ;
119119 type Scalar = EdwardsScalar ;
@@ -131,14 +131,14 @@ impl GroupDigest for Ed448 {
131131pub struct Decaf448 ;
132132
133133/// Bytes of the Decaf448 field
134- pub type Decaf448FieldBytes = elliptic_curve :: FieldBytes < Decaf448 > ;
134+ pub type Decaf448FieldBytes = FieldBytes < Decaf448 > ;
135135
136136/// Scalar bits of the Decaf448 scalar
137137#[ cfg( feature = "bits" ) ]
138138pub type Decaf448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Decaf448 > ;
139139
140140/// Non-zero scalar of the Decaf448 scalar
141- pub type Decaf448NonZeroScalar = elliptic_curve :: NonZeroScalar < Decaf448 > ;
141+ pub type Decaf448NonZeroScalar = NonZeroScalar < Decaf448 > ;
142142
143143impl Curve for Decaf448 {
144144 type FieldBytesSize = U56 ;
@@ -165,7 +165,7 @@ impl FieldBytesEncoding<Decaf448> for U448 {
165165 }
166166}
167167
168- impl elliptic_curve :: CurveArithmetic for Decaf448 {
168+ impl CurveArithmetic for Decaf448 {
169169 type AffinePoint = DecafAffinePoint ;
170170 type ProjectivePoint = DecafPoint ;
171171 type Scalar = DecafScalar ;
@@ -181,3 +181,44 @@ impl GroupDigest for Decaf448 {
181181/// Curve448 curve.
182182#[ derive( Copy , Clone , Debug , Default , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
183183pub struct Curve448 ;
184+
185+ /// Bytes of the Curve448 field
186+ pub type Curve448FieldBytes = FieldBytes < Curve448 > ;
187+
188+ /// Scalar bits of the Curve448 scalar
189+ #[ cfg( feature = "bits" ) ]
190+ pub type Curve448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Curve448 > ;
191+
192+ /// Non-zero scalar of the Curve448 scalar
193+ pub type Curve448NonZeroScalar = NonZeroScalar < Curve448 > ;
194+
195+ impl Curve for Curve448 {
196+ type FieldBytesSize = U56 ;
197+ type Uint = U448 ;
198+
199+ const ORDER : Odd < U448 > = ORDER ;
200+ }
201+
202+ impl PrimeCurve for Curve448 { }
203+
204+ impl PointCompression for Curve448 {
205+ const COMPRESS_POINTS : bool = true ;
206+ }
207+
208+ impl FieldBytesEncoding < Curve448 > for U448 {
209+ fn decode_field_bytes ( field_bytes : & Curve448FieldBytes ) -> Self {
210+ U448 :: from_le_slice ( field_bytes)
211+ }
212+
213+ fn encode_field_bytes ( & self ) -> Curve448FieldBytes {
214+ let mut data = Curve448FieldBytes :: default ( ) ;
215+ data. copy_from_slice ( & self . to_le_byte_array ( ) [ ..] ) ;
216+ data
217+ }
218+ }
219+
220+ impl CurveArithmetic for Curve448 {
221+ type AffinePoint = MontgomeryPoint ;
222+ type ProjectivePoint = ProjectiveMontgomeryPoint ;
223+ type Scalar = MontgomeryScalar ;
224+ }
0 commit comments