@@ -68,7 +68,7 @@ pub use montgomery::{
68
68
pub use sign:: * ;
69
69
70
70
use elliptic_curve:: {
71
- Curve , FieldBytesEncoding , PrimeCurve ,
71
+ Curve , CurveArithmetic , FieldBytes , FieldBytesEncoding , NonZeroScalar , PrimeCurve ,
72
72
array:: typenum:: { U28 , U56 , U57 } ,
73
73
bigint:: { ArrayEncoding , U448 } ,
74
74
point:: PointCompression ,
@@ -80,14 +80,14 @@ use hash2curve::GroupDigest;
80
80
pub struct Ed448 ;
81
81
82
82
/// Bytes of the Ed448 field
83
- pub type Ed448FieldBytes = elliptic_curve :: FieldBytes < Ed448 > ;
83
+ pub type Ed448FieldBytes = FieldBytes < Ed448 > ;
84
84
85
85
/// Scalar bits of the Ed448 scalar
86
86
#[ cfg( feature = "bits" ) ]
87
87
pub type Ed448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Ed448 > ;
88
88
89
89
/// Non-zero scalar of the Ed448 scalar
90
- pub type Ed448NonZeroScalar = elliptic_curve :: NonZeroScalar < Ed448 > ;
90
+ pub type Ed448NonZeroScalar = NonZeroScalar < Ed448 > ;
91
91
92
92
impl Curve for Ed448 {
93
93
type FieldBytesSize = U57 ;
@@ -114,7 +114,7 @@ impl FieldBytesEncoding<Ed448> for U448 {
114
114
}
115
115
}
116
116
117
- impl elliptic_curve :: CurveArithmetic for Ed448 {
117
+ impl CurveArithmetic for Ed448 {
118
118
type AffinePoint = AffinePoint ;
119
119
type ProjectivePoint = EdwardsPoint ;
120
120
type Scalar = EdwardsScalar ;
@@ -129,14 +129,14 @@ impl GroupDigest for Ed448 {
129
129
pub struct Decaf448 ;
130
130
131
131
/// Bytes of the Decaf448 field
132
- pub type Decaf448FieldBytes = elliptic_curve :: FieldBytes < Decaf448 > ;
132
+ pub type Decaf448FieldBytes = FieldBytes < Decaf448 > ;
133
133
134
134
/// Scalar bits of the Decaf448 scalar
135
135
#[ cfg( feature = "bits" ) ]
136
136
pub type Decaf448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Decaf448 > ;
137
137
138
138
/// Non-zero scalar of the Decaf448 scalar
139
- pub type Decaf448NonZeroScalar = elliptic_curve :: NonZeroScalar < Decaf448 > ;
139
+ pub type Decaf448NonZeroScalar = NonZeroScalar < Decaf448 > ;
140
140
141
141
impl Curve for Decaf448 {
142
142
type FieldBytesSize = U56 ;
@@ -163,7 +163,7 @@ impl FieldBytesEncoding<Decaf448> for U448 {
163
163
}
164
164
}
165
165
166
- impl elliptic_curve :: CurveArithmetic for Decaf448 {
166
+ impl CurveArithmetic for Decaf448 {
167
167
type AffinePoint = DecafAffinePoint ;
168
168
type ProjectivePoint = DecafPoint ;
169
169
type Scalar = DecafScalar ;
@@ -176,3 +176,44 @@ impl GroupDigest for Decaf448 {
176
176
/// Curve448 curve.
177
177
#[ derive( Copy , Clone , Debug , Default , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
178
178
pub 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