A Side-Channel Assisted Cryptanalytic Attack Against QcBits Mlissa - - PowerPoint PPT Presentation

a side channel assisted cryptanalytic attack against
SMART_READER_LITE
LIVE PREVIEW

A Side-Channel Assisted Cryptanalytic Attack Against QcBits Mlissa - - PowerPoint PPT Presentation

A Side-Channel Assisted Cryptanalytic Attack Against QcBits Mlissa Rossi Mike Hamburg Michael Hutter Mark E. Marson Possible path for post-quantum security Error-correcting codes Quantum computers may threaten the mathematical


slide-1
SLIDE 1

A Side-Channel Assisted Cryptanalytic Attack Against QcBits

Mélissa Rossi · Mike Hamburg · Michael Hutter · Mark E. Marson

slide-2
SLIDE 2

Post-Quantum Cryptography

Quantum computers may threaten the mathematical problems on which public key algorithms are currently based. ⇒ Call for the standardization and transition to post-quantum public key algorithms in the near future ∙ National Institute of Standards and Technology (NIST) ∙ European Initiative PQCRYPTO and SAFECRYPTO

Possible path for post-quantum security

∙ Error-correcting codes

1 / 29

slide-3
SLIDE 3

Post-Quantum Cryptography

Quantum computers may threaten the mathematical problems on which public key algorithms are currently based. ⇒ Call for the standardization and transition to post-quantum public key algorithms in the near future ∙ National Institute of Standards and Technology (NIST) ∙ European Initiative PQCRYPTO and SAFECRYPTO

Possible path for post-quantum security

∙ Error-correcting codes

1 / 29

slide-4
SLIDE 4

Linear Codes for Telecommunications

A binary linear code is a linear subspace of Fn

2

Data Linear expansion

Codeword Noisy channel Noisy Codeword Data Decoding

2 / 29

slide-5
SLIDE 5

Linear Codes for Telecommunications

A binary linear code is a linear subspace of Fn

2

Data Linear expansion

Codeword

Noisy channel

Noisy Codeword Data Decoding

2 / 29

slide-6
SLIDE 6

Linear Codes for Telecommunications

A binary linear code is a linear subspace of Fn

2

Data Linear expansion

Codeword

Noisy channel

Noisy Codeword

Data Decoding

2 / 29

slide-7
SLIDE 7

Linear Codes for Public Key Cryptography : Mc Eliece

Public key : a way to create a codeword Secret key : a way to remove the errors

Public Key ! Secret Key

Plaintext Ciphertext Encryption using public key Removing the errors is hard Plaintext Decoding with the secret key

3 / 29

slide-8
SLIDE 8

Linear Codes for Public Key Cryptography : Mc Eliece

Public key : a way to create a codeword Secret key : a way to remove the errors

Public Key Secret Key

Plaintext Linear expansion

Codeword Intentionally add random errors Ciphertext Encryption using public key Removing the errors is hard Plaintext Decoding with the secret key

3 / 29

slide-9
SLIDE 9

Linear Codes for Public Key Cryptography : Mc Eliece

Public key : a way to create a codeword Secret key : a way to remove the errors

Public Key Secret Key

Plaintext Linear expansion

Codeword

Intentionally add random errors

Ciphertext Encryption using public key Removing the errors is hard Plaintext Decoding with the secret key

3 / 29

slide-10
SLIDE 10

Linear Codes for Public Key Cryptography : Mc Eliece

Public key : a way to create a codeword Secret key : a way to remove the errors

Public Key Secret Key

Plaintext Linear expansion

Codeword

Intentionally add random errors

Ciphertext

❍❍❍❍❍❍❍❍❍❍❍❍❍❍ ❍ ❥

Encryption using public key Removing the errors is hard Plaintext Decoding with the secret key

3 / 29

slide-11
SLIDE 11

Linear Codes for Public Key Cryptography : Mc Eliece

Public key : a way to create a codeword Secret key : a way to remove the errors

Public Key Secret Key

Plaintext Ciphertext

❍❍❍❍❍❍❍❍❍❍❍❍❍❍ ❍ ❥

Encryption using public key Removing the errors is hard Plaintext Decoding with the secret key

3 / 29

slide-12
SLIDE 12

Linear Codes for Public Key Cryptography : Mc Eliece

Public key : a way to create a codeword Secret key : a way to remove the errors

Public Key Secret Key

Plaintext Ciphertext

❍❍❍❍❍❍❍❍❍❍❍❍❍❍ ❍ ❥

Encryption using public key Removing the errors is hard Plaintext Decoding with the secret key

3 / 29

slide-13
SLIDE 13

Mc Eliece

Several possibilities for choosing an appropriate code structure

Family of codes Proposed by Attacked by Binary Goppa

  • riginal proposition (78)

Reed Solomon Niederreiter (86) Sidelnikov et al (92) Concatenated Niederreiter (86) Sendrier (98) Reed Muller Sidelnikov (94) Minder et al (07) Algebraic Geometric Janwa et al(96) Faure et al (08) Couvreur et al (14) LDPC Monico et al (00) Monico et al (00) Convolutional Londahl et al (12) Landais et al (13) Wild Goppa Bernstein et al (10) Couvreur et al (14) Faugère et al (14) QC MDPC Misoczki et al (13)

4 / 29

slide-14
SLIDE 14

Mc Eliece

Several possibilities for choosing an appropriate code structure

Family of codes Proposed by Attacked by Binary Goppa

  • riginal proposition (78)

Reed Solomon Niederreiter (86) Sidelnikov et al (92) Concatenated Niederreiter (86) Sendrier (98) Reed Muller Sidelnikov (94) Minder et al (07) Algebraic Geometric Janwa et al(96) Faure et al (08) Couvreur et al (14) LDPC Monico et al (00) Monico et al (00) Convolutional Londahl et al (12) Landais et al (13) Wild Goppa Bernstein et al (10) Couvreur et al (14) Faugère et al (14) QC MDPC Misoczki et al (13)

4 / 29

slide-15
SLIDE 15

description of qcbits algorithm

slide-16
SLIDE 16

QcBits : A QC MDPC McEliece implementation

Public Key Secret Key

Plaintext Ciphertext

❍❍❍❍❍❍❍❍❍❍❍❍❍❍ ❍ ❥

Encryption using public key Plaintext Decoding with the secret key

Tung Chou, QcBits: Constant-Time Small-Key Code-Based Cryptography CHES 2016 ∙ Very fast ∙ Small key sizes ∙ Protected against one type of side channel attacks : timing attacks ∙ 2 sets of parameters : 80 bits and 128 bits security

6 / 29

slide-17
SLIDE 17

QcBits : A QC MDPC McEliece implementation

Size (r) Hamming weight(w) Bits of Security 4801 90 80 9857 142 128 Secret key : a QC MDPC matrix H Public key : a matrix P

H = (H0, H1)

7 / 29

slide-18
SLIDE 18

QcBits : A QC MDPC McEliece implementation

Size (r) Hamming weight(w) Bits of Security 4801 90 80 9857 142 128 Secret key : a QC MDPC matrix H Public key : a matrix P

H = (H0, H1)

H =                 1 1 1 1 1 1 1 1 1 1 1 1                 1 1 1 1 1 1 1 1 1 1 1 1                

7 / 29

slide-19
SLIDE 19

QcBits : A QC MDPC McEliece implementation

Size (r) Hamming weight(w) Bits of Security 4801 90 80 9857 142 128 Secret key : a QC MDPC matrix H Public key : a matrix P

H = (H0, H1)

H =                 1 1 1 1 1 1 1 1 1 1 1 1                 1 1 1 1 1 1 1 1 1 1 1 1                 Quasi Cyclic Moderate Density Parity Check means : ∙ H0 and H1 ∈ Fr·r

2

are circulant ∙ H0 and H1 have sparse rows : only w

2 ones

∙ The codewords x are all the vectors in the right nullspace of H ie H · xT = 0

7 / 29

slide-20
SLIDE 20

QcBits : A QC MDPC McEliece implementation

Size (r) Hamming weight(w) Bits of Security 4801 90 80 9857 142 128 Secret key : a QC MDPC matrix H Public key : a matrix P

H = (H0, H1) P = H−1

1 H0

P is circulant too P is dense

7 / 29

slide-21
SLIDE 21

QcBits : Our attacker model

P H Secret key : a QC MDPC matrix H = (H0, H1) Public key : a matrix P = H−1

1 H0

∙ We want to know the secret key H ∙ We know the public key P ∙ We know some ciphertexts previously sent ∙ We have access to the power traces

8 / 29

slide-22
SLIDE 22

QcBits : A QC MDPC McEliece implementation

Secret key : a QC MDPC matrix H = (H0, H1) Public key : a matrix P = H−1

1 H0

P H Plaintext Ciphertext

❍❍❍❍❍❍❍❍❍❍❍❍❍❍ ❍ ❥

Encryption using public key P Plaintext Decoding with the secret key H

9 / 29

slide-23
SLIDE 23

QcBits : A QC MDPC McEliece implementation

Secret key : a QC MDPC matrix H = (H0, H1) Public key : a matrix P = H−1

1 H0

P H Plaintext Ciphertext

❍❍❍❍❍❍❍❍❍❍❍❍❍❍ ❍ ❥

Encryption using public key P Plaintext Decoding with the secret key H

9 / 29

slide-24
SLIDE 24

Bit Flipping

Bit Flipping

Algorithm 1: Bit Flipping

Data: H ∈ Fr·n

2 , x ∈ Fn 2

Result: Corrected codeword v

1 v ← x ; 2 S ← H · vT // Syndrome computation 3 ... 4 Computation of the error e 5 ... 6 Return the codeword v = x ⊕ e 10 / 29

slide-25
SLIDE 25

Our contribution

∙ New classical key recovery attack

  • 1. Differential Power Analysis (DPA)
  • 2. Mathematical key recovery

H = (H0, H1)

11 / 29

slide-26
SLIDE 26

Our contribution

∙ New classical key recovery attack

  • 1. Differential Power Analysis (DPA)
  • 2. Mathematical key recovery

H =         ∗ · · · ∗ . . . . . . ∗ · · · ∗         ∗ · · · ∗ . . . . . . ∗ · · · ∗        

11 / 29

slide-27
SLIDE 27

Our contribution

∙ New classical key recovery attack

  • 1. Differential Power Analysis (DPA)
  • 2. Mathematical key recovery

H =             ∗ ∗ ∗ ∗ ∗ · · · ∗ . . . . . . ∗ · · · ∗           ∗ · · · ∗ . . . . . . ∗ · · · ∗          

11 / 29

slide-28
SLIDE 28

Our contribution

∙ New classical key recovery attack

  • 1. Differential Power Analysis (DPA)
  • 2. Mathematical key recovery

H =                 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗             ∗ · · · ∗ . . . . . . ∗ · · · ∗            

11 / 29

slide-29
SLIDE 29

Our contribution

∙ New classical key recovery attack

  • 1. Differential Power Analysis (DPA)
  • 2. Mathematical key recovery

H =                 1 1 1 1 1 1 1 1 1 1 1 1             ∗ · · · ∗ . . . . . . ∗ · · · ∗            

11 / 29

slide-30
SLIDE 30

Our contribution

∙ New classical key recovery attack

  • 1. Differential Power Analysis (DPA)
  • 2. Mathematical key recovery

H =                 1 1 1 1 1 1 1 1 1 1 1 1                 1 1 1 1 1 1 1 1 1 1 1 1                

11 / 29

slide-31
SLIDE 31

Our contribution

∙ New classical key recovery attack

  • 1. Differential Power Analysis (DPA)
  • 2. Mathematical key recovery

∙ Our countermeasure

11 / 29

slide-32
SLIDE 32

differential power analysis

slide-33
SLIDE 33

Target of the DPA attack

Syndrome calculation inside the Bit Flipping H · (cT ) = (H0, H1) · (cT ) = H0 · cT H0 is a sparse circulant matrix. H0 is uniquely defined by {x0, ..., x44}, the unknown indices of the nonzero elements

  • f its first row.

Recovering the {x0, ..., x44} means recovering the whole matrix H0. H0 = x0 x1 ↓ ↓         1 1 1 1 1 1 1 1 1 1 1 1         } h0

13 / 29

slide-34
SLIDE 34

Target of the DPA attack

H0 ·c

T

During the multiplication, H0 is decomposed as a sum of 45 rotation matrices H0 =         1 1 1 1 1 1         +         1 1 1 1 1 1        

13 / 29

slide-35
SLIDE 35

Target of the DPA attack

H0 ·c

T

The multiplication algorithm runs through all the rotations composing H0 and computes the intermediate rotated ciphertexts rxi(c)T H0 · cT =         1 1 1 1 1 1         · cT +         1 1 1 1 1 1         · cT H0 · cT = rx0(c)T + rx1(c)T The final value of the multiplication is the xor of all the rxi(c)T

13 / 29

slide-36
SLIDE 36

Measurement Setup

ChipWhisperer Lite ∙ Original code ∙ Programmable chip (Atmel AVR XMEGA128) ∙ Easy to use : On-board power-measurement circuit ∙ Easily reproducible

14 / 29

slide-37
SLIDE 37

Target of the DPA attack

Target : The storing into local memory of each rxi(c)T

Power trace of a rotation computation

Samples [#105] 50 100 150 200 250 300 350 400 450 500 Power consumption

  • 0.1

0.1 0.2 Storage

Zoom on the storage

15 / 29

slide-38
SLIDE 38

Target of the DPA attack

Target : The storing into local memory of each rxi(c)T

Power trace of a rotation computation

Samples [#105] 50 100 150 200 250 300 350 400 450 500 Power consumption

  • 0.1

0.1 0.2 Storage

Zoom on the storage

Samples 20 40 60 80 100 120 140 160 180 Power consumption

  • 10
  • 5

5

15 / 29

slide-39
SLIDE 39

Target of the DPA attack

Target : The storing into local memory of each rxi(c)T

Power trace of a rotation computation

Samples [#105] 50 100 150 200 250 300 350 400 450 500 Power consumption

  • 0.1

0.1 0.2 Storage

Zoom on the storage

Samples 20 40 60 80 100 120 140 160 180 Power consumption

  • 10
  • 5

5

5 6 7 4 3 2 1

15 / 29

slide-40
SLIDE 40

DPA Results

Maximum Difference of Means (DoM) using 500 traces over all possible values. Significant difference is observed around the correct index xi = 2000.

Indices x 500 1000 1500 2000 2500 3000 3500 4000 4500 Difference of Means 0.2 0.4 0.6 0.8

The peak always starts on a multiple of 64.

16 / 29

slide-41
SLIDE 41

DPA Results

Maximum Difference of Means (DoM) using 500 traces over all possible values. Significant difference is observed around the correct index xi = 2000.

Indices x 500 1000 1500 2000 2500 3000 3500 4000 4500 Difference of Means 0.2 0.4 0.6 0.8

The peak always starts on a multiple of 64.

16 / 29

slide-42
SLIDE 42

DPA Results

Let’s look at the leak in time.

20 40 60 80 100 120 140 160 180 Difference of Means

  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2 Samples 20 40 60 80 100 120 140 160 180 Difference of Means

  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2

7 6

17 / 29

slide-43
SLIDE 43

DPA Results

Leakage model 1

yi = ⌊ (xi−1) mod r

64

⌋ · 64 + 1

Leakage model 2

qi = 7 − ⌊ (xi−1) mod 64

8

18 / 29

slide-44
SLIDE 44

DPA Results

If we combine leakage models 1 and 2 → only 8 possible values for xi

xi ∈ Zi = [yi + 8(7 − qi), yi + 8(7 − qi) + 7]

In our example, we measured (yi, qi) = (1985, 6) and therefore deduce that Zi = [1993, 2000].

h0

?

8

Interval Z0 Interval Z1

...

Interval Z

1 19 / 29

slide-45
SLIDE 45

DPA Results

If we combine leakage models 1 and 2 → only 8 possible values for xi

xi ∈ Zi = [yi + 8(7 − qi), yi + 8(7 − qi) + 7]

In our example, we measured (yi, qi) = (1985, 6) and therefore deduce that Zi = [1993, 2000].

h0

?

✲ ✛ 8

Interval Z0 Interval Z1

...

Interval Zβ−1

19 / 29

slide-46
SLIDE 46

Knowledge of H0 after DPA attack

α ← length of index search intervals Zi. β ← total number of unique search intervals Zi.

h0

?

✲ ✛ α

Interval Z0 Interval Z1

...

Interval Zβ−1 α represents DPA attack accuracy

20 / 29

slide-47
SLIDE 47

key recovery

slide-48
SLIDE 48

Setting up a system of noisy binary linear equations

Recall that the public key is P = H−1

1

· H0.

Setting Q = P−T we rearrange and write

Q · hT

0 = hT 1

where ∙ Q is dense and known ∙ h0 (the first row of H0) is sparse and partially known ∙ h1 (the first row of H1) is sparse and unknown. STEP 1 : Remove columns of Q hT

Z 1 Z1 Z0 Z2

hT

1

Q h T hT

1

Q

Z0 Z1 . . . Z 1

22 / 29

slide-49
SLIDE 49

Setting up a system of noisy binary linear equations

Recall that the public key is P = H−1

1

· H0.

Setting Q = P−T we rearrange and write

Q · hT

0 = hT 1

STEP 1 : Remove columns of Q

=

hT

Zβ−1 Z1 Z0 Z2

hT

1

Q h T hT

1

Q

Z0 Z1 . . . Z 1

22 / 29

slide-50
SLIDE 50

Setting up a system of noisy binary linear equations

Recall that the public key is P = H−1

1

· H0.

Setting Q = P−T we rearrange and write

Q · hT

0 = hT 1

STEP 1 : Remove columns of Q

=

hT

Zβ−1 Z1 Z0 Z2

hT

1

Q

h′ T hT

1

Q′

Z0 Z1 . . . Zβ−1

=

22 / 29

slide-51
SLIDE 51

Setting up a system of noisy binary linear equations

STEP 2 : Add parity equations DPA → number of nonzero values of each interval Zi of h0 h′ T hT

1

Q′

Z0 Z1 . . . Zβ−1

=

bT h T hT

1

Q W

Z0 Z1 . . . Z 1

23 / 29

slide-52
SLIDE 52

Setting up a system of noisy binary linear equations

STEP 2 : Add parity equations DPA → number of nonzero values of each interval Zi of h0 h′ T hT

1

Q′

Z0 Z1 . . . Zβ−1

=

=

bT h′ T hT

1

Q′ W

Z0 Z1 . . . Zβ−1

23 / 29

slide-53
SLIDE 53

Setting up a system of noisy binary linear equations

STEP 2 : Guess some zeros of h1 h1 is an extremely sparse vector. Its entries are zero with probability 1 − w

2r > 0.99

bT h T hT

1

Q W

Z0 Z1 . . . Z 1 with prob. p

bT h T Q W

Z0 Z1 . . . Z 1

24 / 29

slide-54
SLIDE 54

Setting up a system of noisy binary linear equations

STEP 2 : Guess some zeros of h1 We create a square system of equations by randomly selecting entries from h1, and keeping the corresponding rows of Q′.

=

bT h′ T hT

1

Q′ W

Z0 Z1 . . . Zβ−1 with prob. p

bT h T Q W

Z0 Z1 . . . Z 1

24 / 29

slide-55
SLIDE 55

Setting up a system of noisy binary linear equations

STEP 2 : Guess some zeros of h1

=

bT h′ T hT

1

Q′ W

Z0 Z1 . . . Zβ−1

=

with prob. p

bT h′ T Q′′ W

Z0 Z1 . . . Zβ−1

24 / 29

slide-56
SLIDE 56

Complexity

Average number of attempts (= 1

p ) before getting a correct system

DPA accuracy (α) 8 16 32 64 80-bit 22 950 223 258 128-bit 40 3500 226 264 Total complexity in terms of multiplications in

2

1 p w 2 2 8

r w Bits of Security 4801 90 80 9857 142 128

In our device ( 8), we have 80-bit 128-bit Complexity 228 231

25 / 29

slide-57
SLIDE 57

Complexity

Average number of attempts (= 1

p ) before getting a correct system

DPA accuracy (α) 8 16 32 64 80-bit 22 950 223 258 128-bit 40 3500 226 264 Total complexity in terms of multiplications in F2 1 p · ( wα 2 )2.8

r w Bits of Security 4801 90 80 9857 142 128

In our device ( 8), we have 80-bit 128-bit Complexity 228 231

25 / 29

slide-58
SLIDE 58

Complexity

Average number of attempts (= 1

p ) before getting a correct system

DPA accuracy (α) 8 16 32 64 80-bit 22 950 223 258 128-bit 40 3500 226 264 Total complexity in terms of multiplications in F2 1 p · ( wα 2 )2.8

r w Bits of Security 4801 90 80 9857 142 128

In our device (α = 8), we have 80-bit 128-bit Complexity 228 231

25 / 29

slide-59
SLIDE 59

Experimental results

SAGE on one core of a 2.9GHz Core i5 MacBook Pro 1 DPA accuracy (α) 8 16 32 64 80-bit 0.4 sec 15 sec 16 hours ≥ 600 years 128-bit 2 sec 4 min 7 days ≥ 800,000 years

1https://github.com/CryptoMelissa/QcBit/blob/master/attack.sagews

26 / 29

slide-60
SLIDE 60

Experimental results

SAGE on one core of a 2.9GHz Core i5 MacBook Pro 1 DPA accuracy (α) 8 16 32 64 80-bit 0.4 sec 15 sec 16 hours ≥ 600 years 128-bit 2 sec 4 min 7 days ≥ 800,000 years

1https://github.com/CryptoMelissa/QcBit/blob/master/attack.sagews

26 / 29

slide-61
SLIDE 61

Experimental results

SAGE on one core of a 2.9GHz Core i5 MacBook Pro 1 DPA accuracy (α) 8 16 32 64 80-bit 0.4 sec 15 sec 16 hours ≥ 600 years 128-bit 2 sec 4 min 7 days ≥ 800,000 years

1https://github.com/CryptoMelissa/QcBit/blob/master/attack.sagews

26 / 29

slide-62
SLIDE 62

countermeasure

slide-63
SLIDE 63

Simple Masking Countermeasure

→ Let’s mask the corrupted codeword (c | 0) by XORing it with a random codeword cm H · ( (c|0) ⊕ cm )T = H · (c | 0)T ⊕ H · cmT = H · (c | 0)T

Indices x 500 1000 1500 2000 2500 3000 3500 4000 4500 Difference of Means 0.2 0.4 0.6 0.8

Maximum of the Difference Of Means with the countermeasure enabled (500 traces)

28 / 29

slide-64
SLIDE 64

Final Analysis of QcBits

QcBits

Advantages Drawbacks ∙ Post Quantum candidate ∙ Small key sizes ∙ Very efficient ∙ Quite easy to protect against DPA ∙ Sparseness of the secret keys can be a weakness ∙ Non negligible failure rate ⇒ Attack in the non ephemeral case Guo et al (Asiacrypt 2016) Thank you for your attention !

29 / 29

slide-65
SLIDE 65

Final Analysis of QcBits

QcBits

Advantages Drawbacks ∙ Post Quantum candidate ∙ Small key sizes ∙ Very efficient ∙ Quite easy to protect against DPA ∙ Sparseness of the secret keys can be a weakness ∙ Non negligible failure rate ⇒ Attack in the non ephemeral case Guo et al (Asiacrypt 2016) Thank you for your attention !

29 / 29

slide-66
SLIDE 66