use super::Sm2;
use crate::ProjectivePoint;
use primeorder::PrimeCurveWithBasepointTable;
pub(super) const WINDOW_SIZE: usize = 33;
pub(super) type BasepointTable = primeorder::BasepointTable<ProjectivePoint, WINDOW_SIZE>;
pub(super) static BASEPOINT_TABLE: BasepointTable = BasepointTable::new();
impl PrimeCurveWithBasepointTable<WINDOW_SIZE> for Sm2 {
const BASEPOINT_TABLE: &'static BasepointTable = &BASEPOINT_TABLE;
}
pub(crate) mod backend {
use super::BASEPOINT_TABLE;
use crate::{ProjectivePoint, Scalar, Sm2};
use primeorder::MulBackend;
pub struct PrecomputedTables;
impl MulBackend<Sm2> for PrecomputedTables {
#[inline]
fn mul_by_generator(k: &Scalar) -> ProjectivePoint {
BASEPOINT_TABLE.mul(k)
}
#[inline]
fn mul_by_generator_vartime(k: &Scalar) -> ProjectivePoint {
BASEPOINT_TABLE.mul_vartime(k)
}
}
}