Recent Advances in Parallel Implementations of Scalar Multiplication over Binary Elliptic Curves
- C. Negre and J.M. Robert
april 8, 2015
1 / 39
Recent Advances in Parallel Implementations of Scalar Multiplication - - PowerPoint PPT Presentation
Recent Advances in Parallel Implementations of Scalar Multiplication over Binary Elliptic Curves C. Negre and J.M. Robert april 8, 2015 1 / 39 Outline Overview of elliptic curve cryptography 1 Implementation of F 2 m arithmetic 2 Elliptic
1 / 39
2 / 39
3 / 39
4 / 39
a ← random() b ← random() 4 / 39
a ← random() Computes A = a · P Computes B = b · P b ← random() 4 / 39
sends B sends A
Computes A = a · P a ← random() b ← random() Computes B = b · P 4 / 39
sends B sends A
Computes A = a · P a ← random() Computes B = b · P b ← random() Computes K = b · A Computes K = a · B
4 / 39
sends B sends A
Computes A = a · P a ← random() Computes B = b · P b ← random() Computes K = b · A Computes K = a · B
4 / 39
5 / 39
5 / 39
P+a
5 / 39
6 / 39
6 / 39
6 / 39
6 / 39
7 / 39
8 / 39
9 / 39
10 / 39
11 / 39
1 Polynomial multiplication with PCLMUL. 2 Polynomial squaring with PSHUFB. 3 Reduction with shift, 128-bit XOR and AND. 4 Look up table for quadratic-solver. 11 / 39
12 / 39
PCLMUL PCLMUL PCLMUL PCLMUL PCLMUL PCLMUL PCLMUL PCLMUL PCLMUL
128 bits B[3] B[0] B[1] B[2] C[2] C[3] C[6] C[5] C[0] C[1] C[7] A[2] A[3] A[0] A[1]
×
C[4]
12 / 39
14 15 12 13 10 11 8 9 6 7 4 5 2 3 1
a[15] a[14] a[13] a[12] a[11] a[10] a[9] a[8] a[7] a[6] a[5] a[4] a[3] a[2] a[1] a[0]
a[14] a[15] a[12] a[13] a[10] a[11] a[8] a[9] a[6] a[7] a[4] a[5] a[2] a[3] a[0] a[1]
13 / 39
◮ We store in a[j] the squaring of j (seen as an element of F2[t])
◮ PSHUFB(b,a) computes
14 / 39
2
m−1 2
2
2
15 / 39
0 · · · · · · 0 c464 · · · c384 c383 · · · · · · c256 c255 · · · · · · c128 c127 · · · · · · c1c0
16 / 39
0 · · · · · · 0 c464 · · · c384 c383 · · · · · · c256 c255 · · · · · · c128 c127 · · · · · · c1c0
t384 = t225 + t151
0 · · · · · · 0 c464 · · · c384 0 · · · · · · 0 c464 · · · c384
16 / 39
c383 · · · · · · c256 c255 · · · · · · c128 c127 · · · · · · c1c0 0 · · · · · · 0 c464 · · · c384 0 · · · · · · 0 c464 · · · c384 cr,383 · · · · · · cr,256 cr,255 · · · · · · cr,128 cr,127 · · · · · · cr,1cr,0
16 / 39
c383 · · · · · · c256 c255 · · · · · · c128 c127 · · · · · · c1c0 0 · · · · · · 0 c464 · · · c384 0 · · · · · · 0 c464 · · · c384 cr,383 · · · · · · cr,256 cr,255 · · · · · · cr,128 cr,127 · · · · · · cr,1cr,0
t256 = t97 + t23
cr,383 · · · · · · cr,256 cr,383 · · · · · · cr,256
16 / 39
c383 · · · · · · c256 c255 · · · · · · c128 c127 · · · · · · c1c0 0 · · · · · · 0 c464 · · · c384 0 · · · · · · 0 c464 · · · c384 cr,255 · · · · · · cr,128 cr,127 · · · · · · cr,1cr,0 cr,383 · · · · · · cr,256 cr,383 · · · · · · cr,256 cr,255..cr,233 · · · cr,128 cr,127 · · · · · · cr,1cr,0
16 / 39
c383 · · · · · · c256 c255 · · · · · · c128 c127 · · · · · · c1c0 0 · · · · · · 0 c464 · · · c384 0 · · · · · · 0 c464 · · · c384 cr,255 · · · · · · cr,128 cr,127 · · · · · · cr,1cr,0 cr,383 · · · · · · cr,256 cr,383 · · · · · · cr,256 cr,255..cr,233 · · · cr,128 cr,127 · · · · · · cr,1cr,0
t233 = t74 + 1
cr,255..cr,233 cr,255..cr,233
16 / 39
c383 · · · · · · c256 c255 · · · · · · c128 c127 · · · · · · c1c0 0 · · · · · · 0 c464 · · · c384 0 · · · · · · 0 c464 · · · c384 cr,255 · · · · · · cr,128 cr,127 · · · · · · cr,1cr,0 cr,383 · · · · · · cr,256 cr,383 · · · · · · cr,256 0 · · · · · · 0 · · · cr,128 cr,127 · · · · · · cr,1cr,0 cr,255..cr,233 cr,255..cr,233 0 · · · · · · 0 cr,233 · · · cr,127 · · · · · · cr,1cr,0
16 / 39
a232 a128 a127 255 a0
A
A1 A0
b232 b128 b127 255 b0
B
B1 B0
c464 c383 c127 c255 511 c256 c128 c0
Cr1 Cr0
cr127 511 cr128 cr0 cr232
C1 C0 C2 C3
C = A · B Cr = C mod f
Reduction of C3, C2 and C1.
17 / 39
a232 a128 a127 255 a0
A
A1 A0
b232 b128 b127 255 b0
B
B1 B0
c464 c383 c127 c255 511 c256 c128 c0
Cr1 Cr0
cr127 511 cr128 cr0 cr232
C1 C0 C2 C3
C = A · B Cr = C mod f
Reduction of C3, C2 and C1.
Cr1 Cr0
cr127 511 cr128 cr0
C1 C0 C2 C3
C = A · B Cr = C mod f
Reduction of C3 and C2 only.
A
A1 A0
b128 b127 255 b0
B
B1 B0
0; c510 c384 c383 c127 c255 511 c256 c128 c0 a128 a127 255 a0 cr255 b255 a255
17 / 39
m−1 2
2
m−1 2
18 / 39
19 / 39
c3c2c1c0 c7c6c5c4 c11c10c9c8 · · · · · · 19 / 39
c3c2c1c0 c7c6c5c4 c11c10c9c8 · · · · · · tab[0][c3c2c1c0] 19 / 39
c3c2c1c0 c7c6c5c4 c11c10c9c8 · · · · · · tab[0][c3c2c1c0] tab[1][c7c6c5c4]
19 / 39
c3c2c1c0 c7c6c5c4 c11c10c9c8 · · · · · · tab[0][c3c2c1c0] tab[1][c7c6c5c4]
tab[2][c11c10c9c8]
19 / 39
20 / 39
21 / 39
22 / 39
22 / 39
22 / 39
P 23 / 39
P
P + b · Z 4 P
P · Z2P + X2P · (aZ2P + Y 2 P + bZ 4 P)
P · Z 2 P 23 / 39
P
P + b · Z 4 P
P · Z2P + X2P · (aZ2P + Y 2 P + bZ 4 P)
P · Z 2 P
◮ Kim-Kim (2006) (X, Y , Z, T) ∼
◮ Lambda-projective coordinates (Oliveira et al. 2013)
23 / 39
24 / 39
◮ we solve (2): λ2 + λ = u + a → λ (Quadratic solver); ◮ we solve (3): x2 = v + u(λ + 1) → x (Square root); ◮ we get y with (1): y = λx + x2. 24 / 39
◮ we solve (2): λ2 + λ = u + a → λ (Quadratic solver); ◮ we solve (3): x2 = v + u(λ + 1) → x (Square root); ◮ we get y with (1): y = λx + x2.
24 / 39
25 / 39
26 / 39
i=0 2iki) · P
27 / 39
i=0 2iki) · P
27 / 39
28 / 39
28 / 39
i = 0 then
29 / 39
i = 0 then
2 · S
i = 0 then
i | ← R|k′ i | + sign(ki)S
i=1,3,...,2w−1−1 i · Ri
29 / 39
i = 0 then
2 · S
i = 0 then
i | ← R|k′ i | + sign(ki)S
i=1,3,...,2w−1−1 i · Ri
29 / 39
Double-and-add R ← O for i = ℓ − 1 to 0 do R ← 2 · R if ki = 1 then R ← R + P endif endfor return(R) Double-and-add-always R ← O for i = ℓ − 1 to 0 do R ← 2 · R if ki = 1 then R ← R + P else R′ ← R′ + P endif endfor return(R) Montgomery-ladder R ← O R′ ← P for i = ℓ − 1 to 0 do if ki = 1 then R ← R + R′ R′ ← 2 · R′ else R′ ← R + R′ R ← 2 · R endif endfor return(R)
30 / 39
i = 1 then
i = 0 then
31 / 39
i = 1 then
2i P for i = 1, . . . , s
i = 0 then
32 / 39
33 / 39
ℓ/2−s
0,i2i
s
0,i2−i
ℓ/2−s
1,i2i
s
1,i2−i
Halve-and-add Double-and-add Halve-and-add
33 / 39
50 100 150 200 700 750
50 100 150 200
34 / 39
50 100
50 100
35 / 39
◮ PCLMUL, ◮ PSHUFB, ◮ Halving.
◮ A scalar multiplication over E(F2m) requires 27 000 clock-cycles (Core
◮ Better than scalar multiplication over E(Fp) (∼
36 / 39
37 / 39
38 / 39
39 / 39
39 / 39
39 / 39