Checked public affine-pair addition
This helper specializes public mixed Jacobian addition when every finite
accumulator lane is represented by exactly Z=1. The Schnorr scheduler selects
this grouping once when encoded_terms <= 8 * buckets, including GLV expansion
and the generator term. It classifies current bucket state when flushing its
bounded descriptor queue, prefers uniform groups and fills short groups through
the ordinary mixed path. Denser calls use the generic queue without this
classification. PublicSimdPoint::is_affine_z1() classifies the representation;
PublicSimdPoint4::add_affine_z1() checks the representation
again and falls back to the ordinary mixed formula if any relevant lane fails.
All coordinates enter through the existing opaque, validated point types.
There is no unchecked affine import and no secret-key path uses this code.
For finite, nonexceptional lanes let H=qx-X, R=qy-Y, HH=H²,
HHH=H*HH, and V=X*HH. The existing mixed formula with Z=1 becomes:
X' = R² - HHH - 2V
Y' = R*(V-X') - Y*HHH
Z' = H
This uses 4 multiplications and 2 squarings, compared with 8 multiplications
and 3 squarings in the ordinary mixed formula. H receives one additional weak
normalization so that Z' retains the point-storage bound. The formula is the
ordinary Jacobian affine-pair specialization described by the
Explicit-Formulas Database,
derived here directly from the existing local mixed formula.
The current accumulator bounds are X<=6,Y<=3,Z<=2. An incoming affine qx
has magnitude one, while signed qy may have magnitude two. Before reduction,
H is bounded by eight and R by six. Weak normalization gives H<=1;
all products and squares therefore respect the existing input limit of eight.
The ordinary expression for X' has magnitude at most six. The second product
in Y' is negated at magnitude one and added to a magnitude-one first product,
giving Y'<=3. The product input V-X' has magnitude at most eight. Finally,
Z'=H<=1, which is within the existing storage bound of two. The largest
limb-wise negation used here is the unchanged negate(6) operation.
Finite H=0,R=0 lanes select the established doubling formula. Finite
H=0,R!=0 lanes select identity. R=0,H!=0 horizontal chords use the regular
formula. An identity accumulator selects the signed affine input; an identity
affine input preserves the accumulator. Only finite input pairs require exact
unit Z; ignored identity coordinates cannot force an incorrect shortcut.
The representation predicate intentionally accepts only the literal limb
encoding of one, not every representation congruent to one modulo the field.
False negatives merely use the checked fallback.
Native differential tests cover every identity mask, both signs, equal and
opposite points, horizontal chords, unit/nonunit Z mixtures, lazy negative
coordinates, and eight updates of 100 unrelated buckets constructed within the
same test call. Results and subsequent doubling/full additions match the
existing complete scalar group implementation. The native lane model retains
checked arithmetic and overflow checks. Formula counts describe field work;
complete IC measurements also include scheduling, preparation and page charges.
See the current measured choices for installed qualification
and exact artifact links. Public-only radix-32 GLV preparation, full-field
weights, raw/hint validation and complete failure handling remain separate from
this point-formula choice.
Frozen native receipt, 2026-10-26: 53 secp tests and 26 batch tests passed with
cdk-rsx-crypto-batch/wasm-msm-simd, offline and with checked native arithmetic.
The point-source SHA-256 is
240beffe3ee84fab9d90f4598b8fbf11e7daeb3f30ef4ded091ebb44668f39ed;
the test-source SHA-256 is
1a1b0926977661fef608c4aec1791884941832566a0b724ddfcdaedb9c3dfd2f.
The saved private log is crypto/tmp/fp4-affine-z1-full-native.log, SHA-256
b400461ef0041caca06e27a44691b2e8ab3880acfc40fb941664757d6f866a61.