@@ -70,7 +70,7 @@ pub use ristretto::{CompressedRistretto, RistrettoPoint};
70
70
pub use sign:: * ;
71
71
72
72
use elliptic_curve:: {
73
- Curve , FieldBytesEncoding , PrimeCurve ,
73
+ Curve , CurveArithmetic , FieldBytes , FieldBytesEncoding , NonZeroScalar , PrimeCurve ,
74
74
array:: typenum:: { U28 , U56 , U57 } ,
75
75
bigint:: { ArrayEncoding , U448 } ,
76
76
point:: PointCompression ,
@@ -82,14 +82,14 @@ use hash2curve::GroupDigest;
82
82
pub struct Ed448 ;
83
83
84
84
/// Bytes of the Ed448 field
85
- pub type Ed448FieldBytes = elliptic_curve :: FieldBytes < Ed448 > ;
85
+ pub type Ed448FieldBytes = FieldBytes < Ed448 > ;
86
86
87
87
/// Scalar bits of the Ed448 scalar
88
88
#[ cfg( feature = "bits" ) ]
89
89
pub type Ed448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Ed448 > ;
90
90
91
91
/// Non-zero scalar of the Ed448 scalar
92
- pub type Ed448NonZeroScalar = elliptic_curve :: NonZeroScalar < Ed448 > ;
92
+ pub type Ed448NonZeroScalar = NonZeroScalar < Ed448 > ;
93
93
94
94
impl Curve for Ed448 {
95
95
type FieldBytesSize = U57 ;
@@ -116,7 +116,7 @@ impl FieldBytesEncoding<Ed448> for U448 {
116
116
}
117
117
}
118
118
119
- impl elliptic_curve :: CurveArithmetic for Ed448 {
119
+ impl CurveArithmetic for Ed448 {
120
120
type AffinePoint = AffinePoint ;
121
121
type ProjectivePoint = EdwardsPoint ;
122
122
type Scalar = EdwardsScalar ;
@@ -131,14 +131,14 @@ impl GroupDigest for Ed448 {
131
131
pub struct Decaf448 ;
132
132
133
133
/// Bytes of the Decaf448 field
134
- pub type Decaf448FieldBytes = elliptic_curve :: FieldBytes < Decaf448 > ;
134
+ pub type Decaf448FieldBytes = FieldBytes < Decaf448 > ;
135
135
136
136
/// Scalar bits of the Decaf448 scalar
137
137
#[ cfg( feature = "bits" ) ]
138
138
pub type Decaf448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Decaf448 > ;
139
139
140
140
/// Non-zero scalar of the Decaf448 scalar
141
- pub type Decaf448NonZeroScalar = elliptic_curve :: NonZeroScalar < Decaf448 > ;
141
+ pub type Decaf448NonZeroScalar = NonZeroScalar < Decaf448 > ;
142
142
143
143
impl Curve for Decaf448 {
144
144
type FieldBytesSize = U56 ;
@@ -165,7 +165,7 @@ impl FieldBytesEncoding<Decaf448> for U448 {
165
165
}
166
166
}
167
167
168
- impl elliptic_curve :: CurveArithmetic for Decaf448 {
168
+ impl CurveArithmetic for Decaf448 {
169
169
type AffinePoint = DecafAffinePoint ;
170
170
type ProjectivePoint = DecafPoint ;
171
171
type Scalar = DecafScalar ;
@@ -178,3 +178,44 @@ impl GroupDigest for Decaf448 {
178
178
/// Curve448 curve.
179
179
#[ derive( Copy , Clone , Debug , Default , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
180
180
pub struct Curve448 ;
181
+
182
+ /// Bytes of the Curve448 field
183
+ pub type Curve448FieldBytes = FieldBytes < Curve448 > ;
184
+
185
+ /// Scalar bits of the Curve448 scalar
186
+ #[ cfg( feature = "bits" ) ]
187
+ pub type Curve448ScalarBits = elliptic_curve:: scalar:: ScalarBits < Curve448 > ;
188
+
189
+ /// Non-zero scalar of the Curve448 scalar
190
+ pub type Curve448NonZeroScalar = NonZeroScalar < Curve448 > ;
191
+
192
+ impl Curve for Curve448 {
193
+ type FieldBytesSize = U56 ;
194
+ type Uint = U448 ;
195
+
196
+ const ORDER : U448 = ORDER ;
197
+ }
198
+
199
+ impl PrimeCurve for Curve448 { }
200
+
201
+ impl PointCompression for Curve448 {
202
+ const COMPRESS_POINTS : bool = true ;
203
+ }
204
+
205
+ impl FieldBytesEncoding < Curve448 > for U448 {
206
+ fn decode_field_bytes ( field_bytes : & Curve448FieldBytes ) -> Self {
207
+ U448 :: from_le_slice ( field_bytes)
208
+ }
209
+
210
+ fn encode_field_bytes ( & self ) -> Curve448FieldBytes {
211
+ let mut data = Curve448FieldBytes :: default ( ) ;
212
+ data. copy_from_slice ( & self . to_le_byte_array ( ) [ ..] ) ;
213
+ data
214
+ }
215
+ }
216
+
217
+ impl CurveArithmetic for Curve448 {
218
+ type AffinePoint = MontgomeryPoint ;
219
+ type ProjectivePoint = ProjectiveMontgomeryPoint ;
220
+ type Scalar = MontgomeryScalar ;
221
+ }
0 commit comments