Elliptic curve point multiplication

Elliptic curve point multiplication is the operation of successively adding a point along an elliptic curve to itself repeatedly. It is used in elliptic curve cryptography (ECC) as a means of producing a trapdoor function. The literature presents this operation as scalar multiplication, thus the most common name is "elliptic curve scalar multiplication", as written in Hessian form of an elliptic curve.

Basics

Given a curve, E, defined along some equation in a finite field (such as E: y2 = x3 + ax + b), point multiplication is defined as the repeated addition of a point along that curve. Denote as nP = P + P + P + … + P for some scalar (integer) n and a point P = (x, y) 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 Q = nP given known values of Q and P. It is known as the elliptic curve discrete logarithm problem.

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.

\begin{align}
                    P + Q &= R \\
  (x_p, y_p) + (x_q, y_q) &= (x_r, y_r)
\end{align}.

Assuming the elliptic curve, E, is given by y2 = x3 + ax + b, this can be calculated as:

\begin{align}
      x_r &= \lambda^2 - x_p - x_q \\
      y_r &= \lambda(x_p - x_r) - y_p \\
  \lambda &= \frac{y_q - y_p}{x_q - x_p}
\end{align}

Point doubling

Where the points, P and Q, are coincident, addition is similar, except that there is no well-defined straight line through P and Q, so the operation is closed using limiting case, the tangent to the curve, E, at P and Q.

This is calculated as above, except with:

\lambda = \frac{3x_p^2 + a}{2y_p}

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,[1] similar to multiply-and-square in modular exponentiation. The algorithm works as follows:

To compute dP, start with the binary representation for d: \scriptstyle d ~=~ d_0 \,+\, 2d_1 \,+\, 2^2d_2 \,+\, \cdots \,+\, 2^md_m, where [\scriptstyle d_0  ~..~  d_m] ∈ {0,1}

  Q ← 0
  for i from 0 to m do
     if di = 1 then
         Q ← point_add(Q, P)
     Q ← point_double(Q)
  return Q

An alternative way of writing the above as a recursive function is

  f(P, n) is
     if n = 0 then
         return 0                        # computation complete
     else if n = 1 then
         return P
     else if n mod 2 = 1 then
        return point_add(P, f(P, n - 1)) # addition when n is odd
     else
        return f(point_double(P), n/2)   # doubling when n is even

where f is the function for doubling, P is the coordinate to double, n is the number of times to double the coordinate. Example: 100P can be written as 2(2[P + 2(2[2(P + 2P)])]) and thus requires six doublings and two additions. 100P would be equal to f(P, 100).

This algorithm requires log2(n) 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,[1] one selects a window size w and computes all \scriptstyle 2^w values of \scriptstyle dP for \scriptstyle d ~=~ 0,\, 1,\, 2,\, \dots,\, 2^w \,-\, 1. The algorithm now uses the representation \scriptstyle d ~=~ d_0 \,+\, 2^wd_1 \,+\, 2^{2w}d_2 \,+\, \cdots \,+\, 2^{mw}d_m and becomes

  Q ← 0
  for i from m to 0 do
      Q ← point_double_repeat(Q, w)
      if di > 0 then
          Q ← point_add(Q, diP) # 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 (which in practice are slower than doubling). 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, \scriptstyle w ~=~ 4 is usually the best selection. The entire complexity for a n-bit number is measured as \scriptstyle n \,+\, 1 point doubles and \scriptstyle 2^w \,-\, 2 \,+\, \frac{n}{w} 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 \scriptstyle dP for \scriptstyle d ~=~ 2^{w-1},\, 2^{w-1} \,+\, 1,\, \dots,\, 2^w \,-\, 1. 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 \scriptstyle d ~=~ d_0 \,+\, 2d_1 \,+\, 2^2d_2 \,+\, \cdots \,+\, 2^md_m.

  Q ← 0
  for i from m downto 0 do
     if di = 0 then
        Q ← point_double(Q)
     else 
        t ← extract j (up to w − 1) additional bits from d (including di)
        i ← i − j
        if j < w then
           Perform double-and-add using t 
           return Q
        else 
           Q ← point_double_repeat(Q, w)
           Q ← point_add(Q, tP)
  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. The algorithm requires \scriptstyle w \,-\, 1 \,+\, n point doubles and at most \scriptstyle 2^{w-1} \,-\, 1 \,+\, \frac{n}{w} point additions.

w-ary non-adjacent form (wNAF) 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 (of either) as compared to a sliding-window method. The NAF of the multiplicand \scriptstyle d must be computed first with the following algorithm

   i ← 0
   while (d > 0) do
       if (d mod 2) = 1 then 
           di ← d mods 2w
           d ← d − di
       else
           di = 0
       d ← d/2
       i ← i + 1
   return (di−1, di-2, …, d0)

Where the mods function is defined as

   if (d mod 2w) >= 2w−1
       return (d mod 2w) − 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 \scriptstyle \lbrace 1,\, 3,\, 5,\, \dots,\, 2^{w-1} \,-\, 1 \rbrace P and their negatives, where \scriptstyle P is the point to be multiplied. On typical Weierstrass curves, if \scriptstyle P ~=~ \lbrace x,\, y \rbrace then \scriptstyle -P ~=~ \lbrace x,\, -y \rbrace. So in essence the negatives are cheap to compute. Next, the following algorithm computes the multiplication \scriptstyle dP:

   Q ← 0
   for j ← i − 1 downto 0 do
       Q ← point_double(Q)
       if (dj != 0)
           Q ← point_add(Q, djG)
   return Q

The wNAF guarantees that on average there will be a density of \scriptstyle \frac{1}{w \,+\, 1} point additions (slightly better than the unsigned window). It requires 1 point doubling and \scriptstyle 2^{w-2} \,-\, 1 point additions for precomputation. The algorithm then requires \scriptstyle n point doublings and \scriptstyle \frac{n}{w \,+\, 1} point additions for the rest of the multiplication.

One property of the NAF is that we are guaranteed that every non-zero element \scriptstyle d_i is followed by at least \scriptstyle w \,-\, 1 additional zeroes. This is because the algorithm clears out the lower \scriptstyle w bits of \scriptstyle d 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 \scriptstyle 2^w after every non-zero \scriptstyle d_i element and divide by 2 after every zero.

Montgomery ladder

The Montgomery ladder[2] 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, R1)
        R0 ← point_double(R0)
     else
        R0 ← point_add(R0, R1)
        R1 ← point_double(R1)
  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, the full private key can be revealed in only one multiplication operation.[3]

References

  1. 1 2 Hankerson, Darrel; Vanstone, Scott; Menezes, Alfred (2004). Guide to Elliptic Curve Cryptography. Springer Professional Computing. New York: Springer-Verlag. doi:10.1007/b97644. ISBN 0-387-95273-X. MR 2054891.
  2. Montgomery, Peter L. (1987). "Speeding the Pollard and elliptic curve methods of factorization". Math. Comp. 48 (177): 243–264. doi:10.2307/2007888. MR 0866113.
  3. Benger, Naomi; Van de Pol, Joop; Smart, Nigel P.; Yarom, Yuval (2014). Betina, Lejla; Robshaw, Matthew, eds. “Ooh Aah... Just a Little Bit” : A Small Amount of Side Channel Can Go a Long Way. Cryptographic Hardware and Embedded Systems – CHES 2014. Lecture Notes in Computer Science. Springer. pp. 72–95. doi:10.1007/978-3-662-44709-3_5. ISBN 978-3-662-44708-6.
This article is issued from Wikipedia - version of the Wednesday, May 04, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.