pub(crate) mod field;
pub(crate) mod scalar;
pub use self::scalar::Scalar;
use self::field::FieldElement;
use crate::Sm2;
use elliptic_curve::{CurveArithmetic, PrimeCurveArithmetic};
use primeorder::{point_arithmetic, PrimeCurveParams};
pub type AffinePoint = primeorder::AffinePoint<Sm2>;
pub type ProjectivePoint = primeorder::ProjectivePoint<Sm2>;
impl CurveArithmetic for Sm2 {
type AffinePoint = AffinePoint;
type ProjectivePoint = ProjectivePoint;
type Scalar = Scalar;
}
impl PrimeCurveArithmetic for Sm2 {
type CurveGroup = ProjectivePoint;
}
impl PrimeCurveParams for Sm2 {
type FieldElement = FieldElement;
type PointArithmetic = point_arithmetic::EquationAIsMinusThree;
const EQUATION_A: FieldElement = FieldElement::from_u64(3).neg();
const EQUATION_B: FieldElement =
FieldElement::from_hex("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93");
const GENERATOR: (FieldElement, FieldElement) = (
FieldElement::from_hex("32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7"),
FieldElement::from_hex("BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0"),
);
}