36
Randomness as countermeasures against Side Channel Attacks Nadia El Mrabet [email protected] Mines St Etienne WRACH’2019, April 17, 2019

Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet [email protected] Mines St Etienne WRACH’2019,April17,2019

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Randomness as countermeasures againstSide Channel Attacks

Nadia El Mrabet

[email protected]

Mines St Etienne

WRACH’2019, April 17, 2019

Page 2: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

Presentation given here

Randomness and SCA Nadia El Mrabet 1 / 24

Page 3: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

In real lifeWhat could be vulnerable ?

Randomness and SCA Nadia El Mrabet 2 / 24

Page 4: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

In real lifeExisting attacks

Randomness and SCA Nadia El Mrabet 3 / 24

Page 5: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

In real lifeExisting attacks

Randomness and SCA Nadia El Mrabet 4 / 24

Page 6: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

In real life

I Industrials are building teams to protect their product (Apple,Google, Wawai...)

Randomness and SCA Nadia El Mrabet 5 / 24

Page 7: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

Attacks on Device

Randomness and SCA Nadia El Mrabet 6 / 24

Page 8: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The most important point

Figure – High level explanation of SCA

Randomness and SCA Nadia El Mrabet 7 / 24

Page 9: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The most important point

Figure – Selection according to guesses on the key

Randomness and SCA Nadia El Mrabet 8 / 24

Page 10: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The most important point

Figure – Real curve attack

Randomness and SCA Nadia El Mrabet 9 / 24

Page 11: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The Countermeasures

I Physical

I Algorithmic

I Arithmetical

Randomness and SCA Nadia El Mrabet 10 / 24

Page 12: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The Countermeasures

I Physical

I Algorithmic

I Arithmetical

Randomness and SCA Nadia El Mrabet 10 / 24

Page 13: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

Physical countermeasuresDuplication of the circuit

Dual rail technology

Randomness and SCA Nadia El Mrabet 11 / 24

Page 14: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

Physical countermeasuresProtection of the circuit

Shield Randomisation of the circuit

Randomness and SCA Nadia El Mrabet 12 / 24

Page 15: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

First arithmetical countermeasuresDouble and add algorithm

Data: r = (rN . . . r0)2, P ∈ EResult: rPT ← P ;for i = N − 1 to 0 do

T ← [2]T ;if ri = 1 then

T ← T + P;end

endreturn T = [r ]PAlgorithm 1: Double and add

Figure – SPA

Randomness and SCA Nadia El Mrabet 13 / 24

Page 16: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

First arithmetical countermeasuresHandle the leakages

T ← P ;for i = N − 1 to 0 do

T ← 2T ;if ri = 1 thenT ← T + P;

else U ← T + P;endreturn T = rPAlgorithm 2: Double and addalways

FAULT ATTACK STRIKES

T0 ← P,T1 ← 2P ;for i = N − 1 to 0 do

if ri = 1 thenT0 ← T0 + T1,T1 ← 2T1elseT1 ← T0 + T1,T0 ← 2T0

endendreturn T0Algorithm 3: Montgomeryladder

Randomness and SCA Nadia El Mrabet 14 / 24

Page 17: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

First arithmetical countermeasuresHandle the leakages

T ← P ;for i = N − 1 to 0 do

T ← 2T ;if ri = 1 thenT ← T + P;

else U ← T + P;endreturn T = rPAlgorithm 4: Double and addalways

FAULT ATTACK STRIKES

T0 ← P,T1 ← 2P ;for i = N − 1 to 0 do

if ri = 1 thenT0 ← T0 + T1,T1 ← 2T1elseT1 ← T0 + T1,T0 ← 2T0

endendreturn T0Algorithm 5: Montgomeryladder

Randomness and SCA Nadia El Mrabet 14 / 24

Page 18: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

First arithmetical countermeasuresHandle the leakages

T ← P ;for i = N − 1 to 0 do

T ← 2T ;if ri = 1 thenT ← T + P;

else U ← T + P;endreturn T = rPAlgorithm 6: Double and addalways

FAULT ATTACK STRIKES

T0 ← P,T1 ← 2P ;for i = N − 1 to 0 do

if ri = 1 thenT0 ← T0 + T1,T1 ← 2T1elseT1 ← T0 + T1,T0 ← 2T0

endendreturn T0Algorithm 7: Montgomeryladder

Randomness and SCA Nadia El Mrabet 14 / 24

Page 19: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

First arithmetical countermeasures

The Montgomery ladder is not sufficient

I Goubin’s attack : uses a special point (several variants, samemethod).

I Walter’s attack : uses leakage from the conditional branch.I Correlation collision attack (vertical and horizontal).

Template, deep learning attacks...

Generic protection

I Constant time implementation : necessary but not sufficient.I The less conditional branches is the better.

Randomness and SCA Nadia El Mrabet 15 / 24

Page 20: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

First arithmetical countermeasures

Behind Montgomery ladder

I Joye’s double-addI Add-OnlyI Square Only (Remember Thomas presentation)I Zero-less signed digit expansionI Atomic block

Randomness and SCA Nadia El Mrabet 16 / 24

Page 21: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

First arithmetical countermeasures

Behind Montgomery ladder

I Joye’s double-add [Still safe]I Add-Only [ Correlation collision attacks ]I Square Only (Remember Thomas presentation) [ Correlation

collision attacks ]I Zero-less signed digit expansion [Still safe]I Atomic block [Horizontal correlation collision attacks ]

Randomness and SCA Nadia El Mrabet 16 / 24

Page 22: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The property of the cryptosystem

ECC : representation of the curve

I Edwards curves, inverted Edwards curvesI Huff model, Hessian curvesI Jacobi curves

Randomness and SCA Nadia El Mrabet 17 / 24

Page 23: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The property of the cryptosystem

ECC : representation of the curve

I Edwards curves, inverted Edwards curves [Template attacks ]I Huff model, Hessian curvesI Jacobi curves

Randomness and SCA Nadia El Mrabet 17 / 24

Page 24: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The property of the cryptosystem

ECC : representation of the curve

I Edwards curves, inverted Edwards curves [Template attacks ]I Huff model, Hessian curvesI Jacobi curves

ECC : representation of the points

I Unified formulaes for Weieirstrass⇒ Goubin’s, Izu-Takagi’s attacks (special point)⇒ Amiel et al’s attack : uses SCA to distinguish a S from a M⇒ Horizontal attacks

Randomness and SCA Nadia El Mrabet 17 / 24

Page 25: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The property of the cryptosystem

ECC : randomisation of the scalar

I Coron’s countermeasureI Exponentiation splittingI Trichina-Bellezza’s countermeasure : kP = (kr−1)rP

I Regular representation of the scalarI Euclidien chain (Remember Christophe, Jean-Marc, Nicolas

presentations)I Chevallier-Mames Self-Randomised Exponentiation

Randomness and SCA Nadia El Mrabet 18 / 24

Page 26: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The property of the cryptosystem

ECC : randomisation of the scalar

I Coron’s countermeasure [Big attack]I Exponentiation splitting [Big Mac attack]I Trichina-Bellezza’s countermeasure : kP = (kr−1)rP [Still safe]I Regular representation of the scalar [ Correlation collision attacks ]I Euclidien chain (Remember Christophe, Jean-Marc, Nicolas

presentations) [Big Mac attack]I Chevallier-Mames Self-Randomised Exponentiation [Still safe]

Randomness and SCA Nadia El Mrabet 18 / 24

Page 27: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The property of the cryptosystem

ECC : randomisation of the scalar

I Coron’s countermeasure [Big attack]I Exponentiation splitting [Big Mac attack]I Trichina-Bellezza’s countermeasure : kP = (kr−1)rP [Still safe]I Regular representation of the scalar [ Correlation collision attacks ]I Euclidien chain (Remember Christophe, Jean-Marc, Nicolas

presentations) [Big Mac attack]I Chevallier-Mames Self-Randomised Exponentiation [Still safe]

ECC : A lot of counter measures, but much more attacks !

Randomness and SCA Nadia El Mrabet 18 / 24

Page 28: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The property of the cryptosystem

Pairing based cryptography

I Bilinear function, non degenerate.I Very great for key schedule, hierarchical encryption, several

signatures schemes...I Natively sensitive to SCA.I Counter measures for ECC can be used.I e(P,Q) = e(aP, bQ), for a and b such that ab = 1 mod r .I

e(P,Q) =e(P + R,Q)

e(R,Q).

Randomness and SCA Nadia El Mrabet 19 / 24

Page 29: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The property of the cryptosystem

AES

Masking and masking ormasking

Randomness and SCA Nadia El Mrabet 20 / 24

Page 30: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

The graal

White box cryptography

I The method is somehow an obfuscation of the algorithm.I There is a contest organized within CHES.I As far as I know, no resistant scheme is existing.I I see one major drawback : the contradiction with Kerchoffs rules.I Luca will maybe find a nice asymmetric protocole.

Randomness and SCA Nadia El Mrabet 21 / 24

Page 31: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

Random multiplication flow

I For a given protocol, the instruction flow for the multiplication isdifferent for each product.

I Somewhat, it comes back to a random circuit for each device.I Could be resistant to reverse engineering,I BUT very hard to deploy in practice.I There is no guarantee that it would resist to SCA.

Randomness and SCA Nadia El Mrabet 22 / 24

Page 32: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

Randomisation of the representation

Projectives coordinates for ECCLet P be a point of an elliptic curve E , λ a scalar then we have

(XP ,YP ,ZP) = (λXP , λYP , λZP).

⇒ Special point attacks

Figure – Big Mac attack

Randomness and SCA Nadia El Mrabet 23 / 24

Page 33: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

Randomisation of the representation

Projectives coordinates for ECCLet P be a point of an elliptic curve E , λ a scalar then we have

(XP ,YP ,ZP) = (λXP , λYP , λZP).

⇒ Special point attacks

Figure – Big Mac attack

Randomness and SCA Nadia El Mrabet 23 / 24

Page 34: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

Randomisation of the arithmetic

Smart-Oswald-Page randomised representationInstead of working modulo m within the range {0, . . . ,m − 1} you workmodulo C = c ×m, for c a coprime integer to m in the range{0, . . . ,C − 1}.

The ultimate solution

Randomness and SCA Nadia El Mrabet 24 / 24

Page 35: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

Randomisation of the arithmetic

PMNS : the ultimate solution

I a ∈ Fp, a =∑n

0 aiγi for a given γ and ai ≤ ρ.

I This representation is highly redondant, a admits ρn−1

representations.I PMNS allows efficient arithmetic over Fp and extensions of Fp,

where p is a prime number.

I In "Randomization of Arithmetic over Polynomial Modular NumberSystem" with Didier, Dosser, Marrez and Véron :

I we defined a random expression in PMNS ;I we defined a random multiplication in Fp based on PMNS.I For the description of our work pay attention to the two following

presentations by Yssouf Dosso and Jérémie Marrez ! !

Randomness and SCA Nadia El Mrabet 25 / 24

Page 36: Randomness as countermeasures against Side Channel Attacks · Randomness as countermeasures against Side Channel Attacks NadiaElMrabet nadia.el-mrabet@emse.fr Mines St Etienne WRACH’2019,April17,2019

Side channel attacksPhysical counter measures

Algorithmic counter measuresArithmetical counter measures

Randomisation of the arithmetic

PMNS : the ultimate solution

I a ∈ Fp, a =∑n

0 aiγi for a given γ and ai ≤ ρ.

I This representation is highly redondant, a admits ρn−1

representations.I PMNS allows efficient arithmetic over Fp and extensions of Fp,

where p is a prime number.I In "Randomization of Arithmetic over Polynomial Modular Number

System" with Didier, Dosser, Marrez and Véron :I we defined a random expression in PMNS ;I we defined a random multiplication in Fp based on PMNS.I For the description of our work pay attention to the two following

presentations by Yssouf Dosso and Jérémie Marrez ! !

Randomness and SCA Nadia El Mrabet 25 / 24