1pub(crate) mod field;
8pub(crate) mod scalar;
9
10pub use self::scalar::Scalar;
11
12use self::field::FieldElement;
13use crate::NistP224;
14use elliptic_curve::{CurveArithmetic, PrimeCurveArithmetic};
15use primeorder::{point_arithmetic, PrimeCurveParams};
16
17pub type AffinePoint = primeorder::AffinePoint<NistP224>;
19
20pub type ProjectivePoint = primeorder::ProjectivePoint<NistP224>;
22
23impl CurveArithmetic for NistP224 {
24 type AffinePoint = AffinePoint;
25 type ProjectivePoint = ProjectivePoint;
26 type Scalar = Scalar;
27}
28
29impl PrimeCurveArithmetic for NistP224 {
30 type CurveGroup = ProjectivePoint;
31}
32
33impl PrimeCurveParams for NistP224 {
37 type FieldElement = FieldElement;
38 type PointArithmetic = point_arithmetic::EquationAIsMinusThree;
39
40 const EQUATION_A: FieldElement = FieldElement::from_u64(3).neg();
42
43 #[cfg(target_pointer_width = "32")]
45 const EQUATION_B: FieldElement =
46 FieldElement::from_hex("b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4");
47
48 #[cfg(target_pointer_width = "64")]
50 const EQUATION_B: FieldElement =
51 FieldElement::from_hex("00000000b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4");
52
53 #[cfg(target_pointer_width = "32")]
60 const GENERATOR: (FieldElement, FieldElement) = (
61 FieldElement::from_hex("b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21"),
62 FieldElement::from_hex("bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34"),
63 );
64
65 #[cfg(target_pointer_width = "64")]
72 const GENERATOR: (FieldElement, FieldElement) = (
73 FieldElement::from_hex("00000000b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21"),
74 FieldElement::from_hex("00000000bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34"),
75 );
76}