p384/arithmetic/
tables.rs1use super::NistP384;
4use crate::ProjectivePoint;
5use primeorder::PrimeCurveWithBasepointTable;
6
7pub(super) const WINDOW_SIZE: usize = 49;
9
10pub(super) type BasepointTable = primeorder::BasepointTable<ProjectivePoint, WINDOW_SIZE>;
12
13pub(super) static BASEPOINT_TABLE: BasepointTable = BasepointTable::new();
15
16impl PrimeCurveWithBasepointTable<WINDOW_SIZE> for NistP384 {
17 const BASEPOINT_TABLE: &'static BasepointTable = &BASEPOINT_TABLE;
18}
19
20pub(crate) mod backend {
25 use super::BASEPOINT_TABLE;
26 use crate::{NistP384, ProjectivePoint, Scalar};
27 use primeorder::MulBackend;
28
29 #[derive(Clone, Copy, Debug)]
31 pub struct PrecomputedTables;
32
33 impl MulBackend<NistP384> for PrecomputedTables {
34 #[inline]
35 fn mul_by_generator(k: &Scalar) -> ProjectivePoint {
36 BASEPOINT_TABLE.mul(k)
37 }
38
39 #[inline]
40 fn mul_by_generator_vartime(k: &Scalar) -> ProjectivePoint {
41 BASEPOINT_TABLE.mul_vartime(k)
42 }
43 }
44}