143
Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Math ´ ematiques de Bordeaux Inside Secure June 13th, 2012 V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 1 / 64

Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

  • Upload
    others

  • View
    39

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Elliptic Curve Cryptographyand Security of Embedded Devices

Ph.D. Defense

Vincent Verneuil

Institut de Mathematiques de BordeauxInside Secure

June 13th, 2012

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 1 / 64

Page 2: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 2 / 64

Page 3: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 2 / 64

Page 4: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 2 / 64

Page 5: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

RSA (Rivest-Shamir-Adleman)

A Method for Obtaining DigitalSignatures and Public-Key

Cryptosystems, 1978.

Key generation

I pick at random two primes p and q,and compute n = p×q

I choose e and compute d such that:e×d ≡ 1 mod (p−1)(q−1)

Public key= {n,e}

Private key= {p,q,d}

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 3 / 64

Page 6: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

RSA (Rivest-Shamir-Adleman)

A Method for Obtaining DigitalSignatures and Public-Key

Cryptosystems, 1978.

Key generation

I pick at random two primes p and q,and compute n = p×q

I choose e and compute d such that:e×d ≡ 1 mod (p−1)(q−1)

Public key= {n,e}

Private key= {p,q,d}

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 3 / 64

Page 7: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

RSA (Rivest-Shamir-Adleman)

Encryption / Decryption

To encrypt a message m:c = me mod n

To decrypt c:m = cd mod n

Security assumption

Given = {n,e}, how to recover d = e−1 mod (p−1)(q−1) ?

Factorize n to recover p and q !

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 4 / 64

Page 8: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

RSA (Rivest-Shamir-Adleman)

Encryption / Decryption

To encrypt a message m:c = me mod n

To decrypt c:m = cd mod n

Security assumption

Given = {n,e}, how to recover d = e−1 mod (p−1)(q−1) ?

Factorize n to recover p and q !

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 4 / 64

Page 9: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Elliptic Curve Cryptography

Independently introduced by Koblitz and Miller in 1985.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 5 / 64

Page 10: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Elliptic Curve Equation

Let K be a field, and E /K an elliptic curve.Then the set of K-rational points E (K)⊂ P2(K)is an abelian group, with neutral element O.

On a field K= Fp, p > 3, it has an affine equation:

y2 = x3 +ax +b

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 6 / 64

Page 11: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Elliptic Curve Group Law

Let P1 = (x1,y1) and P2 = (x2,y2),P1,P2 6= O.

P3 = P1 +P2 is given by:{x3 = m2−x1−x2y3 = m (x1−x3)−y1

•P1

•P2

•−P3

•P3

O

•P1 = P2 •

−P3

•P3

O

K= R

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 7 / 64

Page 12: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Elliptic Curve Group Law

Let P1 = (x1,y1) and P2 = (x2,y2),P1,P2 6= O.

P3 = P1 +P2 is given by:{x3 = m2−x1−x2y3 = m (x1−x3)−y1

m =y2−y1x2−x1

if P1 6=±P2

•P1

•P2

•−P3

•P3

O

•P1 = P2 •

−P3

•P3

O

K= R

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 7 / 64

Page 13: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Elliptic Curve Group Law

Let P1 = (x1,y1) and P2 = (x2,y2),P1,P2 6= O.

P3 = P1 +P2 is given by:{x3 = m2−x1−x2y3 = m (x1−x3)−y1

•P1

•P2

•−P3

•P3

O

•P1 = P2

•−P3

•P3

O

K= R

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 7 / 64

Page 14: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Elliptic Curve Group Law

Let P1 = (x1,y1) and P2 = (x2,y2),P1,P2 6= O.

P3 = P1 +P2 is given by:{x3 = m2−x1−x2y3 = m (x1−x3)−y1

m =3x1

2 +a2y1

if P1 = P2

•P1

•P2

•−P3

•P3

O

•P1 = P2 •

−P3

•P3

O

K= R

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 7 / 64

Page 15: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Scalar Multiplication

Given a point P in E (K) and a positive integer d ,we denote dP = P +P + · · ·+P︸ ︷︷ ︸

d times

.

Elliptic Curve Discrete Logarithm Problem (ECDLP)

Given P in E (K) and dP, 1≤ d ≤#E (K),find d ?

Much harder than or factoring (which can be solvedin subexponential time).

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 8 / 64

Page 16: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Scalar Multiplication

Given a point P in E (K) and a positive integer d ,we denote dP = P +P + · · ·+P︸ ︷︷ ︸

d times

.

Elliptic Curve Discrete Logarithm Problem (ECDLP)

Given P in E (K) and dP, 1≤ d ≤#E (K),find d ?

Much harder than or factoring (which can be solvedin subexponential time).

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 8 / 64

Page 17: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Cryptosystems Comparison

Estimated equivalent key lengths for ECC and RSA:

Security level 80 112 128 192 256ECC 160 224 256 384 512RSA 1024 2048 3072 8192 15360

z Very interesting in embedded devices having limited resources.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 9 / 64

Page 18: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 9 / 64

Page 19: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Embedded Devices Constraints

Efficiency

I Most transactions have to take less than 500 msI Small amount of RAMI Very low power (hence low frequency) for contactless devices

Arithmetic optimizations

I Exponentiation / scalar multiplicationI Group operations and point representationI Modular arithmetic

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 10 / 64

Page 20: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Embedded Devices Constraints

Efficiency

I Most transactions have to take less than 500 msI Small amount of RAMI Very low power (hence low frequency) for contactless devices

Arithmetic optimizations

I Exponentiation / scalar multiplicationI Group operations and point representationI Modular arithmetic

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 10 / 64

Page 21: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Fp Operations Theoretical Cost

Expensive operations

I Inversion (I)

Significant operations

I Multiplication (M)I Squaring (S, S/M ≈ 0.8)

Negligible operations

I Addition (A)I Subtraction (A)I Negation (N)

For ECC keylengths,A/M ≈ 0.2 and N/M ≈ 0.1on most smart cards.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 11 / 64

Page 22: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Fp Operations Theoretical Cost

Expensive operations

I Inversion (I)

Significant operations

I Multiplication (M)I Squaring (S, S/M ≈ 0.8)

Negligible operations

I Addition (A)I Subtraction (A)I Negation (N)

For ECC keylengths,A/M ≈ 0.2 and N/M ≈ 0.1on most smart cards.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 11 / 64

Page 23: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Fp Operations Theoretical Cost

Expensive operations

I Inversion (I)

Significant operations

I Multiplication (M)I Squaring (S, S/M ≈ 0.8)

Negligible operations

I Addition (A)I Subtraction (A)I Negation (N)

For ECC keylengths,A/M ≈ 0.2 and N/M ≈ 0.1on most smart cards.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 11 / 64

Page 24: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Fp Operations Theoretical Cost

Expensive operations

I Inversion (I)

Significant operations

I Multiplication (M)I Squaring (S, S/M ≈ 0.8)

Negligible operations

I Addition (A)I Subtraction (A)I Negation (N)

For ECC keylengths,A/M ≈ 0.2 and N/M ≈ 0.1on most smart cards.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 11 / 64

Page 25: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Fp Operations Theoretical Cost

Expensive operations

I Inversion (I)

Significant operations

I Multiplication (M)I Squaring (S, S/M ≈ 0.8)

Negligible operations

I Addition (A)I Subtraction (A)I Negation (N)

For ECC keylengths,A/M ≈ 0.2 and N/M ≈ 0.1on most smart cards.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 11 / 64

Page 26: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Exponentiation AlgorithmsSquare and multiply

Left-to-right Right-to-left

md = md0 ×(

md1 ×(. . .(md`−1

)2. . .)2)2

md = md`−12`−1 ×md`−22`−2 × . . .×md0

Input: m,n,d ∈ NOutput: md mod na← 1for i = `−1 to 0 do

a← a2 mod nif di = 1 then

a← a×m mod nreturn a

Input: m,n,d ∈ NOutput: md mod na← 1 ; b←mfor i = 0 to `−1 do

if di = 1 thena← a×b mod n

b← b2 mod nreturn a

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 12 / 64

Page 27: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Scalar Multiplication AlgorithmsDouble and add

Left-to-right Right-to-left

dP = d0P + 2(d1P + 2(. . .+ 2(d`−1P) . . .)) dP = d`−12`−1P + d`−22`−2P + . . .+ d0P

Input: P ∈ E (K),d ∈ NOutput: dPR← Ofor i = `−1 to 0 do

R← 2Rif di = 1 then

R← R+Preturn R

Input: P ∈ E (K),d ∈ NOutput: dPR← O ; Q← Pfor i = 0 to `−1 do

if di = 1 thenR← R+Q

Q← 2Qreturn R

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 13 / 64

Page 28: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Refined Algorithms

Non-Adjacent Form (NAF)

Signed representation minimizing the number of non-zero digits (1/3vs 1/2).Hence minimize the number of additions.

Sliding window algorithms

Precompute 3P,5P, . . . to process several scalar bits at a time.Can be combined with the NAF method.

Co-Z Addition

Euclidean Addition Chains [Meloni, WAIFI 2007]Co-Z binary ladder [Goundar, Joye & Miyaji, CHES 2010]

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 14 / 64

Page 29: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Refined Algorithms

Non-Adjacent Form (NAF)

Signed representation minimizing the number of non-zero digits (1/3vs 1/2).Hence minimize the number of additions.

Sliding window algorithms

Precompute 3P,5P, . . . to process several scalar bits at a time.Can be combined with the NAF method.

Co-Z Addition

Euclidean Addition Chains [Meloni, WAIFI 2007]Co-Z binary ladder [Goundar, Joye & Miyaji, CHES 2010]

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 14 / 64

Page 30: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Refined Algorithms

Non-Adjacent Form (NAF)

Signed representation minimizing the number of non-zero digits (1/3vs 1/2).Hence minimize the number of additions.

Sliding window algorithms

Precompute 3P,5P, . . . to process several scalar bits at a time.Can be combined with the NAF method.

Co-Z Addition

Euclidean Addition Chains [Meloni, WAIFI 2007]Co-Z binary ladder [Goundar, Joye & Miyaji, CHES 2010]

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 14 / 64

Page 31: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 14 / 64

Page 32: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Side-Channel Analysis Framework

Device

Outputs

Cryptographicoperation

Inputs

Outputs

Secretkey

leakagesMeasurements

Model &assumptions

Information onsecret key

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 15 / 64

Page 33: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Side-Channel Analysis Framework

Device

Outputs

Cryptographicoperation

InputsSecret

key

leakages

MeasurementsModel &

assumptions

Information onsecret key

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 15 / 64

Page 34: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Side-Channel Analysis Framework

Device

Outputs

Cryptographicoperation

InputsSecret

key

leakagesMeasurements

Model &assumptions

Information onsecret key

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 15 / 64

Page 35: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Side-Channel Analysis Framework

Device

Outputs

Cryptographicoperation

InputsSecret

key

leakagesMeasurements

Model &assumptions

Information onsecret key

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 15 / 64

Page 36: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Side-Channel Analysis Framework

Device

Outputs

Cryptographicoperation

InputsSecret

key

leakagesMeasurements

Model &assumptions

Information onsecret key

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 15 / 64

Page 37: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Simple Side-Channel Analysis (SSCA)Left-to-right square & multiply

Side-channel leakage: power, EM, etc.

The whole exponent may be recovered using a single trace.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 16 / 64

Page 38: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular ExponentiationLeft-to-right algorithms

Square & multiply:

. . .

Square & multiply always:

. . .

Montgomery ladder:

. . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 17 / 64

Page 39: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular ExponentiationLeft-to-right algorithms

Square & multiply:

. . .

Square & multiply always:

. . .

Montgomery ladder:

. . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 17 / 64

Page 40: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular ExponentiationLeft-to-right algorithms

Square & multiply:

. . .

Square & multiply always:

. . .

Montgomery ladder:

. . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 17 / 64

Page 41: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Exponentiation Algorithms

Left-to-right

“Montgomery ladder”

Input: m,n,d ∈ NOutput: md mod n

1: R0← 12: R1←m3: for i = `−1 to 0 do4: R1−di ← R0×R1 mod n5: Rdi ← Rdi

2 mod n

6: return R0

Right-to-left

“Joye ladder”

Input: m,n,d ∈ NOutput: md mod n

1: R0← 12: R1←m3: for i = 0 to `−1 do4: R1−di ← R1−di

2 mod n5: R1−di ← R1−di ×Rdi mod n

6: return R0

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 18 / 64

Page 42: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Scalar MultiplicationLeft-to-right algorithms

Double & add:. . .

Double & add always:

. . .

Montgomery ladders:

. . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 19 / 64

Page 43: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Scalar MultiplicationLeft-to-right algorithms

Double & add:. . .

Double & add always:

. . .

Montgomery ladders:

. . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 19 / 64

Page 44: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Scalar MultiplicationLeft-to-right algorithms

Double & add:. . .

Double & add always:

. . .

Montgomery ladders:

. . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 19 / 64

Page 45: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Scalar Multiplication Algorithms

Left-to-right

“Montgomery ladder”

Input: P ∈ E (K),d ∈ NOutput: dP

1: R0← O2: R1← P3: for i = `−1 to 0 do4: R1−di ← R0 +R15: Rdi ← 2Rdi

6: return R0

Right-to-left

“Joye ladder”

Input: P ∈ E (K),d ∈ NOutput: dP

1: R0← O2: R1← P3: for i = 0 to `−1 do4: R1−di ← 2R1−di5: R1−di ← R1−di +Rdi

6: return R0

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 20 / 64

Page 46: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Atomic Exponentiation

Square & multiply:

. . .

Atomic multiply always:

. . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 21 / 64

Page 47: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Atomic Exponentiation

Square & multiply:

. . .

Atomic multiply always:

. . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 21 / 64

Page 48: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Atomic Scalar Multiplication

Double & add:. . .

Atomic add always (with a unified group addition):

. . .

Atomic scalar multiplication using a smaller pattern:

. . .

Dbl. Dbl. Add. Dbl. Add. . . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 22 / 64

Page 49: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Atomic Scalar Multiplication

Double & add:. . .

Atomic add always (with a unified group addition):

. . .

Atomic scalar multiplication using a smaller pattern:

. . .

Dbl. Dbl. Add. Dbl. Add. . . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 22 / 64

Page 50: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Atomic Scalar Multiplication

Double & add:. . .

Atomic add always (with a unified group addition):

. . .

Atomic scalar multiplication using a smaller pattern:

. . .

Dbl. Dbl. Add. Dbl. Add. . . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 22 / 64

Page 51: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Leakage on Manipulated Data

Noise is generally too high to exploit this leakage directly /

z Many acquisitions are used to reduce noise influence

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 23 / 64

Page 52: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Leakage on Manipulated Data

Noise is generally too high to exploit this leakage directly /

z Many acquisitions are used to reduce noise influence

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 23 / 64

Page 53: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Leakage on Manipulated Data

Noise is generally too high to exploit this leakage directly /

z Many acquisitions are used to reduce noise influence

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 23 / 64

Page 54: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Differential Analysis Principle

Measure N times a side-channelleakage with different data involvedand consider the tracesT 1,T 2, . . . ,T n.

I align vertically the traces onthe targeted operation usingsignal processing tools

I perform statistical treatmentbetween traces, known inputsor outputs and a guess on afew key bits

z Validate the guess or not

T 1

t t + ω

T 2

t t + ω...

T N

t t + ω

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 24 / 64

Page 55: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Differential Analysis Principle

Measure N times a side-channelleakage with different data involvedand consider the tracesT 1,T 2, . . . ,T n.

I align vertically the traces onthe targeted operation usingsignal processing tools

I perform statistical treatmentbetween traces, known inputsor outputs and a guess on afew key bits

z Validate the guess or not

T 1

t t + ω

T 2

t t + ω...

T N

t t + ω

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 24 / 64

Page 56: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Differential Analysis Principle

Measure N times a side-channelleakage with different data involvedand consider the tracesT 1,T 2, . . . ,T n.

I align vertically the traces onthe targeted operation usingsignal processing tools

I perform statistical treatmentbetween traces, known inputsor outputs and a guess on afew key bits

z Validate the guess or not

T 1

t t + ω

T 2

t t + ω...

T N

t t + ω

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 24 / 64

Page 57: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Differential Analysis Principle

Measure N times a side-channelleakage with different data involvedand consider the tracesT 1,T 2, . . . ,T n.

I align vertically the traces onthe targeted operation usingsignal processing tools

I perform statistical treatmentbetween traces, known inputsor outputs and a guess on afew key bits

z Validate the guess or not

T 1

t t + ω

T 2

t t + ω...

T N

t t + ω

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 24 / 64

Page 58: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Differential Side-Channel Analysis

Original method introduced in [Kocher, Jaffe & Jun, CRYPTO’99]I Hamming weight leakage modelI Difference of means as a distinguisher

Correlation analysis introduced in [Brier, Clavier & Olivier, CHES2004]I Hamming weight/distance leakage modelI Pearson correlation factor as a distinguisher

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 25 / 64

Page 59: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Differential Side-Channel Analysis

Original method introduced in [Kocher, Jaffe & Jun, CRYPTO’99]I Hamming weight leakage modelI Difference of means as a distinguisher

Correlation analysis introduced in [Brier, Clavier & Olivier, CHES2004]I Hamming weight/distance leakage modelI Pearson correlation factor as a distinguisher

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 25 / 64

Page 60: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Countermeasures for RSAExponentiation

I Exponent blinding d ′ = d + r(p−1)(q−1)

I Message/ciphertext additive blinding m′ = m+ rn mod cn, r < c

I Message/ciphertext multiplicative blinding m′ = rem mod n,result recovered as r−1(m′)d mod n

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 26 / 64

Page 61: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Countermeasures for RSAExponentiation

I Exponent blinding d ′ = d + r(p−1)(q−1)

I Message/ciphertext additive blinding m′ = m+ rn mod cn, r < c

I Message/ciphertext multiplicative blinding m′ = rem mod n,result recovered as r−1(m′)d mod n

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 26 / 64

Page 62: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Countermeasures for RSAExponentiation

I Exponent blinding d ′ = d + r(p−1)(q−1)

I Message/ciphertext additive blinding m′ = m+ rn mod cn, r < c

I Message/ciphertext multiplicative blinding m′ = rem mod n,result recovered as r−1(m′)d mod n

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 26 / 64

Page 63: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Countermeasures for ScalarMultiplication

From [Coron, CHES’99]:

I Scalar blinding d ′ = d + r#E (Fp)

I Base point projective coordinates blinding (r2X : r3Y : rZ )

I Input point blinding Q = d(P +R), result recovered as Q−S withS = dR

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 27 / 64

Page 64: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Countermeasures for ScalarMultiplication

From [Coron, CHES’99]:

I Scalar blinding d ′ = d + r#E (Fp)

I Base point projective coordinates blinding (r2X : r3Y : rZ )

I Input point blinding Q = d(P +R), result recovered as Q−S withS = dR

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 27 / 64

Page 65: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Countermeasures for ScalarMultiplication

From [Coron, CHES’99]:

I Scalar blinding d ′ = d + r#E (Fp)

I Base point projective coordinates blinding (r2X : r3Y : rZ )

I Input point blinding Q = d(P +R), result recovered as Q−S withS = dR

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 27 / 64

Page 66: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 27 / 64

Page 67: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Our Contribution

I New atomic pattern for right-to-left scalar multiplication implementation

I Fastest implementation for standard curves considering addition costA/M ≥ 0.1

Theoretical comparison (S/M = 0.8, A/M = 0.2)

Previous right-to-left NAF atomic scalar multiplication: - 20 % (M/bit)

Best previous scalar multiplication (Co-Z Montgomery ladder (X :Z )-only):- 3.6 % (M/bit)

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 28 / 64

Page 68: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Our Contribution

I New atomic pattern for right-to-left scalar multiplication implementation

I Fastest implementation for standard curves considering addition costA/M ≥ 0.1

Theoretical comparison (S/M = 0.8, A/M = 0.2)

Previous right-to-left NAF atomic scalar multiplication: - 20 % (M/bit)

Best previous scalar multiplication (Co-Z Montgomery ladder (X :Z )-only):- 3.6 % (M/bit)

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 28 / 64

Page 69: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar MultiplicationMixed coordinates

IMultiplicationI AdditionI NegationI Addition

I SquaringI AdditionI NegationI Addition

Operations expression using the atomic pattern

Addition : ���������������� [11M+5S]Doubling : �������� [3M+5S]

Extended pattern : ��������

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 29 / 64

Page 70: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar MultiplicationMixed coordinates

IMultiplicationI AdditionI NegationI Addition

I SquaringI AdditionI NegationI Addition

Operations expression using the atomic pattern

Addition : ���������������� [11M+5S]Doubling : �������� [3M+5S]

Extended pattern : ��������

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 29 / 64

Page 71: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar MultiplicationMixed coordinates

IMultiplicationI AdditionI NegationI Addition

I SquaringI AdditionI NegationI Addition

Operations expression using the atomic pattern

Addition : ���������������� [11M+5S]Doubling : �������� [3M+5S]

Extended pattern : ��������

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 29 / 64

Page 72: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar MultiplicationMixed coordinates

IMultiplicationI AdditionI NegationI Addition

I SquaringI AdditionI NegationI Addition

Operations expression using the atomic pattern

Addition : �������� �������� [11M+5S]Doubling : �������� [3M+5S]

Extended pattern : ��������

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 29 / 64

Page 73: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar Multiplication

Add. 1 Add. 2 Dbl.

ISq.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.ISq.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.

R1 ← Z22

???

R2 ← X1 ·R1???

R1 ← R1 ·Z2???

R3 ← Y1 ·R1???

R1 ← Z12

???

R4 ← R1 ·X2?

R4 ←−R4R4 ← R2 + R4R1 ← Z1 ·R1???

R1 ← R1 ·Y2?

R1 ←−R1R1 ← R3 + R1

R6 ← R42

???

R5 ← Z1 ·Z2???

Z3 ← R5 ·R4???

R2 ← R2 ·R6?

R1 ←−R1?

R5 ← R12

?R3 ←−R3?

R4 ← R4 ·R6R6 ← R5 + R4R2 ←−R2R6 ← R6 + R2R3 ← R3 ·R4X3 ← R2 + R6?

R2 ← X3 + R2R1 ← R1 ·R2Y3 ← R3 + R1??

R1 ← X12

R2 ← Y1 + Y1??

Z2 ← R2 ·Z1R4 ← R1 + R1??

R3 ← R2 ·Y1R6 ← R3 + R3??

R2 ← R6 ·R3R1 ← R4 + R1?

R1 ← R1 + W1R3 ← R1

2

???

R4 ← R6 ·X1R5 ←W1 + W1R4 ←−R4R3 ← R3 + R4W2 ← R2 ·R5X2 ← R3 + R4R2 ←−R2R6 ← R4 + X2R4 ← R6 ·R1?

R4 ←−R4Y2 ← R4 + R2

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 30 / 64

Page 74: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar MultiplicationAdd. 1 Add. 2

Dbl.

ISq.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.ISq.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.

R1 ← Z22

???

R2 ← X1 ·R1???

R1 ← R1 ·Z2???

R3 ← Y1 ·R1???

R1 ← Z12

???

R4 ← R1 ·X2?

R4 ←−R4R4 ← R2 + R4R1 ← Z1 ·R1???

R1 ← R1 ·Y2?

R1 ←−R1R1 ← R3 + R1

R6 ← R42

???

R5 ← Z1 ·Z2???

Z3 ← R5 ·R4???

R2 ← R2 ·R6?

R1 ←−R1?

R5 ← R12

?R3 ←−R3?

R4 ← R4 ·R6R6 ← R5 + R4R2 ←−R2R6 ← R6 + R2R3 ← R3 ·R4X3 ← R2 + R6?

R2 ← X3 + R2R1 ← R1 ·R2Y3 ← R3 + R1??

R1 ← X12

R2 ← Y1 + Y1??

Z2 ← R2 ·Z1R4 ← R1 + R1??

R3 ← R2 ·Y1R6 ← R3 + R3??

R2 ← R6 ·R3R1 ← R4 + R1?

R1 ← R1 + W1R3 ← R1

2

???

R4 ← R6 ·X1R5 ←W1 + W1R4 ←−R4R3 ← R3 + R4W2 ← R2 ·R5X2 ← R3 + R4R2 ←−R2R6 ← R4 + X2R4 ← R6 ·R1?

R4 ←−R4Y2 ← R4 + R2

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 30 / 64

Page 75: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar MultiplicationAdd. 1 Add. 2 Dbl.

ISq.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.ISq.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.

R1 ← Z22

???

R2 ← X1 ·R1???

R1 ← R1 ·Z2???

R3 ← Y1 ·R1???

R1 ← Z12

???

R4 ← R1 ·X2?

R4 ←−R4R4 ← R2 + R4R1 ← Z1 ·R1???

R1 ← R1 ·Y2?

R1 ←−R1R1 ← R3 + R1

R6 ← R42

???

R5 ← Z1 ·Z2???

Z3 ← R5 ·R4???

R2 ← R2 ·R6?

R1 ←−R1?

R5 ← R12

?R3 ←−R3?

R4 ← R4 ·R6R6 ← R5 + R4R2 ←−R2R6 ← R6 + R2R3 ← R3 ·R4X3 ← R2 + R6?

R2 ← X3 + R2R1 ← R1 ·R2Y3 ← R3 + R1??

R1 ← X12

R2 ← Y1 + Y1??

Z2 ← R2 ·Z1R4 ← R1 + R1??

R3 ← R2 ·Y1R6 ← R3 + R3??

R2 ← R6 ·R3R1 ← R4 + R1?

R1 ← R1 + W1R3 ← R1

2

???

R4 ← R6 ·X1R5 ←W1 + W1R4 ←−R4R3 ← R3 + R4W2 ← R2 ·R5X2 ← R3 + R4R2 ←−R2R6 ← R4 + X2R4 ← R6 ·R1?

R4 ←−R4Y2 ← R4 + R2

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 30 / 64

Page 76: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar MultiplicationAdd. 1 Add. 2 Dbl.

ISq.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.ISq.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.

R1 ← Z22

???

R2 ← X1 ·R1???

R1 ← R1 ·Z2???

R3 ← Y1 ·R1???

R1 ← Z12

???

R4 ← R1 ·X2?

R4 ←−R4R4 ← R2 + R4R1 ← Z1 ·R1???

R1 ← R1 ·Y2?

R1 ←−R1R1 ← R3 + R1

R6 ← R42

???

R5 ← Z1 ·Z2???

Z3 ← R5 ·R4???

R2 ← R2 ·R6?

R1 ←−R1?

R5 ← R12

?R3 ←−R3?

R4 ← R4 ·R6R6 ← R5 + R4R2 ←−R2R6 ← R6 + R2R3 ← R3 ·R4X3 ← R2 + R6?

R2 ← X3 + R2R1 ← R1 ·R2Y3 ← R3 + R1??

R1 ← X12

R2 ← Y1 + Y1??

Z2 ← R2 ·Z1R4 ← R1 + R1??

R3 ← R2 ·Y1R6 ← R3 + R3??

R2 ← R6 ·R3R1 ← R4 + R1?

R1 ← R1 + W1R3 ← R1

2

???

R4 ← R6 ·X1R5 ←W1 + W1R4 ←−R4R3 ← R3 + R4W2 ← R2 ·R5X2 ← R3 + R4R2 ←−R2R6 ← R4 + X2R4 ← R6 ·R1?

R4 ←−R4Y2 ← R4 + R2

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 30 / 64

Page 77: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar MultiplicationAdd. 1 Add. 2 Dbl.

ISq.IAdd.

INeg.IAdd.

IMult.IAdd.

INeg.IAdd.

IMult.IAdd.

INeg.IAdd.

IMult.IAdd.INeg.IAdd.ISq.

IAdd.

INeg.

IAdd.

IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.IMult.IAdd.INeg.IAdd.

R1 ← Z22

?

R2 ← X1 ·R1?

R1 ← R1 ·Z2?

R3 ← Y1 ·R1???

R1 ← Z12

?

R4 ← R1 ·X2?

R4 ←−R4R4 ← R2 + R4R1 ← Z1 ·R1???

R1 ← R1 ·Y2?

R1 ←−R1R1 ← R3 + R1

R6 ← R42

?

R5 ← Z1 ·Z2?

Z3 ← R5 ·R4?

R2 ← R2 ·R6?

R1 ←−R1?

R5 ← R12

R3 ←−R3

R4 ← R4 ·R6R6 ← R5 + R4R2 ←−R2R6 ← R6 + R2R3 ← R3 ·R4X3 ← R2 + R6?

R2 ← X3 + R2R1 ← R1 ·R2Y3 ← R3 + R1??

R1 ← X12

R2 ← Y1 + Y1

Z2 ← R2 ·Z1R4 ← R1 + R1

R3 ← R2 ·Y1R6 ← R3 + R3

R2 ← R6 ·R3R1 ← R4 + R1?

R1 ← R1 + W1R3 ← R1

2

?

R4 ← R6 ·X1R5 ←W1 + W1R4 ←−R4R3 ← R3 + R4W2 ← R2 ·R5X2 ← R3 + R4R2 ←−R2R6 ← R4 + X2R4 ← R6 ·R1?

R4 ←−R4Y2 ← R4 + R2

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 30 / 64

Page 78: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar Multiplication

Add. 1 Add. 2 Dbl.Sq.Add.Mult.Add.Mult.Add.Mult.Add.Add.Sq.Mult.Add.Sub.Mult.Sub.Sub.Mult.Sub.

R1 ← Z22

?R2 ← Y1 ·Z2?

R5 ← Y2 ·Z1?

R3 ← R1 ·R2??

R4 ← Z12

R2 ← R5 ·R4?

R2 ← R2 −R3R5 ← R1 ·X1??

R6 ← X2 ·R4R6 ← R6 −R5

R1 ← R62

?R4 ← R5 ·R1?

R5 ← R1 ·R6?

R1 ← Z1 ·R6??

R6 ← R22

Z3 ← R1 ·Z2R1 ← R4 + R4R6 ← R6 −R1R1 ← R5 ·R3X3 ← R6 −R5R4 ← R4 −X3R3 ← R4 ·R2Y3 ← R3 −R1

R1 ← X12

R2 ← Y1 + Y1Z2 ← R2 ·Z1R4 ← R1 + R1R3 ← R2 ·Y1R6 ← R3 + R3R2 ← R6 ·R3R1 ← R4 + R1R1 ← R1 + W1R3 ← R1

2

R4 ← R6 ·X1R5 ←W1 + W1R3 ← R3 −R4W2 ← R2 ·R5X2 ← R3 −R4R6 ← R4 −X2R4 ← R6 ·R1Y2 ← R4 −R2

8 multiplications→ 6 multiplications + 2 squarings

16 additions→ 6 additions + 4 subtractions

8 negations→ 0

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 31 / 64

Page 79: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar Multiplication

Add. 1 Add. 2 Dbl.Sq.Add.Mult.Add.Mult.Add.Mult.Add.Add.Sq.Mult.Add.Sub.Mult.Sub.Sub.Mult.Sub.

R1 ← Z22

?R2 ← Y1 ·Z2?

R5 ← Y2 ·Z1?

R3 ← R1 ·R2??

R4 ← Z12

R2 ← R5 ·R4?

R2 ← R2 −R3R5 ← R1 ·X1??

R6 ← X2 ·R4R6 ← R6 −R5

R1 ← R62

?R4 ← R5 ·R1?

R5 ← R1 ·R6?

R1 ← Z1 ·R6??

R6 ← R22

Z3 ← R1 ·Z2R1 ← R4 + R4R6 ← R6 −R1R1 ← R5 ·R3X3 ← R6 −R5R4 ← R4 −X3R3 ← R4 ·R2Y3 ← R3 −R1

R1 ← X12

R2 ← Y1 + Y1Z2 ← R2 ·Z1R4 ← R1 + R1R3 ← R2 ·Y1R6 ← R3 + R3R2 ← R6 ·R3R1 ← R4 + R1R1 ← R1 + W1R3 ← R1

2

R4 ← R6 ·X1R5 ←W1 + W1R3 ← R3 −R4W2 ← R2 ·R5X2 ← R3 −R4R6 ← R4 −X2R4 ← R6 ·R1Y2 ← R4 −R2

8 multiplications→ 6 multiplications + 2 squarings

16 additions→ 6 additions + 4 subtractions

8 negations→ 0

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 31 / 64

Page 80: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar Multiplication

Add. 1 Add. 2 Dbl.Sq.Add.Mult.Add.Mult.Add.Mult.Add.Add.Sq.Mult.Add.Sub.Mult.Sub.Sub.Mult.Sub.

R1 ← Z22

?R2 ← Y1 ·Z2?

R5 ← Y2 ·Z1?

R3 ← R1 ·R2??

R4 ← Z12

R2 ← R5 ·R4?

R2 ← R2 −R3R5 ← R1 ·X1??

R6 ← X2 ·R4R6 ← R6 −R5

R1 ← R62

?R4 ← R5 ·R1?

R5 ← R1 ·R6?

R1 ← Z1 ·R6??

R6 ← R22

Z3 ← R1 ·Z2R1 ← R4 + R4R6 ← R6 −R1R1 ← R5 ·R3X3 ← R6 −R5R4 ← R4 −X3R3 ← R4 ·R2Y3 ← R3 −R1

R1 ← X12

R2 ← Y1 + Y1Z2 ← R2 ·Z1R4 ← R1 + R1R3 ← R2 ·Y1R6 ← R3 + R3R2 ← R6 ·R3R1 ← R4 + R1R1 ← R1 + W1R3 ← R1

2

R4 ← R6 ·X1R5 ←W1 + W1R3 ← R3 −R4W2 ← R2 ·R5X2 ← R3 −R4R6 ← R4 −X2R4 ← R6 ·R1Y2 ← R4 −R2

8 multiplications→ 6 multiplications + 2 squarings

16 additions→ 6 additions + 4 subtractions

8 negations→ 0

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 31 / 64

Page 81: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Scalar Multiplication

Add. 1 Add. 2 Dbl.Sq.Add.Mult.Add.Mult.Add.Mult.Add.Add.Sq.Mult.Add.Sub.Mult.Sub.Sub.Mult.Sub.

R1 ← Z22

?R2 ← Y1 ·Z2?

R5 ← Y2 ·Z1?

R3 ← R1 ·R2??

R4 ← Z12

R2 ← R5 ·R4?

R2 ← R2 −R3R5 ← R1 ·X1??

R6 ← X2 ·R4R6 ← R6 −R5

R1 ← R62

?R4 ← R5 ·R1?

R5 ← R1 ·R6?

R1 ← Z1 ·R6??

R6 ← R22

Z3 ← R1 ·Z2R1 ← R4 + R4R6 ← R6 −R1R1 ← R5 ·R3X3 ← R6 −R5R4 ← R4 −X3R3 ← R4 ·R2Y3 ← R3 −R1

R1 ← X12

R2 ← Y1 + Y1Z2 ← R2 ·Z1R4 ← R1 + R1R3 ← R2 ·Y1R6 ← R3 + R3R2 ← R6 ·R3R1 ← R4 + R1R1 ← R1 + W1R3 ← R1

2

R4 ← R6 ·X1R5 ←W1 + W1R3 ← R3 −R4W2 ← R2 ·R5X2 ← R3 −R4R6 ← R4 −X2R4 ← R6 ·R1Y2 ← R4 −R2

8 multiplications→ 6 multiplications + 2 squarings

16 additions→ 6 additions + 4 subtractions

8 negations→ 0

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 31 / 64

Page 82: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Implementation

192 bits ECDSA @ 30 MHz (CPU) & 50 MHz (CC)

Original : 35 ms, Improved : 30 ms (- 14.5 %)Comparable RAM (≈ 500 Bytes) and Code size (≈ 3 KB)

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 32 / 64

Page 83: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 32 / 64

Page 84: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Our Contribution

I New atomic algorithms using squarings only

I Immune to attacks distinguishing squarings from multiplications

I Better efficiency than regular ladders

I Exponentiation algorithms for parallelized squarings with bestperformances to our knowledge

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 33 / 64

Page 85: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Exponentiation Cost Summary

Algorithm Cost / bit S/M = 1 S/M = .8 # regSquare & multiply 1,2,3 0.5M +1S 1.5M 1.3M 2Multiply always 2,3 1.5M 1.5M 1.5M 2Regular ladders 1M +1S 2M 1.8M 2

1 algorithm unprotected towards the SPA2 algorithm sensitive to S – M discrimination3 possible sliding window optimization

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 34 / 64

Page 86: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Replacing Multiplications by Squarings

x×y =(x +y)2−x2−y2

2(1)

x×y =

(x +y

2

)2

−(

x−y2

)2

(2)

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 35 / 64

Page 87: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Atomic Exponentiation

Square & multiply:

. . .

Atomic Multiply always:

. . .

Atomic Square always:

. . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 36 / 64

Page 88: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Regular Atomic Exponentiation

Square & multiply:

. . .

Atomic Multiply always:

. . .

Atomic Square always:

. . .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 36 / 64

Page 89: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Left-to-Right Algorithm

Input: m,n,d ∈ NOutput: md mod n

1: R0← 1 ; R1←m ; R2← 12: R3←m2/2 mod n3: j ← 0 ; i ← k −14: while i ≥ 0 do5: RMj ,0

← RMj ,1+RMj ,2

mod n

6: RMj ,3← RMj ,3

2 mod n7: RMj ,4

← RMj ,5/2 mod n

8: RMj ,6← RMj ,7

−RMj ,8mod n

9: j ← di (1+(j mod 3))10: i ← i−Mj ,9

11: return R0

j = 0 j = 1

j = 2j = 3

1 bit

0 bit 1 bit

0 bit

M =

1 1 1 0 2 1 1 1 2 12 0 1 2 2 2 2 2 3 01 1 3 0 0 0 0 2 0 03 3 3 0 3 3 1 1 3 1

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 37 / 64

Page 90: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Atomic Right-to-Left Algorithm

Input: m,n,d ∈ NOutput: md mod n

1: R0←m ; R1← 1 ; R2← 12: i ← 0 ; j ← 03: while i ≤ k −1 do4: j ← di (1+(j mod 3))5: RMj ,0

← RMj ,1+R0 mod n

6: RMj ,2← RMj ,3

/2 mod n7: RMj ,4

← RMj ,5−RMj ,6

mod n

8: RMj ,3← RMj ,3

2 mod n9: i ← i +Mj ,7

10: return R1

j = 0 j = 1

j = 2j = 3

1 bit

0 bit 1 bit

0 bit

M =

0 0 2 0 0 0 2 12 1 2 2 1 0 1 00 2 1 1 0 0 2 00 0 0 0 1 2 1 1

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 38 / 64

Page 91: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Cost Comparison

Algorithm Cost / bit S/M = 1 S/M = .8 # regSquare & multiply 1,2,3 0.5M +1S 1.5M 1.3M 2Multiply always 2,3 1.5M 1.5M 1.5M 2Regular ladder 1M +1S 2M 1.8M 2L.-to-r. square always3 2S 2M 1.6M 4R.-to-l. square always3 2S 2M 1.6M 3

→ 11 % speed-up over Montgomery ladder

1 algorithm unprotected towards the SPA2 algorithm sensitive to S – M discrimination3 possible sliding window optimization

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 39 / 64

Page 92: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Implementation

AT90SC chip @ 30MHz with AdvX arithmetic coprocessor:

Algorithm Key len. (b) Code (B) RAM (B) Timing (ms)

Mont. ladder512 360 128 30

1024 360 256 2002048 360 512 1840

Square Always512 510 192 28

1024 510 384 1902048 510 768 1740

→ 5 % practical speed-up obtained in practice

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 40 / 64

Page 93: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Parallelization

Motivation:I Many devices are equipped with multi-core processorsI Parallelized Montgomery ladder : 1M / bitI Squarings are independent in equations (1) and (2)

We study how to optimize square always algorithms if two parallelsquarings are available using space/time trade-offs.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 41 / 64

Page 94: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Parallelization

Motivation:I Many devices are equipped with multi-core processorsI Parallelized Montgomery ladder : 1M / bitI Squarings are independent in equations (1) and (2)

We study how to optimize square always algorithms if two parallelsquarings are available using space/time trade-offs.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 41 / 64

Page 95: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Cost Summary

We demonstrate that the cost of our parallelized algorithm using λ extraregisters tends to: (

1+1

4λ +2

)S

Algorithm General cost S/M = 1 S/M = 0.8Parallel Montgomery ladder 1M 1M 1MParallel square always λ = 1 7S/6 1.17M 0.93MParallel square always λ = 2 11S/10 1.10M 0.88MParallel square always λ = 3 15S/14 1.07M 0.86M

......

......

Parallel square always λ → ∞ 1S 1M 0.8M

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 42 / 64

Page 96: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 42 / 64

Page 97: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Our Contribution

I New differential analysis on exponentiation using a single trace

I Any exponentiation algorithm can be subject to this attack

I Circumvent the exponent blinding countermeasure

I Require the knowledge of underlying modular multiplicationimplementation

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 43 / 64

Page 98: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Modular Multiplication Implementation

Schoolbook long-integer multiplication x×y in base b with x ,y < bk

Input: x = (xk−1xk−2 . . .x0)b, y = (yk−1yk−2 . . .y0)bOutput: x×yUses: w = (w2k−1w2k−2 . . .w0)

1: w ← (00 . . .0)2: for i = 0 to k −1 do3: c← 04: for j = 0 to k −1 do5: (uv)b← wi+j +xi ×yj +c6: wi+j ← v7: c← u8: wi+k ← c9: return w

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 44 / 64

Page 99: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Modular Multiplication ImplementationRows and columns

xk−1 . . . x2 x1 x0

× yk−1 . . . y2 y1 y0

+ x0yk−1 . . . x0y2 x0y1 x0y0

+ x1yk−1 x1yk−2 . . . x1y1 x1y0

+ x2yk−1 x2yk−2 x2yk−3 . . . x2y0

... . ..

+ xk−2yk−1 . . . xk−2y2 xk−2y1 xk−2y0

+ xk−1yk−1 xk−1yk−2 . . . xk−1y1 xk−1y0

w2k−1 w2k−2 w2k−3 . . . w2 w1 w0

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 45 / 64

Page 100: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Horizontal Correlation Analysis

Vertical: Horizontal:

...

. . . . . .

. . . . . . . . . . . .

• Uses N segments from differenttraces.

• Uses k2 segments from a singletrace.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 46 / 64

Page 101: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Horizontal Side-Channel Analysis

T

T 1 T 2 T 3

. . .

T s T s+1 T s+2

. . .

Ts0,0 T

s0,2

. . .

Ts1,0 T

s1,2

. . .

Ts1,k−1

. . .

Tsk−

1,0

Tsk−

1,2

. . .

Tsk−

1,k−1

We target single-multiplication segments T si ,j of the s-th modular

multiplication inside a single leakage trace T .

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 47 / 64

Page 102: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Horizontal Correlation Analysis

Considering an atomic multiply-always implementation:

Input: m,n,d ∈ NOutput: md mod n

1: R0← 12: R1←m3: i ← `−14: t ← 05: while i ≥ 0 do6: R0← R0×Rt mod n7: t ← t⊕di8: i ← i−1+ t9: return R0

I Execute a single RSA signaturemd mod n and collect the executionpower trace T .

I Assuming u most significant bits of d areknown by the attacker:

d = (d`−1 . . .d`−u d`−(u+1) . . .d1d0)

I Let R(u)0 denote the value of R0 after

processing the u-th bit of d :R(u)

0 = md`−1...d`−u mod n

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 48 / 64

Page 103: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Horizontal Correlation Analysis

Considering an atomic multiply-always implementation:

Input: m,n,d ∈ NOutput: md mod n

1: R0← 12: R1←m3: i ← `−14: t ← 05: while i ≥ 0 do6: R0← R0×Rt mod n7: t ← t⊕di8: i ← i−1+ t9: return R0

I Execute a single RSA signaturemd mod n and collect the executionpower trace T .

I Assuming u most significant bits of d areknown by the attacker:

d = (d`−1 . . .d`−u d`−(u+1) . . .d1d0)

I Let R(u)0 denote the value of R0 after

processing the u-th bit of d :R(u)

0 = md`−1...d`−u mod n

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 48 / 64

Page 104: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Horizontal Correlation Analysis

Considering an atomic multiply-always implementation:

Input: m,n,d ∈ NOutput: md mod n

1: R0← 12: R1←m3: i ← `−14: t ← 05: while i ≥ 0 do6: R0← R0×Rt mod n7: t ← t⊕di8: i ← i−1+ t9: return R0

I Execute a single RSA signaturemd mod n and collect the executionpower trace T .

I Assuming u most significant bits of d areknown by the attacker:

d = (d`−1 . . .d`−u d`−(u+1) . . .d1d0)

I Let R(u)0 denote the value of R0 after

processing the u-th bit of d :R(u)

0 = md`−1...d`−u mod n

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 48 / 64

Page 105: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Horizontal Correlation Analysis

Considering an atomic multiply-always implementation:

Input: m,n,d ∈ NOutput: md mod n

1: R0← 12: R1←m3: i ← `−14: t ← 05: while i ≥ 0 do6: R0← R0×Rt mod n7: t ← t⊕di8: i ← i−1+ t9: return R0

I Execute a single RSA signaturemd mod n and collect the executionpower trace T .

I Assuming u most significant bits of d areknown by the attacker:

d = (d`−1 . . .d`−u d`−(u+1) . . .d1d0)

I Let R(u)0 denote the value of R0 after

processing the u-th bit of d :R(u)

0 = md`−1...d`−u mod n

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 48 / 64

Page 106: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Horizontal Correlation Analysis

Let v = u+HW(d`−1 . . .d`−u) i.e. u-th bit ←→ multiplication T v

R(u)0���1

PPPq

d`−u−1= 1

d`−u−1= 0

R(u)0 ×R(u)

0

R(u)0 ×R(u)

0

- R(u)0

2×m

-d`−u−2= 0,1R(u)

02×R(u)

02· · ·

· · ·

T v+1 T v+2

I Compute correlation between:I trace segments T v+2

i ,j and values Dj = mj or

I trace segments T v+2i ,j and values Di ,j = R(u)

0,i ×mj

I If correlation peak: d`−(u+1) = 1, or d`−(u+1) = 0 otherwise.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 49 / 64

Page 107: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Horizontal Correlation Analysis

Let v = u+HW(d`−1 . . .d`−u) i.e. u-th bit ←→ multiplication T v

R(u)0���1

PPPq

d`−u−1= 1

d`−u−1= 0

R(u)0 ×R(u)

0

R(u)0 ×R(u)

0

- R(u)0

2×m

-d`−u−2= 0,1R(u)

02×R(u)

02· · ·

· · ·

T v+1 T v+2

I Compute correlation between:I trace segments T v+2

i ,j and values Dj = mj or

I trace segments T v+2i ,j and values Di ,j = R(u)

0,i ×mj

I If correlation peak: d`−(u+1) = 1, or d`−(u+1) = 0 otherwise.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 49 / 64

Page 108: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Horizontal Correlation Analysis

Let v = u+HW(d`−1 . . .d`−u) i.e. u-th bit ←→ multiplication T v

R(u)0���1

PPPq

d`−u−1= 1

d`−u−1= 0

R(u)0 ×R(u)

0

R(u)0 ×R(u)

0

- R(u)0

2×m

-d`−u−2= 0,1R(u)

02×R(u)

02· · ·

· · ·

T v+1 T v+2

I Compute correlation between:I trace segments T v+2

i ,j and values Dj = mj or

I trace segments T v+2i ,j and values Di ,j = R(u)

0,i ×mj

I If correlation peak: d`−(u+1) = 1, or d`−(u+1) = 0 otherwise.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 49 / 64

Page 109: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Experimental Results

Correlation trace result on series oftraces T v+2

i ,j with Dj = mj

Correlation trace result on series ofsegments T v+2

i ,j with Di ,j = R(u)0,i ×mj

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 50 / 64

Page 110: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 50 / 64

Page 111: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Our Contribution

I New countermeasure against differential analysis for RSA andECC

I Designed to protect from horizontal analysis

I Implemented at the multi-precision multiplication level

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 51 / 64

Page 112: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and blinding columns

Let us shuffle the rows of the multiplication:

Choose at random a permutationα of (0,1, . . . ,k −1) and compute:

(c,wα(i)+j )b = wα(i)+j +xα(i)×yj +c

xk−1 . . . x2 x1 x0

× yk−1 . . . y2 y1 y0

+ x0yk−1 . . . x0y2 x0y1 x0y0

+ x1yk−1 x1yk−2 . . . x1y1 x1y0

+ x2yk−1 x2yk−2 x2yk−3 . . . x2y0

... . ..

+ xk−2yk−1 . . . xk−2y2 xk−2y1 xk−2y0

+ xk−1yk−1 xk−1yk−2 . . . xk−1y1 xk−1y0

w2k−1 w2k−2 w2k−3 . . . w2 w1 w0

Still necessary to blind columns:

For each row α(i), choose at random a word r ,compute and store r ×xα(i),blind each single-precision multiplication:

(c,wα(i)+j )b = wα(i)+j + xα(i)× (yj − r) + r ×xα(i) + c

z Provides k! different sequences of single-precision multiplications.

z Requires k extra multiplications and 3 extra words of storage.

z Saves k + 1 multiplications and 4k −1 words of storage compared to the full blindingcountermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 52 / 64

Page 113: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and blinding columns

Choose at random a permutation α of (0,1, . . . ,k −1) and compute:

(c,wα(i)+j )b = wα(i)+j +xα(i)×yj +c

xk−1 . . . x2 x1 x0

× yk−1 . . . y2 y1 y0

+ xk−2yk−1 . . . xk−2y2 xk−2y1 xk−2y0

+ x0yk−1 . . . x0y2 x0y1 x0y0

+ x2yk−1 x2yk−2 x2yk−3 . . . x2y0

......

+ xk−1yk−1 xk−1yk−2 . . . xk−1y1 xk−1y0

+ x1yk−1 x1yk−2 . . . x1y1 x1y0

w2k−1 w2k−2 w2k−3 . . . w2 w1 w0

Still necessary to blind columns:

For each row α(i), choose at random a word r ,compute and store r ×xα(i),blind each single-precision multiplication:

(c,wα(i)+j )b = wα(i)+j + xα(i)× (yj − r) + r ×xα(i) + c

z Provides k! different sequences of single-precision multiplications.

z Requires k extra multiplications and 3 extra words of storage.

z Saves k + 1 multiplications and 4k −1 words of storage compared to the full blindingcountermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 52 / 64

Page 114: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and blinding columns

Choose at random a permutation α of (0,1, . . . ,k −1) and compute:

(c,wα(i)+j )b = wα(i)+j +xα(i)×yj +c

Still necessary to blind columns:

For each row α(i), choose at random a word r ,compute and store r ×xα(i),blind each single-precision multiplication:

(c,wα(i)+j )b = wα(i)+j +xα(i)× (yj − r)+ r ×xα(i) +c

z Provides k ! different sequences of single-precision multiplications.

z Requires k extra multiplications and 3 extra words of storage.

z Saves k +1 multiplications and 4k−1 words of storage compared to the fullblinding countermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 52 / 64

Page 115: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and blinding columns

Choose at random a permutation α of (0,1, . . . ,k −1) and compute:

(c,wα(i)+j )b = wα(i)+j +xα(i)×yj +c

Still necessary to blind columns:

For each row α(i), choose at random a word r ,compute and store r ×xα(i),blind each single-precision multiplication:

(c,wα(i)+j )b = wα(i)+j +xα(i)× (yj − r)+ r ×xα(i) +c

z Provides k ! different sequences of single-precision multiplications.

z Requires k extra multiplications and 3 extra words of storage.

z Saves k +1 multiplications and 4k−1 words of storage compared to the fullblinding countermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 52 / 64

Page 116: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and blinding columns

Choose at random a permutation α of (0,1, . . . ,k −1) and compute:

(c,wα(i)+j )b = wα(i)+j +xα(i)×yj +c

Still necessary to blind columns:

For each row α(i), choose at random a word r ,compute and store r ×xα(i),blind each single-precision multiplication:

(c,wα(i)+j )b = wα(i)+j +xα(i)× (yj − r)+ r ×xα(i) +c

z Provides k ! different sequences of single-precision multiplications.

z Requires k extra multiplications and 3 extra words of storage.

z Saves k +1 multiplications and 4k−1 words of storage compared to the fullblinding countermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 52 / 64

Page 117: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and blinding columns

Choose at random a permutation α of (0,1, . . . ,k −1) and compute:

(c,wα(i)+j )b = wα(i)+j +xα(i)×yj +c

Still necessary to blind columns:

For each row α(i), choose at random a word r ,compute and store r ×xα(i),blind each single-precision multiplication:

(c,wα(i)+j )b = wα(i)+j +xα(i)× (yj − r)+ r ×xα(i) +c

z Provides k ! different sequences of single-precision multiplications.

z Requires k extra multiplications and 3 extra words of storage.

z Saves k +1 multiplications and 4k−1 words of storage compared to the fullblinding countermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 52 / 64

Page 118: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and columns

Let us now shuffle the rows and the columns of the multiplication:

Choose at random two permutations α,β of (0,1, . . . ,k −1) and compute:

(cβ(j),wα(i)+β(j))b = wα(i)+β(j) +xα(i)×yβ(j)

Carry propagation is more complicated and requires a k -word array c.

z Provides (k !)2 different sequences of single-precision multiplications.

z Requires no extra multiplication but k extra words of storage.

z Saves k multiplications but uses additional storage compared to theprevious countermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 53 / 64

Page 119: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and columns

Let us now shuffle the rows and the columns of the multiplication:

Choose at random two permutations α,β of (0,1, . . . ,k −1) and compute:

(cβ(j),wα(i)+β(j))b = wα(i)+β(j) +xα(i)×yβ(j)

Carry propagation is more complicated and requires a k -word array c.

z Provides (k !)2 different sequences of single-precision multiplications.

z Requires no extra multiplication but k extra words of storage.

z Saves k multiplications but uses additional storage compared to theprevious countermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 53 / 64

Page 120: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and columns

Let us now shuffle the rows and the columns of the multiplication:

Choose at random two permutations α,β of (0,1, . . . ,k −1) and compute:

(cβ(j),wα(i)+β(j))b = wα(i)+β(j) +xα(i)×yβ(j)

Carry propagation is more complicated and requires a k -word array c.

z Provides (k !)2 different sequences of single-precision multiplications.

z Requires no extra multiplication but k extra words of storage.

z Saves k multiplications but uses additional storage compared to theprevious countermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 53 / 64

Page 121: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and columns

Let us now shuffle the rows and the columns of the multiplication:

Choose at random two permutations α,β of (0,1, . . . ,k −1) and compute:

(cβ(j),wα(i)+β(j))b = wα(i)+β(j) +xα(i)×yβ(j)

Carry propagation is more complicated and requires a k -word array c.

z Provides (k !)2 different sequences of single-precision multiplications.

z Requires no extra multiplication but k extra words of storage.

z Saves k multiplications but uses additional storage compared to theprevious countermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 53 / 64

Page 122: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer MultiplicationShuffling rows and columns

Let us now shuffle the rows and the columns of the multiplication:

Choose at random two permutations α,β of (0,1, . . . ,k −1) and compute:

(cβ(j),wα(i)+β(j))b = wα(i)+β(j) +xα(i)×yβ(j)

Carry propagation is more complicated and requires a k -word array c.

z Provides (k !)2 different sequences of single-precision multiplications.

z Requires no extra multiplication but k extra words of storage.

z Saves k multiplications but uses additional storage compared to theprevious countermeasure.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 53 / 64

Page 123: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer Multiplication

For instance, using a 32-bit multiplier:

bit length k ! (k !)2

256 ≈ 215 ≈ 230

512 ≈ 244 ≈ 288

1024 ≈ 2117 ≈ 2235

z Also compatible with interleaved multiplications and reductions.

z Studying the cost of these countermeasures for hardware implementationsrequires further investigation.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 54 / 64

Page 124: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer Multiplication

For instance, using a 32-bit multiplier:

bit length k ! (k !)2

256 ≈ 215 ≈ 230

512 ≈ 244 ≈ 288

1024 ≈ 2117 ≈ 2235

z Also compatible with interleaved multiplications and reductions.

z Studying the cost of these countermeasures for hardware implementationsrequires further investigation.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 54 / 64

Page 125: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Long-Integer Multiplication

For instance, using a 32-bit multiplier:

bit length k ! (k !)2

256 ≈ 215 ≈ 230

512 ≈ 244 ≈ 288

1024 ≈ 2117 ≈ 2235

z Also compatible with interleaved multiplications and reductions.

z Studying the cost of these countermeasures for hardware implementationsrequires further investigation.

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 54 / 64

Page 126: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 54 / 64

Page 127: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Our Contribution

I Improved collision-correlation techniques on AES defeatingsome first-order protected implementations

I Need less than 1500 acquisitions in our experiments

I No need to establish a consumption model for correlation

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 55 / 64

Page 128: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

AES Overview

We focus on AES-128:I message M = (m0 m1 . . . m15)

I key K = (k0 k1 . . . k15)

I ciphertext C = (c0 c1 . . . c15)

I for i ∈ [0,15] we denote xi = mi ⊕ki

Our attack targets the first round SubBytes

function

AES

message

key

SubBytes

ShiftRows

MixColumns

subkey 1

ciphertext

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 56 / 64

Page 129: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

AES Overview

We focus on AES-128:I message M = (m0 m1 . . . m15)

I key K = (k0 k1 . . . k15)

I ciphertext C = (c0 c1 . . . c15)

I for i ∈ [0,15] we denote xi = mi ⊕ki

Our attack targets the first round SubBytes

function

AES

message

key

SubBytes

ShiftRows

MixColumns

subkey 1

ciphertext

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 56 / 64

Page 130: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Principle

Detect internal collisions between data processed in blinded S-Boxes in thefirst AES round:

data1⊕mask = data2⊕mask

Two protections against first-order attacks are considered:

1. substitution table masking: S′(xi ⊕u) = S(xi )⊕v , with u 6= vsame masks u and v for all bytes

2. masked pseudo-inversion in F28 : I′(xi ⊕ui ) = I(xi )⊕ui , for 0≤ i ≤ 1516 different masks but same input and output masks

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 57 / 64

Page 131: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Principle

Detect internal collisions between data processed in blinded S-Boxes in thefirst AES round:

data1⊕mask = data2⊕mask

Two protections against first-order attacks are considered:

1. substitution table masking: S′(xi ⊕u) = S(xi )⊕v , with u 6= vsame masks u and v for all bytes

2. masked pseudo-inversion in F28 : I′(xi ⊕ui ) = I(xi )⊕ui , for 0≤ i ≤ 1516 different masks but same input and output masks

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 57 / 64

Page 132: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Collision-Correlation Analysis

I Encrypt N times the same message M

I Collect the power traces T n, 0≤ n≤N−1

I Consider two instructions whoseprocessing starts at times t0 and t1l points are acquired per instructionprocessing

I Construct the two series Θ0 = (T nt0

)n andΘ1 = (T n

t1)n of power consumptions

segments

T 0

t0 t0 + l t1 t1 + l

T 1

t0 t0 + l t1 t1 + l

...

T N−1

t0 t0 + l t1 t1 + l

Θ0 Θ1

I Apply a statistical treatment to (Θ0,Θ1) to identify if same data was involved in T nt0

and T nt1

I We choose the Pearson correlation factor ρΘ0,Θ1 (t) =cov(Θ0(t),Θ1(t))

σΘ0(t)σΘ1(t)

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 58 / 64

Page 133: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Collision-Correlation Analysis

I Encrypt N times the same message M

I Collect the power traces T n, 0≤ n≤N−1

I Consider two instructions whoseprocessing starts at times t0 and t1l points are acquired per instructionprocessing

I Construct the two series Θ0 = (T nt0

)n andΘ1 = (T n

t1)n of power consumptions

segments

T 0

t0 t0 + l t1 t1 + l

T 1

t0 t0 + l t1 t1 + l...

T N−1

t0 t0 + l t1 t1 + l

Θ0 Θ1

I Apply a statistical treatment to (Θ0,Θ1) to identify if same data was involved in T nt0

and T nt1

I We choose the Pearson correlation factor ρΘ0,Θ1 (t) =cov(Θ0(t),Θ1(t))

σΘ0(t)σΘ1(t)

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 58 / 64

Page 134: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Collision-Correlation Analysis

I Encrypt N times the same message M

I Collect the power traces T n, 0≤ n≤N−1

I Consider two instructions whoseprocessing starts at times t0 and t1l points are acquired per instructionprocessing

I Construct the two series Θ0 = (T nt0

)n andΘ1 = (T n

t1)n of power consumptions

segments

T 0

t0 t0 + l t1 t1 + l

T 1

t0 t0 + l t1 t1 + l...

T N−1

t0 t0 + l t1 t1 + l

Θ0 Θ1

I Apply a statistical treatment to (Θ0,Θ1) to identify if same data was involved in T nt0

and T nt1

I We choose the Pearson correlation factor ρΘ0,Θ1 (t) =cov(Θ0(t),Θ1(t))

σΘ0(t)σΘ1(t)

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 58 / 64

Page 135: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Collision-Correlation Analysis

I Encrypt N times the same message M

I Collect the power traces T n, 0≤ n≤N−1

I Consider two instructions whoseprocessing starts at times t0 and t1l points are acquired per instructionprocessing

I Construct the two series Θ0 = (T nt0

)n andΘ1 = (T n

t1)n of power consumptions

segments

T 0

t0 t0 + l t1 t1 + l

T 1

t0 t0 + l t1 t1 + l...

T N−1

t0 t0 + l t1 t1 + l

Θ0 Θ1

I Apply a statistical treatment to (Θ0,Θ1) to identify if same data was involved in T nt0

and T nt1

I We choose the Pearson correlation factor ρΘ0 ,Θ1 (t) =cov(Θ0(t),Θ1(t))

σΘ0(t)σΘ1(t)

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 58 / 64

Page 136: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

First Attack Description (1)

Principle: detect when two SubBytes inputs (and outputs) are equalin first AES round

m4⊕k4⊕u m9⊕k9⊕u=

x ′0 x ′1 x ′2 x ′3 x ′4 x ′5 x ′6 x ′7 x ′8 x ′9 x ′10 x ′11 x ′12 x ′13 x ′14 x ′15

S′ S′ S′ S′ S′ S′ S′ S′ S′ S′ S′ S′ S′ S′ S′ S′

y ′0 y ′1 y ′2 y ′3 y ′4 y ′5 y ′6 y ′7 y ′8 y ′9 y ′10 y ′11 y ′12 y ′13 y ′14 y ′15

k4⊕k9 = m4⊕m9

Result: provide a relation between two key bytes

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 59 / 64

Page 137: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

First Attack Description (2)

I Encrypt N times the same message M and collect the N traces of firstAES round

I For the 120 possible pairs (i1, i2) compute ρΘi1 ,Θi2(t)

I When a correlation peak appears a relation between ki1 and ki2 is foundI Repeat for several random messages M until enough relations are found

zOn average 59 messages are neededTotal number of traces = 59×N

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 60 / 64

Page 138: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

First Attack Description (2)

I Encrypt N times the same message M and collect the N traces of firstAES round

I For the 120 possible pairs (i1, i2) compute ρΘi1 ,Θi2(t)

I When a correlation peak appears a relation between ki1 and ki2 is foundI Repeat for several random messages M until enough relations are found

zOn average 59 messages are neededTotal number of traces = 59×N

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 60 / 64

Page 139: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Experimental Results

Correlation traces obtained on real traces for N = 25

-0.5

0

0.5

1

100 125 150 175 200

Corr

ela

tion

Time

-0.5

0

0.5

1

100 125 150 175 200

Corr

ela

tion

Time

Total number of acquisitions : 25×59≈ 1500

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 61 / 64

Page 140: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Second Attack Description (1)

Previous attack cannot be applied to masked inversion if masks are differentfor each byte

0⊕u3

x ′0 x ′1 x ′2 x ′3 x ′4 x ′15. . .

I ′ I ′ I ′ I ′ I ′ I ′. . .

y ′0 y ′1 y ′2 y ′3 y ′4 y ′15. . .

0⊕u3

or

1⊕u3

x ′0 x ′1 x ′2 x ′3 x ′4 x ′15. . .

I ′ I ′ I ′ I ′ I ′ I ′. . .

y ′0 y ′1 y ′2 y ′3 y ′4 y ′15. . .

1⊕u3

Collision between input and output reveals one key byte except one bit:

ki = mi or ki = mi ⊕1

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 62 / 64

Page 141: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Practical Results

Correlation traces obtained on simulated traces for thepseudo-inversion of the first byte in GF (28) with N = 16

-1

-0.5

0

0.5

1

10 20 30 40 50 60

Corr

ela

tion

Time

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 63 / 64

Page 142: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Outline

IntroductionRSA and Elliptic Curve CryptographyScalar Multiplication ImplementationSide-Channel Analysis

Improved Atomic Pattern for Scalar Multiplication

Square Always Exponentiation

Horizontal Correlation Analysis

Long-Integer Multiplication Blinding and Shuffling

Collision-Correlation Analysis on AES

Conclusion

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 63 / 64

Page 143: Elliptic Curve Cryptography and Security of Embedded ...Elliptic Curve Cryptography and Security of Embedded Devices Ph.D. Defense Vincent Verneuil Institut de Mathematiques de Bordeaux´

Conclusion

Concrete results of this thesis:I 4 publications in international conferences (CHES, INDOCRYPT,

CARDIS, ICICS)I 4 patent registrations

Personal benefits:I Research with industrial constraints is motivatingI Both implementation and side-channel analysis covered in this

researchI Both high and low-level implementation studiedI Both public and private-key cryptography investigated

V. Verneuil - Elliptic Curve Cryptography and Security of Embedded Devices 64 / 64