Algorithm for RSA and Hyperelliptic Curve Cryptosystems Resistant to Simple Power Analysis
Christophe Negre ici
joined work with T. Plantard (U. of Wollongong, Australia)
Journees Nationales GDR IM January 19-th, 2016
1 / 39
Algorithm for RSA and Hyperelliptic Curve Cryptosystems Resistant to - - PowerPoint PPT Presentation
Algorithm for RSA and Hyperelliptic Curve Cryptosystems Resistant to Simple Power Analysis Christophe Negre ici joined work with T. Plantard (U. of Wollongong, Australia) Journees Nationales GDR IM January 19-th, 2016 1 / 39 Outline Regular
joined work with T. Plantard (U. of Wollongong, Australia)
1 / 39
1
2
3
4
2 / 39
1
2
3
4
3 / 39
1
2
3
4
4 / 39
5 / 39
5 / 39
6 / 39
6 / 39
1
2
3
4
7 / 39
8 / 39
9 / 39
10 / 39
1
2
3
4
11 / 39
1: r ← m−1 2: for i from ℓ − 1 downto 0
3:
4:
5:
6:
7:
8: end for 9: r ← r × m0 10: return r
12 / 39
1: r ← m−1 2: for i from ℓ − 1 downto 0
3:
4:
5:
6:
7:
8: end for 9: r ← r × m0 10: return r
Correctness: At beginning of loop i: r = mα × m−1
12 / 39
1: r ← m−1 2: for i from ℓ − 1 downto 0
3:
4:
5:
6:
7:
8: end for 9: r ← r × m0 10: return r
Correctness: At beginning of loop i: r = mα × m−1 If ei = 0: r 2 × m0 = m2αm−1
12 / 39
1: r ← m−1 2: for i from ℓ − 1 downto 0
3:
4:
5:
6:
7:
8: end for 9: r ← r × m0 10: return r
Correctness: At beginning of loop i: r = mα × m−1 If ei = 0: r 2 × m0 = m2αm−1 If ei = 1: r 2 × m1 = (m2αm1m−1
0 ) × m−1
= m2α+1m−1
12 / 39
1: r ← m−1 2: for i from ℓ − 1 downto 0
3:
4:
5:
6:
7:
8: end for 9: r ← r × m0 10: return r
Correctness: At beginning of loop i: r = mα × m−1 If ei = 0: r 2 × m0 = m2αm−1 If ei = 1: r 2 × m1 = (m2αm1m−1
0 ) × m−1
= m2α+1m−1 After loop i: r = m2α+ei × m−1
0 .
12 / 39
13 / 39
13 / 39
1 We set:
2 We iterate:
13 / 39
1 We set:
2 We iterate:
13 / 39
1 We set:
2 We iterate:
13 / 39
14 / 39
14 / 39
14 / 39
14 / 39
i
14 / 39
Property Algorithm #word op. Timing in 103CC 2040bits 3070bits None Square-and-multiply 7.5ℓt2 + O(ℓt) 14201 46287 Reg. Multiply-always 9ℓt2 + O(ℓt) 16178 52171 Square-always 9ℓt2 + O(ℓt) 18020 58766 Reg. and CT Square-and-mult-always 10.5ℓt2 + O(ℓt) 19738 63292 Montgomery-ladder 10.5ℓt2 + O(ℓt) 21803 70389 Montgomery-ladder opt. 9ℓt2 + O(ℓt) 18124 57401 Proposed 7.5ℓt2 + O(ℓt) 15203 47540
15 / 39
1
2
3
4
16 / 39
1
2
3
4
17 / 39
Alice and Bob agree on a group (G, +, O) and a generating point of the group P.
Bob Alice
18 / 39
Alice and Bob agree on a group (G, +, O) and a generating point of the group P.
Bob Alice
a ← random() b ← random() 18 / 39
Alice and Bob agree on a group (G, +, O) and a generating point of the group P.
Bob Alice
a ← random() Computes A = a · P Computes B = b · P b ← random() 18 / 39
Alice and Bob agree on a group (G, +, O) and a generating point of the group P.
Bob Alice
sends B sends A
Computes A = a · P a ← random() b ← random() Computes B = b · P 18 / 39
Alice and Bob agree on a group (G, +, O) and a generating point of the group P.
Bob Alice
sends B sends A
Computes A = a · P a ← random() Computes B = b · P b ← random() Computes K = b · A Computes K = a · B
Shared secret key K = a · b · P
18 / 39
Alice and Bob agree on a group (G, +, O) and a generating point of the group P.
Bob Alice
sends B sends A
Computes A = a · P a ← random() Computes B = b · P b ← random() Computes K = b · A Computes K = a · B
Shared secret key K = a · b · P
18 / 39
Alice and Bob agree on a group (G, +, O) and a generating point of the group P.
Bob Alice
sends B sends A
Computes A = a · P a ← random() Computes B = b · P b ← random() Computes K = b · A Computes K = a · B
Shared secret key K = a · b · P
18 / 39
1
2
3
4
19 / 39
P = (xP, yP) Q = (xQ, yQ)
20 / 39
P = (xP, yP) Q = (xQ, yQ) R = P + Q
xP−xQ
20 / 39
P = (xP, yP) Q = (xQ, yQ) R = P + Q
xP−xQ
P = (xP, yP) R = 2P
20 / 39
P 2P
21 / 39
P 2P 3P
21 / 39
P 3P 6P
21 / 39
P 6P 7P
21 / 39
1
2
3
4
22 / 39
23 / 39
P0 P1
23 / 39
P0 P1
23 / 39
P0 P1 P2 P3
23 / 39
P0 P1 P2 P3
◮ Let the curve going through all Pis.
C : y = w3x3 + w2x2 + w1x + w0.
23 / 39
P0 P1 P2 P3 Q0 Q1
◮ Let the curve going through all Pis.
C : y = w3x3 + w2x2 + w1x + w0.
◮ H ∩ C = {P0, P1, P2, P3, Q0, Q1}. 23 / 39
P0 P1 P2 P3 Q0 Q1
◮ Let the curve going through all Pis.
C : y = w3x3 + w2x2 + w1x + w0.
◮ H ∩ C = {P0, P1, P2, P3, Q0, Q1}. ◮ D + D′ =
Q0 + Q1.
23 / 39
1
2
3
4
24 / 39
while IsIrreducible(u(x)) do D ← 2 · D k ← k/2 mod # < D > end while Factorize u(x) = (x − x0)(x − x1) D0 ← (x − xi, v(xi)), D1 ← (x − xi, v(xi)) R ← −D0 for i = ℓ − 1 to 0 do R ← 2 · R if ki = 0 then R ← R + D0 else R ← R + D1 end if end for R ← R + D0 return R
25 / 39
while IsIrreducible(u(x)) do D ← 2 · D k ← k/2 mod # < D > end while Factorize u(x) = (x − x0)(x − x1) D0 ← (x − xi, v(xi)), D1 ← (x − xi, v(xi)) R ← −D0 for i = ℓ − 1 to 0 do R ← 2 · R if ki = 0 then R ← R + D0 else R ← R + D1 end if end for R ← R + D0 return R
25 / 39
while IsIrreducible(u(x)) do D ← 2 · D k ← k/2 mod # < D > end while Factorize u(x) = (x − x0)(x − x1) D0 ← (x − xi, v(xi)), D1 ← (x − xi, v(xi)) R ← −D0 for i = ℓ − 1 to 0 do R ← 2 · R if ki = 0 then R ← R + D0 else R ← R + D1 end if end for R ← R + D0 return R
25 / 39
1 − 4u0.
26 / 39
1 − 4u0.
1
Test if ∆ is a square-root with the Jacobi symbol ∆ p
1 if ∆ is a square −1 if ∆ is not a square
26 / 39
1 − 4u0.
1
Test if ∆ is a square-root with the Jacobi symbol ∆ p
1 if ∆ is a square −1 if ∆ is not a square
2
Jacobi symbol computation: ∆ = 2α∆′ and ∆′ odd ∆ p
2 p α × ∆′ p
a b
(a−1)(b−1) 4
b mod a a
1 − 4u0.
1
Test if ∆ is a square-root with the Jacobi symbol ∆ p
1 if ∆ is a square −1 if ∆ is not a square
2
Jacobi symbol computation: ∆ = 2α∆′ and ∆′ odd ∆ p
2 p α × ∆′ p
a b
(a−1)(b−1) 4
b mod a a
p−3 4 +1
26 / 39
27 / 39
1
2
3
4
28 / 39
1
2
3
4
29 / 39
b=1
30 / 39
b=1
b=0
30 / 39
b=1
b=0
b=0
b=1
b=1
b=0
b=0
b=1
30 / 39
b=1
b=0
b=0
b=1
b=1
b=0
b=0
b=1
30 / 39
b=1
b=0
b=0
b=1
b=1
b=0
b=0
b=1
30 / 39
b=1
b=0
b=0
b=1
b=1
b=0
b=0
b=1
30 / 39
b=1
b=0
b=0
b=1
b=1
b=0
b=0
b=1
30 / 39
loop 1 e1 = 1 loop 2 e2 = 0 loop 3 e3 = 1 loop 4 e4 = 0 loop 5 e5 =??
31 / 39
loop 1 e1 = 1 r1 loop 2 e2 = 0 r2 loop 3 e3 = 1 r3 loop 4 e4 = 0 r4 loop 5 e5 =??
0 r5
5 1
31 / 39
loop 1 e1 = 1 r1 loop 2 e2 = 0 r2 loop 3 e3 = 1 r3 loop 4 e4 = 0 r4 loop 5 e5 =??
0 r5
5 1
trace 1 trace 2 trace 3 . . . . . . . . . . . . trace L
31 / 39
loop 1 e1 = 1 r1 loop 2 e2 = 0 r2 loop 3 e3 = 1 r3 loop 4 e4 = 0 r4 loop 5 e5 =??
0 r5
5 1
trace 1 trace 2 trace 3 . . . . . . . . . . . . trace L
correct guess wrong guess
31 / 39
1
2
3
4
32 / 39
33 / 39
◮ Montgomery Multiplication:
q ← −a × b × N−1 mod M r ← (a × b + q × N)/M
33 / 39
◮ Montgomery Multiplication:
q ← −a × b × N−1 mod M r ← (a × b + q × N)/M which satisfies r ≡ a × b × M−1 mod N.
33 / 39
◮ Montgomery Multiplication:
q ← −a × b × N−1 mod M r ← (a × b + q × N)/M which satisfies r ≡ a × b × M−1 mod N.
◮ Montgomery representation:
a = aM mod N leads to
b × M−1 mod N = ab mod N
33 / 39
◮ Montgomery Multiplication:
q ← −a × b × N−1 mod M r ← (a × b + q × N)/M which satisfies r ≡ a × b × M−1 mod N.
◮ Montgomery representation:
a = aM mod N leads to
b × M−1 mod N = ab mod N ⇒ randomized M with the residue number system.
33 / 39
34 / 39
α · φ = (∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 000000000000000000 000000000000000000000000000000000000000000000000000000 0000000000000000000000 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗)2
35 / 39
◮ Let ¯
1 = −1, then we have 1000001 = 100001¯ 1 = 10001¯ 1¯ 1 = 1001¯ 1¯ 1¯ 1 . . .
36 / 39
◮ Let ¯
1 = −1, then we have 1000001 = 100001¯ 1 = 10001¯ 1¯ 1 = 1001¯ 1¯ 1¯ 1 . . .
◮ Let k = ℓ−1
i=0 ki2i can be recoded
k =
ℓ−1
k′
i 2i with ki ∈ {0, 1, ¯
1} and there is 3ℓ/2ℓ such recoding, in average.
36 / 39
◮ Let ¯
1 = −1, then we have 1000001 = 100001¯ 1 = 10001¯ 1¯ 1 = 1001¯ 1¯ 1¯ 1 . . .
◮ Let k = ℓ−1
i=0 ki2i can be recoded
k =
ℓ−1
k′
i 2i with ki ∈ {0, 1, ¯
1} and there is 3ℓ/2ℓ such recoding, in average.
j = (k′ 0, . . . , k′ j)2 · P
j = Pj or P′ j = Pj − 2jP.
36 / 39
1
2
3
4
37 / 39
38 / 39
39 / 39