pub fn scalar_mul_point<const LIMBS: usize>(
k: &FieldElement<LIMBS>,
point: &JacobianPoint<LIMBS>,
params: &CurveParams<LIMBS>,
) -> JacobianPoint<LIMBS>Expand description
Scalar multiplication using the constant-time Montgomery ladder.
Computes k * P for a scalar k and a non-infinity point P.
§Constant-time properties
- Fixed iteration count
LIMBS * 64– independent ofk. - Each iteration performs exactly one
ct_swap, onepoint_add_ctand onepoint_double, in that order. No branch depends on any scalar bit beyond thect_swapmask. point_doubleandpoint_add_ctthemselves are uniform: they always compute the generic formulas and then apply branchless selects for theZ == 0(infinity) edge cases that occur during the leading-zero bits ofk.
§Ladder invariant
At every step of the scan, R1 - R0 == P. This guarantees that
point_add_ct is never called with R0 == R1 (which would require
P == O; P is assumed non-infinity). The R0 == -R1 case is
algebraically valid (the formulas give Z3 = 0 = infinity) and
therefore handled with no special-casing.