Permutation-based cryptography for the Internet of Things Gilles Van - - PowerPoint PPT Presentation

permutation based cryptography for the internet of things
SMART_READER_LITE
LIVE PREVIEW

Permutation-based cryptography for the Internet of Things Gilles Van - - PowerPoint PPT Presentation

Permutation-based cryptography for the Internet of Things Gilles Van Assche 1 1 STMicroelectronics 2 Radboud University RIOT Summit 2017 Berlin, September 25-26, 2017 1 / 56 Joint work with Guido Bertoni, Joan Daemen 1 , 2 , Seth Hoffert,


slide-1
SLIDE 1

Permutation-based cryptography for the Internet of Things

Gilles Van Assche1 Joint work with Guido Bertoni, Joan Daemen1,2, Seth Hoffert, Michaël Peeters1 and Ronny Van Keer1

1STMicroelectronics 2Radboud University

RIOT Summit 2017 Berlin, September 25-26, 2017

1 / 56

slide-2
SLIDE 2

Outline

1

Parameters for the IoT

2

Permutations!

3

Keyed applications

4

Strobe

5

Ketje and Keyak

6

Kravatte and the Farfalle construction

2 / 56

slide-3
SLIDE 3

Parameters for the IoT

Outline

1

Parameters for the IoT

2

Permutations!

3

Keyed applications

4

Strobe

5

Ketje and Keyak

6

Kravatte and the Farfalle construction

3 / 56

slide-4
SLIDE 4

Parameters for the IoT

On the cost of cryptography for the IoT

code size memory usage execution time effjciency on the high-end server? protections against side-channel attacks?

4 / 56

slide-5
SLIDE 5

Parameters for the IoT

On the cost of cryptography for the IoT

code size memory usage execution time effjciency on the high-end server? protections against side-channel attacks?

4 / 56

slide-6
SLIDE 6

Parameters for the IoT

On the cost of cryptography for the IoT

code size memory usage execution time effjciency on the high-end server? protections against side-channel attacks?

4 / 56

slide-7
SLIDE 7

Parameters for the IoT

What are side-channel attacks?

Leakage from the device

Time, electrical consumption, EM radiation simple power analysis (SPA) vs differential power analysis (DPA)

Picture by oskay on Flickr 5 / 56

slide-8
SLIDE 8

Parameters for the IoT

What are side-channel attacks?

Inducing faults in the device

Glitch, laser pulse

Picture by ViaMoi on Flickr 6 / 56

slide-9
SLIDE 9

Parameters for the IoT

Usage and ownership

Actors: Key owner Device owner Actual user Usually, these are the same person, but…

7 / 56

slide-10
SLIDE 10

Parameters for the IoT

Usage and ownership

When key owner ̸= device owner Banking card DRM But hopefully the same person in open-source contexts!

8 / 56

slide-11
SLIDE 11

Parameters for the IoT

Usage and ownership

When key/device owner ̸= actual user Not always controlling the device

E.g., devices spread over a large area E.g., on-site personnel E.g., lost device

Distant eavesdropping Protections against SCA can be needed.

9 / 56

slide-12
SLIDE 12

Permutations!

Outline

1

Parameters for the IoT

2

Permutations!

3

Keyed applications

4

Strobe

5

Ketje and Keyak

6

Kravatte and the Farfalle construction

10 / 56

slide-13
SLIDE 13

Permutations!

Symmetric crypto: what textbooks and intro’s say

Symmetric cryptographic primitives: Block ciphers Stream ciphers Hash functions And their modes-of-use

Picture by GlasgowAmateur 11 / 56

slide-14
SLIDE 14

Permutations!

Examples of permutations

In Salsa, Chacha, Grindhal… In SHA-3 candidates: CubeHash, Grøstl, JH, MD6, … In CAESAR candidates: Ascon, Icepole, Norx, π-cipher, Primates, Stribob, … And of course in Keccak

12 / 56

slide-15
SLIDE 15

Permutations!

The sponge construction

input

  • utput
  • uter

inner r c f f f f f f absorbing squeezing

Calls a permutation f The capacity c determines the generic security:

Hashing: 2c/2 Authentication, encryption: 2c−ϵ

13 / 56

slide-16
SLIDE 16

Permutations!

Keccak-f

The seven permutation army:

25, 50, 100, 200, 400, 800, 1600 bits toy, lightweight, fastest standardized in [FIPS 202]

Repetition of a simple round function

that operates on a 3D state (5 × 5) lanes up to 64-bit each

14 / 56

slide-17
SLIDE 17

Permutations!

Keccak-f in pseudo-code

KECCAK-F[b](A) { forall i in 0…nr-1 A = Round[b](A, RC[i]) return A } Round[b](A,RC) { θ step C[x] = A[x,0] xor A[x,1] xor A[x,2] xor A[x,3] xor A[x,4], forall x in 0…4 D[x] = C[x-1] xor rot(C[x+1],1), forall x in 0…4 A[x,y] = A[x,y] xor D[x], forall (x,y) in (0…4,0…4) ρ and π steps B[y,2*x+3*y] = rot(A[x,y], r[x,y]), forall (x,y) in (0…4,0…4) χ step A[x,y] = B[x,y] xor ((not B[x+1,y]) and B[x+2,y]), forall (x,y) in (0…4,0…4) ι step A[0,0] = A[0,0] xor RC return A }

https://keccak.team/keccak_specs_summary.html

15 / 56

slide-18
SLIDE 18

Permutations!

Bit interleaving = +

ROT64 ↔ 2 × ROT32

16 / 56

slide-19
SLIDE 19

Permutations!

The unbearable lightness of permutations

Example: hashing with target security strength 2c/2

Davies-Meyer block cipher based hash

chaining value (block size): n ≥ c input block size (“key” length): typically k ≥ n feedforward (block size): n ⇒ total state ≥ 3c

Sponge

permutation width: c + r r can be made arbitrarily small, e.g., 1 byte ⇒ total state ≥ c + 8

17 / 56

slide-20
SLIDE 20

Permutations!

Cost of primitives and modes together

[Yalla, Homsirikamol, Kaps, DIAC 2014]

18 / 56

slide-21
SLIDE 21

Permutations!

Symmetric crypto: a more correct picture

Symmetric cryptographic primitives: Block ciphers Key stream generators Permutations And their modes-of-use

Picture by Sébastien Wiertz 19 / 56

slide-22
SLIDE 22

Keyed applications

Outline

1

Parameters for the IoT

2

Permutations!

3

Keyed applications

4

Strobe

5

Ketje and Keyak

6

Kravatte and the Farfalle construction

20 / 56

slide-23
SLIDE 23

Keyed applications

Use Sponge for MACing

f f Key … Padded message f f f MAC

21 / 56

slide-24
SLIDE 24

Keyed applications

Use Sponge for (stream) encryption

f f Key IV f Key stream

22 / 56

slide-25
SLIDE 25

Keyed applications

Single pass authenticated encryption

f f Key … Padded message IV f Key stream f f MAC

But this is no longer the sponge …

23 / 56

slide-26
SLIDE 26

Keyed applications

The duplex construction

Generic security provably equivalent to that of sponge Applications: authenticated encryption, reseedable pseudorandom generator …

24 / 56

slide-27
SLIDE 27

Strobe

Outline

1

Parameters for the IoT

2

Permutations!

3

Keyed applications

4

Strobe

5

Ketje and Keyak

6

Kravatte and the Farfalle construction

25 / 56

slide-28
SLIDE 28

Strobe

What is Strobe?

Layer above the duplex construction Safe and easy syntax, to achieve, e.g.,

secure channels signatures over a complete session

Very compact implementation Mechanism to prevent side-channel attacks

[Mike Hamburg — https://strobe.sourceforge.io/]

26 / 56

slide-29
SLIDE 29

Strobe

Operations and data fmow in Strobe

fjgure courtesy of Mike Hamburg 27 / 56

slide-30
SLIDE 30

Strobe

Example: key derivation

KEY(master shared key K) RATCHET derived key 1 ← PRF(16 bytes) RATCHET derived key 2 ← PRF(16 bytes)

28 / 56

slide-31
SLIDE 31

Strobe

Example: protocol

KEY(shared key K) AD[nonce](sequence number i) AD[auth-data](client IP address | server IP address) send_ENC(“GET fjle”) send_MAC(128 bits) recv_ENC(buffer) recv_MAC(128 bits)

29 / 56

slide-32
SLIDE 32

Ketje and Keyak

Outline

1

Parameters for the IoT

2

Permutations!

3

Keyed applications

4

Strobe

5

Ketje and Keyak

6

Kravatte and the Farfalle construction

30 / 56

slide-33
SLIDE 33

Ketje and Keyak

Ketje goals

Nonce-based AE function 96-bit or 128-bit security (incl. multi-target) Sessions of header-body pairs

keeping the state during the session

Small footprint Target niche: secure channel protocol on secure chips

banking card, ID, (U)SIM, secure element, FIDO, etc. secure chip has strictly incrementing counter

Using reduced-round Keccak-f[400] or Keccak-f[200], to allow

implementation re-use cryptanalysis re-use reasonable side-channel protections

31 / 56

slide-34
SLIDE 34

Ketje and Keyak

Ketje instances and lightweight features

feature Ketje Jr Ketje Sr state size 25 bytes 50 bytes block size 2 bytes 4 bytes processing computational cost initialization per session 12 rounds 12 rounds wrapping per block 1 round 1 round 8-byte tag comp. per message 9 rounds 7 rounds

32 / 56

slide-35
SLIDE 35

Ketje and Keyak

Keyak goals

Nonce-based AE function 128-bit security (incl. multi-target) Session of header-body pairs

keeping the state during the session

Optionally parallelizable Conservative safety margin Using reduced-round Keccak-f[1600] or Keccak-f[800], to allow

implementation re-use cryptanalysis re-use reasonable side-channel protections

33 / 56

slide-36
SLIDE 36

Ketje and Keyak

Keyak in a nutshell

SUV 1 T(0)

SUV = Secret and Unique Value

34 / 56

slide-37
SLIDE 37

Ketje and Keyak

Keyak in a nutshell

SUV 1 T(0) A(1) P(1) C(1) T(1)

SUV = Secret and Unique Value

34 / 56

slide-38
SLIDE 38

Ketje and Keyak

Keyak in a nutshell

SUV 1 T(0) A(1) P(1) C(1) T(1) P(2) C(2) T(2)

SUV = Secret and Unique Value

34 / 56

slide-39
SLIDE 39

Ketje and Keyak

Keyak in a nutshell

SUV 1 T(0) A(1) P(1) C(1) T(1) P(2) C(2) T(2) A(3) T(3)

SUV = Secret and Unique Value

34 / 56

slide-40
SLIDE 40

Ketje and Keyak

Leakage robustness

SUV 1 T(0) A(1) P(1) C(1) T(1) P(2) C(2) T(2) A(3) T(3)

SUV = Secret and Unique Value Provided that uniqueness is enforced then …

the secret state is a moving target [Taha, Schaumont, HOST 2014]

35 / 56

slide-41
SLIDE 41

Kravatte and the Farfalle construction

Outline

1

Parameters for the IoT

2

Permutations!

3

Keyed applications

4

Strobe

5

Ketje and Keyak

6

Kravatte and the Farfalle construction

36 / 56

slide-42
SLIDE 42

Kravatte and the Farfalle construction

The new Farfalle construction

pc

c

m0 k pc

c

m1 k … pc i

c

mi k pe

e f

z0 k′ pe

e f

z1 k′ … pe j

e

j

f

zj k′ K∥10∗ pb

i+2

c

pd

[IACR ePrint 2016/1188]

37 / 56

slide-43
SLIDE 43

Kravatte and the Farfalle construction

Kravatte for many purposes

Kravatte = Farfalle + Keccak-p[1600] Kravatte-PRF Authentication Kravatte-SAE Session authenticated encryption Kravatte-SIV Synthetic-IV authenticated encryption Kravatte-WBC Wide block cipher, authenticated en- cryption with minimal expansion

38 / 56

slide-44
SLIDE 44

Conclusions

Conclusions

Permutations are well suited for IoT devices, especially for

code size memory usage

Farfalle brings effjciency also on the high-end server Bear in mind protections against side-channel attacks

39 / 56

slide-45
SLIDE 45

Conclusions

Thanks for your attention!

Any questions?

Q?

https://keccak.team/ @KeccakTeam

40 / 56

slide-46
SLIDE 46

Backup slides

A very classical example

RSA: cd mod n = m Implemented using the square & multiply algorithm:

http://www.embedded.com/print/4199399 41 / 56

slide-47
SLIDE 47

Backup slides

How to protect against side-channel attacks?

Electrical-level countermeasures

E.g., balacing the processing of 0 and 1

System-level countermeasures

E.g., limit the use of a key

Algorithmic countermeasures

Randomization E.g., instead of processing x, process y and z s.t. x = y ⊕ z

42 / 56

slide-48
SLIDE 48

Backup slides

What block cipher are used for?

Hashing: Davies-Meyer, … Block encryption: ECB, CBC, … Stream encryption:

synchronous: counter mode, OFB, … self-synchronizing: CFB

MAC computation: CBC-MAC, C-MAC, … Authenticated encryption: OCB, GCM, CCM …

43 / 56

slide-49
SLIDE 49

Backup slides

Block cipher operation

44 / 56

slide-50
SLIDE 50

Backup slides

Block cipher operation: the inverse

45 / 56

slide-51
SLIDE 51

Backup slides

When do you need the inverse?

Hashing and its modes HMAC, MGF1, … Block encryption: ECB, CBC, … Stream encryption:

synchronous: counter mode, OFB, … self-synchronizing: CFB

MAC computation: CBC-MAC, C-MAC, … Authenticated encryption: OCB, GCM, CCM …

46 / 56

slide-52
SLIDE 52

Backup slides

Block cipher internals

47 / 56

slide-53
SLIDE 53

Backup slides

Hashing using Davies-Meyer

48 / 56

slide-54
SLIDE 54

Backup slides

Removing diffusion restrictions

49 / 56

slide-55
SLIDE 55

Backup slides

Simplifying the view: iterated permutation

50 / 56

slide-56
SLIDE 56

Backup slides

Pseudo-random function (PRF) input …

51 / 56

slide-57
SLIDE 57

Backup slides

Message authentication code (MAC) plaintext plaintext

52 / 56

slide-58
SLIDE 58

Backup slides

Stream cipher nonce plaintext = ciphertext

53 / 56

slide-59
SLIDE 59

Backup slides

Authenticated encryption nonce plaintext = ciphertext plaintext

54 / 56

slide-60
SLIDE 60

Backup slides

Incrementality

packet #1 packet #1

55 / 56

slide-61
SLIDE 61

Backup slides

Incrementality

packet #1 packet #2 packet #1 packet #2

55 / 56

slide-62
SLIDE 62

Backup slides

Incrementality

packet #1 packet #2 packet #3 packet #1 packet #2 packet #3

55 / 56

slide-63
SLIDE 63

Backup slides

In-place processing

Store A[x, y] at round i in (x′, y′) with (x′ y′ ) = (1 1 2 )i (x y ) . Interacts with π: the output of χ can overwrite its input Matrix of order 4

⇒ no performance loss if 4 rounds unrolled

[Bertoni et al., Keccak implementation overview]

56 / 56

slide-64
SLIDE 64

Backup slides

In-place processing

Store A[x, y] at round i in (x′, y′) with (x′ y′ ) = (1 1 2 )i (x y ) . Interacts with π: the output of χ can overwrite its input Matrix of order 4

⇒ no performance loss if 4 rounds unrolled

[Bertoni et al., Keccak implementation overview]

56 / 56

slide-65
SLIDE 65

Backup slides

In-place processing

Store A[x, y] at round i in (x′, y′) with (x′ y′ ) = (1 1 2 )i (x y ) . Interacts with π: the output of χ can overwrite its input Matrix of order 4

⇒ no performance loss if 4 rounds unrolled

[Bertoni et al., Keccak implementation overview]

56 / 56