Elliptic arithmetic notes / 08

Curve validation and subgroups

Peer-supplied points cross the protocol's input boundary. Validation establishes that they belong to the curve and subgroup required by the scalar-multiplication step.

The protocols considered here use a specified prime-order subgroup. Domain-parameter validation establishes that group, and public-key validation checks that received points belong to it.

Domain parameters

For a short-Weierstrass prime-field curve, parameters include

\[(p,a,b,G,n,h),\]

where \(G\) has prime order \(n\) and \(\#E(\mathbb F_p)=nh\). We assume \(\gcd(n,h)=1\), as for the named parameter sets considered here; then \(\langle G\rangle\) is the unique subgroup of order \(n\).

Public point validation

For a decoded affine public point \(Q=(x,y)\):

  1. reject invalid encodings and noncanonical field elements;
  2. reject infinity unless the protocol explicitly permits it;
  3. check \(y^2=x^3+ax+b\);
  4. check subgroup membership, commonly \([n]Q=\mathcal O\) or a validated equivalent.

For a domain parameter set with prime base-point order \(n\) and cofactor \(h=1\), the on-curve check plus non-infinity already puts a point in the prime-order group because \(\#E(\mathbb F_p)=n\). This is the P-256 situation. For \(h>1\), on-curve points can lie outside \(\langle G\rangle\), so the subgroup test supplies additional information. Under the coprimality assumption above, a nonidentity point satisfying \([n]Q=\mathcal O\) belongs to \(\langle G\rangle\).

uint32_t p256_validate_public(const p256_affine_t *q) {
    if (q->infinity != 0u) return 0u;
    if (p256_affine_on_curve(q) == 0u) return 0u;
    return 1u; /* P-256 has cofactor 1; other curves may need an explicit subgroup check. */
}

The wrapper above assumes decoding has already checked canonical coordinates, or that p256_affine_on_curve includes that check. Checking only the curve equation modulo \(p\) would also accept unreduced integer encodings. The full validation steps follow SEC 1, Section 3.2.2.

Invalid-curve and small-subgroup failures

If a scalar multiplication accepts arbitrary points, an attacker may send a point on another curve or in a small subgroup. Repeated interactions can reveal information about a secret scalar modulo small factors.

Example: small subgroup

Suppose the curve contains a point \(T\) of order 4 and the implementation accepts it as a peer key. The four possibilities for \([d]T\) depend only on \(d\bmod4\); an observable output or key-confirmation test may let the attacker distinguish them. Cofactor 4 alone does not guarantee an order-4 point: the 2-primary subgroup may instead be \((\mathbb Z/2\mathbb Z)^2\). Leaks modulo distinct coprime orders can be combined by the Chinese remainder theorem.

Example: invalid curve

The addition and doubling formulas displayed in this series use \(a\) but not \(b\). Consequently, they also operate on a nonsingular curve \(y^2=x^3+ax+b'\) with the same \(a\). Checking the intended curve equation rejects such points before secret scalar multiplication.

SageMath validation check

p = 17
E = EllipticCurve(GF(p), [1, 4])
n, h = 7, 2
G = E(4, 2)   # prime-order base point
T = E(3, 0)   # on-curve point of order 2
print(E.order() == n*h)
print(G in E, G.order(), n*G == E(0))
print(T in E, T.order(), n*T == E(0))

The point T passes the curve equation but fails the prime-subgroup check because n*T is not infinity. That is the distinction validation must preserve.

Protocol boundary

The arithmetic library provides the validation operations, and the protocol specifies when their results may be reused for an already validated key. For the short-Weierstrass ECDH setting here, canonical decoding and the curve-equation check establish an on-curve point. An explicit subgroup test or a specified cofactor operation then establishes the required subgroup behavior, including rejection of an identity result where required. Cofactor multiplication alone does not validate the curve equation. ECDSA verification likewise uses a validated public key.