]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[crypto] Add support for Weierstrass elliptic curve point multiplication
authorMichael Brown <mcb30@ipxe.org>
Wed, 22 Jan 2025 13:00:03 +0000 (13:00 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 28 Jan 2025 16:32:12 +0000 (16:32 +0000)
commitbe9ce490768dd4060fa4737ca5f50777ba6a15a8
treec8a352215116ffa4b55dca7b2940b91236ce1ba7
parent66b5d1ec81433d4cbc218ed18f2e4ee04d51aa38
[crypto] Add support for Weierstrass elliptic curve point multiplication

The NIST elliptic curves are Weierstrass curves and have the form

  y^2 = x^3 + ax + b

with each curve defined by its field prime, the constants "a" and "b",
and a generator base point.

Implement a constant-time algorithm for point addition, based upon
Algorithm 1 from "Complete addition formulas for prime order elliptic
curves" (Joost Renes, Craig Costello, and Lejla Batina), and use this
as a Montgomery ladder commutative operation to perform constant-time
point multiplication.

The code for point addition is implemented using a custom bytecode
interpreter with 16-bit instructions, since this results in
substantially smaller code than compiling the somewhat lengthy
sequence of arithmetic operations directly.  Values are calculated
modulo small multiples of the field prime in order to allow for the
use of relaxed Montgomery reduction.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/crypto/weierstrass.c [new file with mode: 0644]
src/include/ipxe/errfile.h
src/include/ipxe/weierstrass.h [new file with mode: 0644]