Elliptic curve point multiplication


Elliptic curve scalar multiplication is the operation of successively adding a point along an elliptic curve to itself repeatedly. It is used in elliptic curve cryptography as a means of producing a one-way function.
The literature presents this operation as scalar multiplication, as written in Hessian form of an elliptic curve. A widespread name for this operation is also elliptic curve point multiplication, but this can convey the wrong impression of being a multiplication between two points.

Basics

Given a curve, E, defined along some equation in a finite field, point multiplication is defined as the repeated addition of a point along that curve. Denote as for some scalar n and a point that lies on the curve, E. This type of curve is known as a Weierstrass curve.
The security of modern ECC depends on the intractability of determining n from given known values of Q and P if n is large. This is because the addition of two points on an elliptic curve yields a third point on the elliptic curve whose location has no immediately obvious relationship to the locations of the first two, and repeating this many times over yields a point nP that may be essentially anywhere. Intuitively, this is not dissimilar to the fact that if you had a point P on a circle, adding 42.57 degrees to its angle may still be a point "not too far" from P, but adding 1000 or 1001 times 42.57 degrees will yield a point that may be anywhere on the circle. Reverting this process, i.e., given Q=nP and P and determining n can therefore only be done by trying out all possible n—an effort that is computationally intractable if n is large.

Point operations

There are three commonly defined operations for elliptic curve points, addition, doubling and negation.

Point at infinity

Point at infinity is the identity element of elliptic curve arithmetic. Adding it to any point results in that other point, including adding point at infinity to itself.
That is:
Point at infinity is also written as.

Point negation

Point negation is finding such a point, that adding it to itself will result in point at infinity.
For elliptic curves that is a point with the same x coordinate but negated y coordinate:

Point addition

With 2 distinct points, P and Q, addition is defined as the negation of the point resulting from the intersection of the curve, E, and the straight line defined by the points P and Q, giving the point, R.
Assuming the elliptic curve, E, is given by, this can be calculated as:
These equations are correct when neither point is the point at infinity,. This is important for the ECDSA verification algorithm where the hash value could be zero.

Point doubling

Where the points P and Q, are coincident, addition is similar, except that there is no well-defined straight line through P, so the operation is closed using limiting case, the tangent to the curve, E, at P.
This is calculated as above, except with:
where a is from the defining equation of the curve, E, above.

Point multiplication

The straightforward way of computing a point multiplication is through repeated addition. However, this is a fully exponential approach to computing the multiplication.

Double-and-add

The simplest method is the double-and-add method, similar to multiply-and-square in modular exponentiation. The algorithm works as follows:
To compute dP, start with the binary representation for d:, where.
There are two possible iterative algorithms.
Iterative algorithm, index increasing:
N ← P
Q ← 0
for i from 0 to m do
if di = 1 then
Q ← point_add
N ← point_double
return Q
Iterative algorithm, index decreasing:
Q ← 0
for i from m down to 0 do
Q ← point_double
if di = 1 then
Q ← point_add
return Q
An alternative way of writing the above as a recursive function is
f is
if d = 0 then
return 0 # computation complete
else if d = 1 then
return P
else if d mod 2 = 1 then
return point_add # addition when d is odd
else
return f # doubling when d is even
where f is the function for multiplying, P is the coordinate to multiply, d is the number of times to add the coordinate to itself. Example: 100P can be written as and thus requires six point double operations and two point addition operations. 100P would be equal to f.
This algorithm requires log2 iterations of point doubling and addition to compute the full point multiplication. There are many variations of this algorithm such as using a window, sliding window, NAF, NAF-w, vector chains, and Montgomery ladder.

Windowed method

In the windowed version of this algorithm, one selects a window size w and computes all values of for. The algorithm now uses the representation and becomes
Q ← 0
for i from m to 0 do
Q ← point_double_repeat
if di > 0 then
Q ← point_add # using pre-computed value of diP
return Q
This algorithm has the same complexity as the double-and-add approach with the benefit of using fewer point additions. Typically, the value of w is chosen to be fairly small making the pre-computation stage a trivial component of the algorithm. For the NIST recommended curves, is usually the best selection. The entire complexity for a n-bit number is measured as point doubles and point additions.

Sliding-window method

In the sliding-window version, we look to trade off point additions for point doubles. We compute a similar table as in the windowed version except we only compute the points for. Effectively, we are only computing the values for which the most significant bit of the window is set. The algorithm then uses the original double-and-add representation of.
Q ← 0
for i from m downto 0 do
if di = 0 then
Q ← point_double
else
t ← extract j additional bits from d
i ← i − j
if j < w then
Perform double-and-add using t
return Q
else
Q ← point_double_repeat
Q ← point_add
return Q
This algorithm has the benefit that the pre-computation stage is roughly half as complex as the normal windowed method while also trading slower point additions for point doublings. In effect, there is little reason to use the windowed method over this approach, except that the former can be implemented in constant time. The algorithm requires point doubles and at most point additions.

-ary non-adjacent form (NAF) method

In the non-adjacent form we aim to make use of the fact that point subtraction is just as easy as point addition to perform fewer as compared to a sliding-window method. The NAF of the multiplicand must be computed first with the following algorithm
i ← 0
while do
if = 1 then
di ← d mods 2w
d ← d − di
else
di = 0
d ← d/2
i ← i + 1
return
Where the signed modulo function mods is defined as

if >= 2w−1
return − 2w
else
return d mod 2w
This produces the NAF needed to now perform the multiplication. This algorithm requires the pre-computation of the points and their negatives, where is the point to be multiplied. On typical Weierstrass curves, if then. So in essence the negatives are cheap to compute. Next, the following algorithm computes the multiplication :
Q ← 0
for j ← i − 1 downto 0 do
Q ← point_double
if
Q ← point_add
return Q
The wNAF guarantees that on average there will be a density of point additions. It requires 1 point doubling and point additions for precomputation. The algorithm then requires point doublings and point additions for the rest of the multiplication.
One property of the NAF is that we are guaranteed that every non-zero element is followed by at least additional zeroes. This is because the algorithm clears out the lower bits of with every subtraction of the output of the mods function. This observation can be used for several purposes. After every non-zero element the additional zeroes can be implied and do not need to be stored. Secondly, the multiple serial divisions by 2 can be replaced by a division by after every non-zero element and divide by 2 after every zero.
It has been shown that through application of a FLUSH+RELOAD side-channel attack on OpenSSL, the full private key can be revealed after performing cache-timing against as few as 200 signatures performed.

Montgomery ladder

The Montgomery ladder approach computes the point multiplication in a fixed amount of time. This can be beneficial when timing or power consumption measurements are exposed to an attacker performing a side-channel attack. The algorithm uses the same representation as from double-and-add.
R0 ← 0
R1 ← P
for i from m downto 0 do
if di = 0 then
R1 ← point_add
R0 ← point_double
else
R0 ← point_add
R1 ← point_double
return R0
This algorithm has in effect the same speed as the double-and-add approach except that it computes the same number of point additions and doubles regardless of the value of the multiplicand d. This means that at this level the algorithm does not leak any information through timing or power.
However, it has been shown that through application of a FLUSH+RELOAD side-channel attack on OpenSSL, the full private key can be revealed after performing cache-timing against only one signature at a very low cost.