Side-channel analysis of six SHA-3 candidates in HMAC scheme - - PowerPoint PPT Presentation

side channel analysis of six sha 3 candidates in hmac
SMART_READER_LITE
LIVE PREVIEW

Side-channel analysis of six SHA-3 candidates in HMAC scheme - - PowerPoint PPT Presentation

Background Correlation Analysis Results Conclusion Side-channel analysis of six SHA-3 candidates in HMAC scheme Olivier Beno t and Thomas Peyrin CHES 2010 Workshop Santa Barbara - August 18, 2010 Background Correlation Analysis


slide-1
SLIDE 1

Background Correlation Analysis Results Conclusion

Side-channel analysis of six SHA-3 candidates in HMAC scheme

Olivier Benoˆ ıt and Thomas Peyrin

CHES 2010 Workshop

Santa Barbara - August 18, 2010

slide-2
SLIDE 2

Background Correlation Analysis Results Conclusion

Outline

Background Correlation Analysis Theory Practice Results AES-bases candidates Others Candidates Conclusion

slide-3
SLIDE 3

Background Correlation Analysis Results Conclusion

Outline

Background Correlation Analysis Theory Practice Results AES-bases candidates Others Candidates Conclusion

slide-4
SLIDE 4

Background Correlation Analysis Results Conclusion

Introduction

  • NIST launched the SHA-3 competition in order to replace

the collision-broken SHA-1 function

  • 14 candidates are still in the race, the winner will be

determined in 2012

  • it makes sense to consider side-channel attack on these

SHA-3 candidates in the HMAC scheme

  • Retrieving the key would lead to the ability to forge correct

MAC

  • We will therefore analyse a panel of six candidates deemed

representative

ECHO Grøstl SHAvite-3 HAMSI BLAKE CubeHash

slide-5
SLIDE 5

Background Correlation Analysis Results Conclusion

Prior works

  • DPA on n-bit sized boolean and arithmetic operations and its

application to IDEA, RC6, and HMAC construction (CHES 2005), Lemke et al.

  • Side channel attacks against HMAC based on block-cipher

based hash functions (ACISP 2006), Okeya et al.

  • DPA of HMAC based on SHA-2, and countermeasures

(WISA2007), McEvoy et al.

  • An update on the side channel cyrptanalysis of MAC based on

crytopgaphic hash functions (INDOCRYPT 2007), Gauravaram et al.

  • Practical Electromagnetic Template Attack on HMAC

(CHES 2009), Fouque et al.

slide-6
SLIDE 6

Background Correlation Analysis Results Conclusion

HMAC

HMAC(K, M) = H((K ⊕ opad)||H((K ⊕ ipad)||M))

CVin h K ⊕ ipad CVin

1

h M1 h Mk Hin CVout h K ⊕ opad CVout

1

h Hout

  • The possible targets of a side-channel analysis attack are:

K, CVin

1 and CVout 1

slide-7
SLIDE 7

Background Correlation Analysis Results Conclusion

Outline

Background Correlation Analysis Theory Practice Results AES-bases candidates Others Candidates Conclusion

slide-8
SLIDE 8

Background Correlation Analysis Results Conclusion

Correlation

  • A selection function is defined as w = f(cv, m)
  • The theoretical correlation between a data set xi for a key

guess j and the data set yi for an arbitrary real key r is: c(j, r) = (xi − x)(yi − y) (xi − x)2. (yi − y)2

  • Assumming a leakage in the Hamming Weight model:

xi = HW(f(j, mi)) and yi = HW(f(r, mi))

  • Given a selection function, it is possible to compute c(j, r)

for all key guess and look a the correlation contrast between the real key and the wrong keys

slide-9
SLIDE 9

Background Correlation Analysis Results Conclusion

SHA-3 Selection functions

The typical selection functions that will be found in SHA-3 candidates are:

  • AES sbox (256 → 256 substitution):

w = SBOXAES(cv ⊕ m)

  • Modular addition:

w = (cv ⊞ m)mod256

  • Exclusive OR logic operation:

w = cv ⊕ m

  • HAMSI sbox ( 16 → 16 substitution):

w = SBOXHAMSI(cvi+1||mi+1||cvi||mi)

slide-10
SLIDE 10

Background Correlation Analysis Results Conclusion

SHA-3 Selection functions

The typical selection functions that will be found in SHA-3 candidates are:

  • AES sbox (256 → 256 substitution):

w = SBOXAES(cv ⊕ m)

  • Modular addition:

w = (cv ⊞ m)mod256

  • Exclusive OR logic operation:

w = cv ⊕ m

  • HAMSI sbox ( 16 → 16 substitution):

w = SBOXHAMSI(cvi+1||mi+1||cvi||mi)

slide-11
SLIDE 11

Background Correlation Analysis Results Conclusion

SHA-3 Selection functions

The typical selection functions that will be found in SHA-3 candidates are:

  • AES sbox (256 → 256 substitution):

w = SBOXAES(cv ⊕ m)

  • Modular addition:

w = (cv ⊞ m)mod256

  • Exclusive OR logic operation:

w = cv ⊕ m

  • HAMSI sbox ( 16 → 16 substitution):

w = SBOXHAMSI(cvi+1||mi+1||cvi||mi)

slide-12
SLIDE 12

Background Correlation Analysis Results Conclusion

SHA-3 Selection functions

The typical selection functions that will be found in SHA-3 candidates are:

  • AES sbox (256 → 256 substitution):

w = SBOXAES(cv ⊕ m)

  • Modular addition:

w = (cv ⊞ m)mod256

  • Exclusive OR logic operation:

w = cv ⊕ m

  • HAMSI sbox ( 16 → 16 substitution):

w = SBOXHAMSI(cvi+1||mi+1||cvi||mi)

slide-13
SLIDE 13

Background Correlation Analysis Results Conclusion

Selection function efficiency, r = 8

j

correlation (AES Sbox) 1

j

correlation (modular addition) 1 −0.5

j

correlation (XOR) 1 −1

slide-14
SLIDE 14

Background Correlation Analysis Results Conclusion

Selection function efficiency

  • Results for the HAMSI sbox selection function:

real and guess key j = 0 j = 1 j = 2 j = 3 r = 0 +1.00 −0.17 −0.56 −0.87 r = 1 −0.17 +1.00 +0.87 −0.09 r = 2 −0.56 +0.87 +1.00 +0.17 r = 3 −0.87 −0.09 +0.17 +1.00

slide-15
SLIDE 15

Background Correlation Analysis Results Conclusion

Correlation Contrast

  • The correlation contrast is computed from the highest

correlation for a wrong guess (cw) selection AES modular HAMSI XOR function Sbox addition Sbox cw 0.23 0.75 0.87 −1 cc 3.34 0.33 0.15 cc = 1−|cw|

|cw|

  • The selection function efficiency E is linked to the

correlation contrast E(AES Sbox) > E(modular addition) > E(HAMSI Sbox) > E(XOR)

slide-16
SLIDE 16

Background Correlation Analysis Results Conclusion

Correlation Contrast

  • The correlation contrast is computed from the highest

correlation for a wrong guess (cw) selection AES modular HAMSI XOR function Sbox addition Sbox cw 0.23 0.75 0.87 −1 cc 3.34 0.33 0.15 cc = 1−|cw|

|cw|

  • The selection function efficiency E is linked to the

correlation contrast E(AES Sbox) > E(modular addition) > E(HAMSI Sbox) > E(XOR)

slide-17
SLIDE 17

Background Correlation Analysis Results Conclusion

Measurement platform

  • Xilinx Spartan FPGA
  • Software selection

function running on a TSK3000 RISC CPU

  • 5 GS/s sampling

frequency

  • Homemade EMA sensor
  • 30db Amplifier (1GHz

BdW)

  • 100.000 curves
  • 10 curves per message
slide-18
SLIDE 18

Background Correlation Analysis Results Conclusion

Selection functions implementation

slide-19
SLIDE 19

Background Correlation Analysis Results Conclusion

CEMA results: correlation curves for correct and wrong guess

slide-20
SLIDE 20

Background Correlation Analysis Results Conclusion

CEMA results (5 best guess for each target byte)

slide-21
SLIDE 21

Background Correlation Analysis Results Conclusion

CEMA results versus number of curves

slide-22
SLIDE 22

Background Correlation Analysis Results Conclusion

Outline

Background Correlation Analysis Theory Practice Results AES-bases candidates Others Candidates Conclusion

slide-23
SLIDE 23

Background Correlation Analysis Results Conclusion

ECHO side channel analysis

  • Internal state at the end of the first round:

wi0[b] = α · cv′

i1[b] ⊕ β · m′ i2[b] ⊕ γ · m′ i3[b] ⊕ δ · m′ i4[b]

  • Internal state in second round, after AES Sbox operation:

w′

i[b] = Sbox(wi[b] ⊕ ti[b])

  • 64 AES Sbox side-channel attacks to retrieve CV
  • For each cv′

i, four selection functions can be exploits

slide-24
SLIDE 24

Background Correlation Analysis Results Conclusion

Grøstl side channel analysis

  • Internal state after the AES Sbox operation during first

round of PG w′[b] = Sbox(m[b] ⊕ CV[b])

  • In this case, CPA is straightforward
  • 64 AES Sbox side-channel attacks to retrieve CV
  • It is possible to speed up the attack by a factor 64 by

choosing all m[b] equals

slide-25
SLIDE 25

Background Correlation Analysis Results Conclusion

SHAvite-3 side channel analysis

  • Internal state after the AES Sbox operation during first

round of ES w′[b] = Sbox(CVR[b] ⊕ m1

0[b])

  • Internal state after the AES Sbox operation during second

round of ES z′[b] = Sbox(CVL[b] ⊕ w′′[b] ⊕ m2

0[b])

  • 32 AES Sbox side-channel attacks to retrieve CV
  • In order to retrieve CVL, the right part CVR must be found

without errors

slide-26
SLIDE 26

Background Correlation Analysis Results Conclusion

BLAKE description

  • Overview: CVi+1 = final(EB

Mi(init(CVi)), CVi)

  • EB is a block cipher composed of 10 rounds, each

consisting of the application of eight 128-bit sub-functions Gi CVi

cv4 cv5 cv6 cv7 cv0 cv1 cv2 cv3

Initialisation

t4 t5 cv4 cv5 t2 t3 cv2 cv3 t6 t7 t0 t1 cv6 cv7 cv0 cv1

EB Mi Finalization CVi+1

slide-27
SLIDE 27

Background Correlation Analysis Results Conclusion

BLAKE description

  • One round of EB computes:

G0(v0, v4, v8, v12) G1(v1, v5, v9, v13) G2(v2, v6, v10, v14) G3(v3, v7, v11, v15) G4(v0, v5, v10, v15) G5(v1, v6, v11, v12) G6(v2, v7, v8, v13) G7(v3, v4, v9, v14)

  • The function Gs(a, b, c, d) processes the following steps:

a ← (a ⊞ b) ⊞ (mi ⊕ kj) d ← (d ⊕ a) ≫ 16 c ← (c ⊞ d) d ← (b ⊕ c) ≫ 12 a ← (a ⊞ b) ⊞ (mj ⊕ ki) d ← (d ⊕ a) ≫ 8 c ← (c ⊞ d) d ← (b ⊕ c) ≫ 7

slide-28
SLIDE 28

Background Correlation Analysis Results Conclusion

BLAKE side channel analysis

  • the first four execution of Gs manipulates the secret

chaining variable:

G0(cv0, cv4, t0, t4) G1(cv1, cv5, t1, t5) G2(cv2, cv6, t2, t6) G3(cv3, cv7, t3, t7)

  • The function Gs(a, b, c, d) processes the following steps:

a1 = (a0 ⊞ b0) ⊞ mk d1 = (d0 ⊕ a1) ≫ 16 c1 = c0 ⊞ d1 b1 = (b0 ⊕ c1) ≫ 12 a2 = a1 ⊞ b1 ⊞ ml

  • The two selection functions are based on the Modular

Addition operation

slide-29
SLIDE 29

Background Correlation Analysis Results Conclusion

CubeHash side channel analysis

  • Overview: CVi+1 = PC(CVi ⊕ (Mi||{0}768))

w cv1 cv2 cv3 rot 7 cv′

1

cv′

1

z x rot 11

  • Two selection functions based on the XOR operation
  • Two selection functions based on the Modular Addition
  • peration
slide-30
SLIDE 30

Background Correlation Analysis Results Conclusion

HAMSI side channel analysis

  • Generic selection function:

w = Sbox(m′

i[b] || cv′ i+2[b] || m′ i+4[b] || cv′ i+6[b])

  • r

w = Sbox(cv′

i[b] || m′ i+2[b] || cv′ i+4[b] || m′ i+6[b])

  • Two bits of CV recovered at a time with a total of 128

HAMSI Sbox side-channel attacks (4 guess each)

  • Could be enhanced by selecting multiple sbox at the same

time, but must be coherant with implementation

slide-31
SLIDE 31

Background Correlation Analysis Results Conclusion

Outline

Background Correlation Analysis Theory Practice Results AES-bases candidates Others Candidates Conclusion

slide-32
SLIDE 32

Background Correlation Analysis Results Conclusion

Results summary

Candidates Selection function Correlation analysis ECHO SBOXAES 64 analysis at byte level (x4 possibilities) Grøstl SBOXAES 64 analysis at byte level SHAvite-3 SBOXAES 16 + 16 analysis at byte level BLAKE Modular addition 32 analysis at byte level CubeHash Modular addition and XOR 64 ADD + 64 XOR analysis at byte level HAMSI SBOXHAMSI 128 analysis at 2-bit level

slide-33
SLIDE 33

Background Correlation Analysis Results Conclusion

Conclusion

  • AES-based candidates (ECHO SHAvite-3 and Grøstl )
  • Provide the same vulnerability to SCA as the AES block

cipher

  • Can take advantage of protection inherited from hardware

AES

  • ARX candidates (BLAKE and CubeHash )
  • SCA will be less efficient (especially for CubeHash and its

XOR selection function)

  • Less efficient to protect: require to constantly switch from

arithmetic to boolean masking

  • HAMSI candidate is quite exotic, a deeper study will be

required if this candidate is choosen at the end of the SHA-3 contest

slide-34
SLIDE 34

Background Correlation Analysis Results Conclusion

Conclusion

  • AES-based candidates (ECHO SHAvite-3 and Grøstl )
  • Provide the same vulnerability to SCA as the AES block

cipher

  • Can take advantage of protection inherited from hardware

AES

  • ARX candidates (BLAKE and CubeHash )
  • SCA will be less efficient (especially for CubeHash and its

XOR selection function)

  • Less efficient to protect: require to constantly switch from

arithmetic to boolean masking

  • HAMSI candidate is quite exotic, a deeper study will be

required if this candidate is choosen at the end of the SHA-3 contest

slide-35
SLIDE 35

Background Correlation Analysis Results Conclusion

Conclusion

  • AES-based candidates (ECHO SHAvite-3 and Grøstl )
  • Provide the same vulnerability to SCA as the AES block

cipher

  • Can take advantage of protection inherited from hardware

AES

  • ARX candidates (BLAKE and CubeHash )
  • SCA will be less efficient (especially for CubeHash and its

XOR selection function)

  • Less efficient to protect: require to constantly switch from

arithmetic to boolean masking

  • HAMSI candidate is quite exotic, a deeper study will be

required if this candidate is choosen at the end of the SHA-3 contest

slide-36
SLIDE 36

Background Correlation Analysis Results Conclusion

Thank you for your attention Any questions?

  • livier.benoit@ingenico.com

thomas.peyrin@ingenico.com