Parallel Approaches for Efficient Scalar Multiplication Over Elliptic
Total Page:16
File Type:pdf, Size:1020Kb
Parallel Approaches for Efficient Scalar Multiplication over Elliptic Curve Christophe Negre, Jean-Marc Robert To cite this version: Christophe Negre, Jean-Marc Robert. Parallel Approaches for Efficient Scalar Multiplication over Elliptic Curve. SECRYPT, Jul 2015, Colmar, France. pp.202-209, 10.5220/0005512502020209. hal- 01206530 HAL Id: hal-01206530 https://hal.archives-ouvertes.fr/hal-01206530 Submitted on 29 Sep 2015 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Parallel Approaches for Efficient Scalar Multiplication over Elliptic Curve Christophe Negre1 and Jean-Marc Robert1 1 Equipe DALI (Universit´ede Perpignan) and LIRMM (Univ. de Montpellier, CNRS), Perpignan, France fchristophe.negre, [email protected] Keywords: Elliptic curve, parallel implementation, scalar multiplication, prime field, binary field. Abstract: This paper deals with parallel implementation of scalar multiplication over an elliptic curve. We present parallel approaches which split the scalar into two parts for E(Fp) or three parts for E(F2m ) and perform in parallel the scalar multiplication with each part of the scalar. We present timing results of these approaches implemented over an Intel Core i7 for NIST binary curves B233, B409 and for the twisted Edwards curve Curve25519 (Bernstein, 2006). For the curves B409 and Curve25519 the proposed approaches improve by at least 10% the computation time of the scalar multiplication. 1 INTRODUCTION per and lower part, and we compute scalar mul- tiplication of each part in parallel. This requires Elliptic curve cryptographic protocols gener- an additional sequence of doublings or halvings ally involve one or two scalar multiplications on to finish the upper part computations before the curve. A scalar multiplication consists in adding the two computed points. We have ex- computing kP = P + + P where k is an inte- perimented this approach and the resulting tim- ger of several hundreds··· of bits and P is a point on ings show some interesting speed-up for the NIST the curve. This is generally performed through a curve B409 and also for the twisted Edward curve sequence of hundreds of doublings and additions Curve25519 (Bernstein, 2006). on the curve using the so-called double-and-add The remaining of the paper is organized as algorithm. It is thus a time consuming part of follows: in Section 2 we review basic results on the cryptographic protocols. elliptic curves over binary and prime fields. In Actual and future processors on personal com- Section 3 we present our approaches for the par- puters and embedded devices will include an in- allelization of scalar multiplication. In Section 4 creasing number of cores, enabling more paral- we provide experimental results and we end the lelism. The implementation of scalar multiplica- paper with some concluding remarks in Section 5. tion might be adapted to these new platforms. A recent interesting work of Taverne et al. (Taverne et al., 2011) on binary elliptic curves showed that 2 REVIEW OF ELLIPTIC a curve scalar multiplication can be parallelized CURVE SCALAR through a (double,halve)-and-add approach re- sulting in an interesting speed-up. GLV (Gal- MULTIPLICATION lant et al., 2001) is another popular approach to perform a scalar multiplication in parallel fash- An elliptic curve over a finite field Fq is the set 2 ion (Longa and Sica, 2014; Oliveira et al., 2014), of points (x; y) Fq satisfying a smooth equation but unfortunately GLV cannot be used on stan- of degree 3 plus2 a point at infinity . A commuta- dard curves (P. Gallagher and Furlani, 2009). tive group law can be defined on thisO set of points We explore in this paper an alternative par- using the chord and tangent method. This pro- allel approach. We split the scalar k in an up- vides doubling and addition formulas consisting in a number of field operations on the coordinates we know the difference R = Q P , then we of the points. The complexity of these formu- can compute Q + P as follows: − las can be reduced by choosing appropriate curve (x x 1)2 equation and system of coordinates. In the re- Q P xQ+P = − 2 : (4) xR(xP xQ) maining of this section, we review curve equation − and point operation formulas in the case of ellip- Montgomery curves and twisted Edwards curves tic curve defined over binary field and prime field. are isomorphic. A conversion of the point coor- We also review classical algorithms for scalar mul- dinates between these two curves requires only a tiplication. few field operations. 2.1 Point operations in E(Fp) The formulas in (1), (2) and (3) involve a field inversion which is generally a costly operation. An elliptic curve E(Fp) over a prime field Fp is Alternative coordinate systems have been pro- generally defined by a short Weierstrass equation: posed in the case of Weierstrass, Montgomery, 2 3 2 twisted Edwards and Jacobi quartic in order to E : y = x + ax + b with (a; b) Fp: 2 avoid field inversions and reduce the number of In this case addition and doubling formulas given field multiplications: by the chord and tangent method are as follows: Extended coordinate system where a quadru- let P1 = (x1; y1);P2 = (x2; y2) and P3 = (x3; y3); • plet (X; Y; Z; T ) represents the points x = be three points on E(Fp) such that P3 = P1 + P2, X=Z; y = Y=Z and T=Z = xy. then we have: Regular projective coordinates where a triplet 2 x3 = λ x1 x2; • − − (X; Y; Z) represents a point x = X=Z; y = y3 = λ(x1 x3) y1; − − Y=Z. ( y2−y1 (1) λ = if P1 = P2; x2−x1 Inverted coordinates : a triplet (X; Y; Z) cor- where 2 6 3x1+a • λ = + x1 if P1 = P2: responds to a point x = Z=X and y = Z=Y . 2y1 The cost of a doubling, an addition and a In the sequel we will use the two following al- mixed addition in these coordinate systems are ternative elliptic curve equations: given in Table 1. Twisted Edwards (Hisil et al., 2008). The • twisted Edwards elliptic curve equation is as 2.2 Operations in binary elliptic follows: 2 2 2 2 curves ax + y = 1 + dx y where a and d are two elements in Fp. In this An elliptic curve over a binary field is generally case there is an unified addition and doubling defined by the following short Weierstrass equa- formula: if P1 = (x1; y2) and P2 = (x2; y2) are tion: in E( p), then the affine coordinates (x3; y3) F 2 3 2 of P3 = P1 + P2 are as follows: E : y + xy = x + ax + b with a; b F2m : (5) 2 x3=(x1y2 + y1x2)=(1 + dx1x2y1y2); The formulas for addition, doubling and halving (2) y3=(y1y2 ax1x2)=(1 dx1x2y1y2): on E( m ) are as follows: − − F2 Addition and doubling. We consider two Montgomery curves (Montgomery, 1987). We • • consider Montgomery elliptic curves which points P1 = (x1; y1) and P2 = (x2; y2) on have the following form: the curve E(F2m ). The coordinates (x3; y3) of P = P + P are given by the following 2 3 2 2 3 1 2 E : by = x + ax + x with (a; b) Fp: 2 formula: 2 Montgomery noticed in (Montgomery, 1987) x3 = λ + λ + x1 + x2 + a; that for Q = (xQ; yQ) the x-coordinate of 2Q y3 = (x1 + x3)λ + x3 + y1; depends only on xQ: y1+y2 (6) if P1 = P2; x1+x2 2 2 where λ = y1 6 (x 1) + x1 if P1 = P2: Q x1 x2Q = − : (3) 4x (x2 + ax + 1) Q Q Q Point halving. In (Knudsen, 1999), Knudsen • Moreover, Montgomery noticed that given two noticed that if a point Q = (u; v) on E(F2m ) 1 points Q = (xQ; yQ) and P = (xP ; yP ) and if is of odd order, then the point P = 2 Q in Table 1 { Complexity of curve operations in E(Fp) Curve form Coordinates Doubling mixed Addition Addition Weierstrass (a = −3) Jacobian 4M + 4S 8M + 3S 12M + 4S Twisted Edwards Inverted 3M + 4S + Ma + M2d 8M + 1S + Ma + Md 9M + 1S + Ma + Md Jacobi quartic XXYZZ coord. 3M + 4S 6M + 3S + Ma−1 7M + 4S + Ma−1 Montgomery Projective 2M + M(a+2)=4 + 2S - 4M + 2S Table 2 { Complexity of curve operation in E(F2m ) when a = 1 Coordinates Doubling Halving Mixed-addition Doubling-mixed-addition Addition Affine 2M + I 1M + 1SqRt + 1QS - 4M + 2I 2M + I Lopez-Dahab 4M + 5S - 9M + 4S 13M + 4S 13M + 9S Kim-Kim 4M + 5S - 8M + 4S 12M + 9S 12M + 4S Lambda proj. 4M + 4S - 8M + 2S 10M + 6S 11M + 4S the subgroup generated by Q is well defined. For explicit point addition and doubling formulas Knudsen also noticed that the computation in these projective coordinate systems the reader of the coordinates of P in terms of the coor- may refer to (Hankerson et al., 2004; Kim and dinates of Q can be computed efficiently. In- Kim, ; Oliveira et al., 2014). In Table 2 we report deed, since Q = 2P and we can use (6) to the corresponding cost of each point operation on derive the coordinates of P = (x; y) in terms the curve when a = 1. We do not report the com- of Q = (u; v) as follows: plexity of a point halving in projective coordinate systems, since in this case the quadratic solver re- λ = x + y=x (7) quires a field inversion and makes the halving in- 2 u = λ + λ + a (8) efficient.