Fast and Secure Elliptic Curve Scalar Multiplication Over Prime Fields Using Special Addition Chains
Fast and Secure Elliptic Curve Scalar Multiplication Over Prime Fields Using Special Addition Chains
Nicolas Meloni1,2
1
Institut de Mathmatiques et de Modlisation de Montpellier,
UMR 5149, Montpellier, France
2
Laboratoire d’Informatique,
de Robotique et de Microélectronique de Montpellier,
CNRS UMR 5506, Montpellier, France
[email protected]
Abstract. In this paper, we propose a new fast and secure point mul-
tiplication algorithm. It is based on a particular kind of addition chains
involving only additions (no doubling), providing a natural protection
against side channel attacks. Moreover, we propose new addition formu-
lae that take into account the specific structure of those chains making
point multiplication very efficient.
1 Introduction
Since it has been introduced by Miller and Koblitz in [12, 9], elliptic curve
cryptography (ECC) has been the subject of plenty of improvements and
attacks. Various methods has been proposed to speed up and secure the
computation of the scalar point multiplication (the computation of kP
where k is an integer and P a point of a curve). See [3, 4] for a complete
overview of methods.
In this paper, we study a very particular kind of addition chains (that
we called Special Addition Chains) that leads to a natural side channel
analysis (SCA) resistant exponentiation algorithm. Moreover we show
that it is very well suited to general and Montgomery elliptic curves over
prime fields, giving rise to a fast and secure point multiplication.
After some recall about ECC, we introduce special addition chains (SAC)
and the way they can be adapted to ECC. Then we study more precisely
the length of such chains and finally compare them to other SCA resistant
algorithms.
2 Background
y 2 = x3 + ax + b
where a, b ∈ K and 4a + 27b2 6= 0, over field of characteristic greater
3
than 3.
The set of points of E/K is an abelian group. There exist explicit for-
mulae to compute the sum of two points, and several coordinate sys-
tems have been proposed to speed up this computation. For a com-
plete overview of those coordinates, one can refer to [3]. As an example,
in jacobian coordinates, the curve E (over a prime field) is given by
Y 2 = X 3 + a4 XZ 4 + a6 Z 6 , the point (X, Y, Z) on E correspond to the
affine point ( ZX2 , ZY3 ) and the formulae are :
Addition:
P = (X1 , Y1 , Z1 ), Q = (X2 , Y2 , Z2 ) and P + Q = (X3 , Y3 , Z3 )
and
Doubling:
[2]P = (X3 , Y3 , Z3 )
and
EM : By 2 = x3 + Ax2 + x
Note that curves in Montgomery form can always be converted into short
classic form, however the converse is false.
On such curves the addition and doubling formulae are the following :
Addition: n 6= m
Doubling: n = m
where (Xn , Yn , Zn ) represent the point [n]P , for a given point P . Thus,
an addition takes 4M and 2S whereas a doubling needs 3M and 2S.
Finally, one should notice that there exist formulae to recover the y-
coordinate at the end of a point multiplication [14].
Side channel attacks have been discovered by Kocher in [10, 11]. They
consist in deducing secret informations, as the bits of the exponent in a
point multiplication, by analysing the amount of time required to per-
form secret operations, but also power consumption or electromagnetic
radiations. This weakness mainly depends on the fact that during a point
multiplication, additions are more expensive than doublings, thus a side-
channel analysis allows to deduce what kind of operations are computed,
and so to guess the bits of the exponent.
Several counter measures have been proposed against this threat. We
can cite for example the use of dummy operations during the process in
order to make the group operations look identical, side channel atomic-
ity which consist in splitting the curve operations into identical atomic
blocks, Montgomery ladder or elliptic curve in Hessian form [1, 3, 5].
v = (v0 , . . . , vs ), v0 = 1, vs = k
vi = vi1 + vi2 f or 1 ≤ i ≤ s with
w = (w1 , . . . , ws ), wi = (i1 , i2 ) and 0 ≤ i1 , i2 ≤ i − 1
∀i, wi = (i − 1, j),
for some j such that 0 ≤ j ≤ i − 1. That is to say that for all i we have
vi = vi−1 + vj .
In this case we can omit i − 1 an just write wi = j.
One can find lot of literature about addition chains [7] and how they are
used in exponentiation problems.
Definition
5. A special addition chain is a star addition chain with
i − 2 or
wi =
wi−1
v0 = 1, v1 = 2, v2 = 3,
vi−1 if wi+1 = 0
vi = vi−1 + vj ⇒ vi+1 = vi +
vj if wi+1 = 1
Example 1. 34 = (1, 0, 0, 1, 1, 0)
v2 = v1 + v0 = 2 + 1 and w3 = 1 ⇒ v3 = v2 + v0 = 4
w4 = 0 ⇒ v4 = 4 + 3
w5 = 0 ⇒ v5 = 7 + 4
w6 = 1 ⇒ v6 = 11 + 4
w7 = 1 ⇒ v7 = 15 + 4
w8 = 0 ⇒ v8 = 19 + 15 = 34
Given a point P on an elliptic curve E, an integer k and w = (w3 , . . . , ws )
an special addition chain computing k, it is easy to deduce the following
exponentiation algorithm :
Algorithm 1: AddExp(k, P )
Data: P ∈ E and k = (w3 , . . . , ws );
Result: [k]P ∈ E;
(U1 , U2 , U3 ) ← (P, [2]P, [3]P );
for i = 3 . . . s do
if wi = 0 then
U1 ← U2 ;
end
U2 ← U3 ;
U3 ← U1 + U2 ;
end
return U3
Z3 = Z 2 (X2 Z 2 − X1 Z 2 )
= Z(X2 − X1 )Z 3
= Z30 Z 3
Thus we have (X3 , Y3 , Z3 ) = (X30 Z 6 , Y30 Z 9 , Z30 Z 3 ) ∼ (X30 , Y30 , Z30 ).
So when P and Q have the same z-coordinate, P + Q can be obtained
using the following formulae:
Addition:
P = (X1 , Y1 , Z), Q = (X2 , Y2 , Z) and P + Q = (X30 , Y30 , Z30 )
A = (X2 − X1 )2 , B = X1 A, C = X2 A, D = (Y2 − Y1 )2
and
Two questions rise from the previous sections: can any integer be ob-
tained using a special addition chain and how to find such a chain ?
The following example answer both questions :
Example 2. Let k = 34 and k0 = 19 and let apply them the subtractive
form of Euclid’s algorithm:
34 − 19 = 15
19 − 15 = 4
15 − 4 = 11
11 − 4 = 7
7−4 = 3
4−3 = 1
3−1 = 2
2−1 = 1
1−1 = 0
Before tackling this problem, we need to make some basic recall about
the Fibonacci sequence.
Definition
8 6. The Fibonacci sequence is defined as follow :
< 0 if n = 0
Fn = 1 if n = 1
Fn−1 + Fn−2 if n ≥ 2
:
The Fibonacci sequence has hundreds of properties, one can refers to [7]
or [15] to find (almost) them all. We just recall here Binet’s Formulae :
φn
Fn = d √ c
5
where x → dxc is the nearest integer function.
Fn = (0, . . . , 0),
| {z }
n−4 times
We have
k φ2 − φ k
k2 = k − k 0 = k − ( + ) = k( )−= 2 −
φ φ2 φ
k k k φ2 − φ k
k3 = k1 − k0 = + − ( 2 − ) = ( ) + 2 = 3 + 2
φ φ φ φ2 φ
By induction, it comes that :
k
kn = + (−1)n+1 Fn ×
φn
km−1
km+1 = km−1 − km ≥ ,
2
km+2 = km − km+1 ≤0
The previous property show that if n satisfy Fn ×|| < φkn , then algorithm
2 will return a chain with at least n−2 zeros in the end. Now if l(kn−1 , kn )
is the length of the chain returned by algorithm 2 applied to kn−1 and
kn , then, then the length of the total chain is (n − 2) + l(kn−1 , kn ).
Now remember that kn−1 = φn−1 k
+ (−1)n Fn−1 × so if Fn × || < φkn
k
then ln kn−1 ' ln φn−1 . If we estimate l(kn−1 , kn ) with theorem 1 we get
−2 k
l(kn−1 , kn ) ' 6π (ln φn−1 )2 .
As an example, fix n = 100, (that is force || < φ100kF100 ), then we get a
theoretical average length of 2500 (1100 in practice).
Of course it is not a rigorous proof, but this gives a good reason why, on
average, special addition chains are smaller around φk .
So in order to find small addition chains, we begin by testing the value
k0 = d φk c and then we test consecutive integers until we find a sufficiently
small chain. In table 1 we give practical results on the number of itera-
tions one have to make to find chains computing a 160 bit integer smaller
than a fixed length.
The experiments have been made on a 3 GHz Pentium 4, over 10000
random 160-bits integers for chains of length 320 to 270 and 100 random
integers for chains of length 260. On average it takes on average 2.5 ms
to find a 320 length chain, to 3.24 seconds for a 270 length chain. Finding
260 length can take a few minutes to hours.
Note that for a 160-bit integer k, lmin (k) = 234, but it is difficult to
look for chains of length around 240 ( we are not even sure that such
chains always exist ). However the longer the chains are, the easier it is
to find them, so that we can find small chains relatively easily, even if,
the computation time of the chain itself being greater than the one of
the point multiplication, our method has to be restricted to protocols
where the exponent k is part of the secret key (allowing to look for very
small chains off-line).
chain length on average worst case
320 29 521
300 121 3 454
280 2 353 44 254
270 46 454 1 554 011
260 7 795 840 79 402 210
Table 1. Number of iterations needed to find a chain computing a 160 bit integer,
using a ”clever” exhaustive approach
Despite this limitation, we are going to see in the next section that special
addition chains allow efficient point multiplication and may be taken into
consideration in the future.
Algorithm #M
Montgomery ladder 1622
SAC 300 1680
SAC 280 1568
SAC 260 1456
Table 2. Comparison between Montgomery ladder and SAC in Fp for a 160-bit expo-
nent
With chains of length 280 and 260 we obtain a gain of, respectively, 3
and 10 %.
5.2 General curves over Fp
In the case of general curves, protecting the classic algorithms against
SCA implies the use of side channel atomicity, which implies that the ra-
tio S/M is 1 (the same multiplier is used for multiplication and square),
whereas the very structure of special addition chains allows not to have
resort to side channel atomicity (so that we keep the ratio S/M=0.8).
We refer to [2] for a precise study of double-and-add, NAF, 4-NAF and
Double-base chain complexities. For 160-bit integers we obtain:
Algorithm #M
double-and-add 2511
NAF 2214
4-NAF 1983
double-base chain 1863
SAC 300 1983
SAC 280 1851
SAC 260 1719
We remark that the use of special addition chains of length 300 already
have a gain of 21% over double-and-add and 10% over NAF. From chains
of length 280 to 260, we outperform all the previous methods, with a gain
of 26 to 31% over double-and-add, 16 to 22% over NAF, 7 to 13% over
4-NAF and 1 to 8% over double base chain.
6 Conclusions
In this paper, we have proposed a new exponentiation method, based
on special addition chains, that suits very well to Montgomery elliptic
curves and general curves over prime fields. We also have presented new
formulae in the case of general curves that allow to take advantage of the
particular structure of special addition chains. Finally, even if we did not
solve the problem of finding minimal chains, we have shown a way to find
small chains by looking for them in a ”clever” range. All of this leading to
a very simple, efficient and naturally SCA resistant scalar multiplication
algorithms. However it still implies either off-line computation (if k is
part of the secret key) or, if k has to be chosen randomly, to generate
directly the exponent as a special addition chain. In this latest case, a
lot of study will have to be made in order to know how to generate a
”random” chain. Yet we hope that the reader has been seduced by the
originality of our approach and the interesting theoretical questions it
raises.
References
and so
X3 X3
x3 = = 2
Z32 Z (X1 − X2 )2