G J Khn Ciphertec cc p gjkuhn@global.co.za Contents Contents - - PowerPoint PPT Presentation

g j k hn ciphertec cc p
SMART_READER_LITE
LIVE PREVIEW

G J Khn Ciphertec cc p gjkuhn@global.co.za Contents Contents - - PowerPoint PPT Presentation

AFRICACRYPT 2010 STIAS Stellenbosch Stellenbosch South Africa G J Khn Ciphertec cc p gjkuhn@global.co.za Contents Contents Protex: First electronic crypto device in designed in South Africa designed in South Africa Keeloq: A simple


slide-1
SLIDE 1

AFRICACRYPT 2010 STIAS Stellenbosch Stellenbosch South Africa

G J Kühn Ciphertec cc p

gjkuhn@global.co.za

slide-2
SLIDE 2

Contents Contents

Protex: First electronic crypto device in

designed in South Africa designed in South Africa

Keeloq: A simple but effective secure

t t d i remote entry device

Africacrypt 2010 2

slide-3
SLIDE 3

PROTEX CIPHER PROTEX CIPHER PROTEX CIPHER PROTEX CIPHER

A rotor-inspired electronic cipher device A rotor-inspired electronic cipher device

Africacrypt 2010 3

slide-4
SLIDE 4

Rotor Cryptographic Machines Rotor Cryptographic Machines

The Protex cipher was based on rotor

machine prototypes, such as machine prototypes, such as

Enigma Tsec‐KL/7 Typex

Typex

Africacrypt 2010 4

slide-5
SLIDE 5

The Enigma machine was g used commercially from the early 1920’s, and was adopted by the militaries adopted by the militaries and governments of various countries.

[Wikipedia]

Africacrypt 2010 5

slide-6
SLIDE 6

Rotor Disk Rotor Disk

P

A B C D E A B C D E

P = Permutation embedded in

E F G H E F G H

rotor

A B A B

S‐1PS

B C D E F B C D E F

S = Single step cyclic permutation

Africacrypt 2010 6

G H G H

slide-7
SLIDE 7

TSEC/KL‐7 adopted by the US National Security Agency

Africacrypt 2010 7

[Wikipedia]

slide-8
SLIDE 8

Typex ‐ British cipher machine in use from 1937 ‐ Based on the Enigma

Africacrypt 2010 8

[Wikipedia]

slide-9
SLIDE 9

Concatenation of r Rotors Concatenation of r Rotors

1 1 2 2

P S P S S P S S P S

i i i i i i − − −

where

1 1 2 2

1 2

P S P S S P S S P S

r r

i i i i i i r

= ⋅ ⋅ ⋅

  • where

P1, P2, …, Pr are the rotor permutations S is a 1‐step rotation operation S is a 1 step rotation operation is the state of the machine

( )

1 2

, , , r i i i σ = …

Africacrypt 2010 9

slide-10
SLIDE 10

Reflection Disk

A B

P1 P2 Pr

B C D E F

Self‐inverse permutation

G H

1 1 2 2 2 2 1 1

1 1 i i i i i i i i

S P S S P S S Q P P S S P S

− − − − − −

⋅ ⋅ ⋅ = ⋅

1 2 2 1 1 r r

S P S S P S S Q P P P S S P S X X

⋅ = ⋅ ⋅ = ⋅

Q and Pr are conjugate permutations with the same cycle structure

Africacrypt 2010 10

slide-11
SLIDE 11

Rotor Cycle Structure Properties Rotor Cycle Structure Properties

Advantage:

Encryption/ decryption operations are identical

Weakness:

A given letter is never encrypted into itself

g yp

This is due to the turn‐around permutation being self‐

inverse with no fixed points – all cycles are of order 2 h Sh d d f

This represents a Shannon redundancy of 0.057

bits/letter

Africacrypt 2010 11

slide-12
SLIDE 12

Re‐entry Re entry

The technique matches the alphabet size to

th b f t t th t the number of contacts on the rotor

KL‐7: 26 : 36 : 26

P P

KL 7: 26 : 36 : 26 Protex: 26 : 32 : 26

P1 P2

A B C A B C C D E F C D E F

B→D→1→E→C

1 2 1 2

Africacrypt 2010 12

slide-13
SLIDE 13

Protex Design Protex Design

5‐bit alphabet 12 random permutations on 32 characters

One permutation is used as a reflector The permutations are chosen such that P•S ≠ S•P

p (Shannon product cipher condition)

Africacrypt 2010 13

slide-14
SLIDE 14

P t E ti /D ti Protex Encryption/Decryption

+

P

2

P

11

P

10

P

+ + + + +

1

P

2

P

11

P

i1 i2 i9 i10 i11 c c c c c

10

P

+ + + +

12

P

1

c1 c9 c2 c10 c11 Boolean Finite State Circuit

1 12

P−

‐i11 ‐i10 ‐i9 ‐i2 ‐i1 Boolean Finite State Circuit

1 1

P−

1 2

P−

1 10

P−

1 11

P−

+ + + + +

Africacrypt 2010 14

1 12

P−

Decryption uses as turn‐around permutation

slide-15
SLIDE 15

R t M hi C t i ti Rotor Machine Categorisation

Boolean Finite State Circuit KEY Complex mixing function Input stream Output stream

Stream cipher with a dynamic key‐dependent i i f i

Africacrypt 2010 15

mixing function

slide-16
SLIDE 16

Key Size Key Size

BFSC initial state : 11x5 = 55 bits Counters initial states : 11x5 = 55 bits Ordering of 12 permutations: 12! ≡ 28.8 bits Total key size : 138.8 bits

Africacrypt 2010 16

slide-17
SLIDE 17

Re Entry Re‐Entry

Re‐entry on six 5‐bit teleprinter control characters

Re entry on six 5 bit teleprinter control characters

  • No. of re‐

t i Probability entries y 0.812500 1 0.157258 2 0.026210 3 0.003615 Average = 0.22 4 0.000387 5 0.000029 6 0.000001

Africacrypt 2010 17

6 0.000001

slide-18
SLIDE 18

Implementation Implementation

Ferrite core memory storing 12 permutations and th i i their inverses Permutations were ti i d t

  • ptimised to

reduce the number

  • f conductors
  • f conductors

threaded through aeach ferrite core

Africacrypt 2010 18

slide-19
SLIDE 19

S Box S‐Box

Laboratory model S‐Box showing 5 planes di h bi d corresponding to the 5‐bit words

Africacrypt 2010 19

slide-20
SLIDE 20

Patch Panel Patch Panel

Patch panel to select a rearrangement of the rearrangement of the 12! permutations

Africacrypt 2010 20

slide-21
SLIDE 21

Attacks on Protex Attacks on Protex

Cryptanalysis depends critically on the properties

  • f the BFSC

Ad f th t i l

Advance of the counters are irregular

Side‐channel attacks:

Timing attacks Timing attacks

Re‐entry Propagation of carry bit

p g y Power analysis

Power surges due to switching of magnetic ferrite

cores

Africacrypt 2010 21

slide-22
SLIDE 22

Benefit of Hindsight Benefit of Hindsight

The reflector structure of rotor machines

  • ffers no cryptographic advantage

yp g p g

Input‐output permutations conjugate to a fixed

permutation decreases entropy p py

Re‐entry is a serious weakness, making the

cipher vulnerable to a timing attack cipher vulnerable to a timing attack

Africacrypt 2010 22

slide-23
SLIDE 23

KEELOQ CIPHER KEELOQ CIPHER KEELOQ CIPHER KEELOQ CIPHER

The travails of a 32-bit block cipher The travails of a 32-bit block cipher

Africacrypt 2010 23

slide-24
SLIDE 24

KEELOQ KEELOQ

Designed at Nanoteq in the 1980’s Purpose: To provide increased security for remote

keyless entry systems

Applications: car door, garage door openers, etc.

Constraints

32‐bit radio transmission low power low component count

p

Africacrypt 2010 24

slide-25
SLIDE 25

Protocol Protocol

A block cipher to encrypt the state of a

counter

Key length: Initially 32 bits, but later

increased to 64 bits increased to 64 bits

Block length limited to 32 bits due to

transmitter constraints transmitter constraints

Africacrypt 2010 25

slide-26
SLIDE 26

Design Design

No nxn S‐boxes, as these would be too

expensive in component count p p

Eventually it was decided to insert a single

5x1 S‐box 5x1 S box

An elementary key schedule to save

components components

Circulating shift register

Africacrypt 2010 26

slide-27
SLIDE 27

Keeloq Encryption Keeloq Encryption

26 20 16 9 1 30 31 ‐‐‐‐ ‐‐‐‐ ‐‐‐‐ ‐‐‐‐ ‐‐‐‐ 4 3 2 1 NLF (3A5C742E) (3A5C742E) 63 64‐bit key shift register

Africacrypt 2010 27

slide-28
SLIDE 28

Keeloq Decryption Keeloq Decryption

25 19 15 8 1 30 31 ‐‐‐‐ ‐‐‐‐ ‐‐‐‐ ‐‐‐‐ ‐‐‐‐ 4 3 2 1 NLF (3A5C742E) (3A5C742E) 63 64‐bit key shift register 15

Africacrypt 2010 28

slide-29
SLIDE 29

Number of Steps (Rounds) Number of Steps (Rounds)

Number of shift register steps: 528 This was decided on as follows

Good SAC properties from plaintext to

ciphertext

Each key bit should be active at least 8 times

The 528 steps comprises 8¼ cycles of the key

register

The ¼ cycle was introduced as a “nuisance”

impediment to cryptanalysis

Africacrypt 2010 29

slide-30
SLIDE 30

Tap Points on the Shift Register Tap Points on the Shift Register

Latency: 1 clock period Latency: 1 clock period

Minimised to enhance diffusion of bit changes

in encryption/decryption yp / yp

Africacrypt 2010 30

slide-31
SLIDE 31

The Non‐Linear Function (NLF)

Properties

5‐bit Boolean function 0‐1 balanced Algebraic degree : 3

g g 3

Minimum distance to affine set : 8 Correlation immunity : 1

y

Function resiliency : 1

Africacrypt 2010 31

slide-32
SLIDE 32

Attacks on Keeloq Attacks on Keeloq

Attack Data Tim e Mem Reference Exhaustive search 2 KP 263 Small Time‐memory trade‐off 2 CP 242.7 100 TB Hellman Slide/algebraic 216 KP 251.4 ? [Co, Ba, Wa] Slid / d

32 KP 37

6 GB B d Slide/guess and determine 232 KP 237 16 GB Bogdanov Slide/cycle structure 232 KP 239.4 16.5 GB [Co, Ba] Slide/cycle structure 2 KP 2 16.5 GB [Co, Ba] Slide/fixed points 232 KP 227 >16 GB [Co, Ba, Wa] Slide/meet‐in‐the‐middle 216 KP 245 ≈2 MB [In, Ke, …]

Africacrypt 2010 32

slide-33
SLIDE 33

Exhaustive Sear Exhaustive Search ch Exhaustive Sear Exhaustive Search ch

Africacrypt 2010 33

slide-34
SLIDE 34

Exhaustive Search Exhaustive Search

Computational Complexity = 263

Most significant half Criterion Number of

p p y

Time: 2 weeks using FPGA circuits

Most significant half (MSH) Criterion Number of ciphertexts MAC = f(counter) MSH* Satisfies MAC 2 Fixed ID (known) MSH Equals ID 2 Fixed ID (unknown) MSH differential 3 Random bits 16‐bit counter mode ≤64

* MSH = most significant half of counter

Africacrypt 2010 34

MSH = most significant half of counter

slide-35
SLIDE 35

Deduced Plaintext for Exhaustive Search Attack

Guess the state of the binary counter

Guess the state of the binary counter

The date of purchase of the car and the usage

pattern of the driver might give a clue p g g

At a usage pattern of 10 transmissions per day,

the wrap‐around period is approximately 18 p p pp y years

If the top bits are determined by the serial number

  • f the transmitter, this provides the attacker with

substantial information

Africacrypt 2010 35

slide-36
SLIDE 36

Cryptologists Involved Cryptologists Involved

Bogdanov: Guess and determine slide and Bogdanov: Guess‐and‐determine, slide, and

distinguishing attacks

C

t i B d d W Slid l b i

Courtois, Bard and Wagner: Slide‐algebraic

attack

Indesteege, Keller, Dunkelman, Biham and

Preneel: Slide‐ and meet‐in‐the‐middle attacks

Eisenbarth, M & T Kasper, Moradi, Paar,

p Salmasizadeh, Shalmani: Power analysis

Africacrypt 2010 36

slide-37
SLIDE 37

Algebraic Attack Algebraic Attack Algebraic Attack Algebraic Attack

Africacrypt 2010 37

slide-38
SLIDE 38

Keeloq Algebraic Equations Keeloq Algebraic Equations

NLF(x4,x3,x2,x1,x0) = x0⊕x1⊕x0x1⊕x0x3⊕x0x4⊕x1x2⊕ x2x3 ⊕x2x4⊕x0x1x4⊕x0x2x4⊕x1x3x4⊕x2x3x4 Add 2 variables α = x3x4 and β = x0x4 Assume F bits of the key are known, then for r rounds of the cipher, there are 3r + 64 + F multivariate quadratic equations in 3r + 96 variables of which 64 + F are known The total number of distinct monomials is

Africacrypt 2010 38

approximately 12r

slide-39
SLIDE 39

Complexity of Algebraic Attack Complexity of Algebraic Attack

Faster than exhaustive search on reduced Keeloq: Faster than exhaustive search on reduced Keeloq: With r = 128, 2 known plaintexts, 30 bits guessed the remaining 34 bits are recovered in guessed, the remaining 34 bits are recovered in 150 s by the program MiniSat 2.0 With r = 160 rounds, 2 plaintexts in counter With r 160 rounds, 2 plaintexts in counter mode, 30 bits guessed, the remaining 34 bits are recovered in 233 s by the program MiniSat 2.0

Africacrypt 2010 39

slide-40
SLIDE 40

Linear Slide Attacks Linear Slide Attacks Linear Slide Attacks Linear Slide Attacks

Africacrypt 2010 40

slide-41
SLIDE 41

Linear Slide Attacks Linear Slide Attacks

Data requirement: 232 known plaintexts (Full code

book)

Basis of attack:

Self‐similar key schedule (supports slide attack) Efficient linear approximation to the NLF Existence of linear relations within the

algorithm

Africacrypt 2010 41

slide-42
SLIDE 42

Slide Attack Slide Attack

k k k F F F P C k k k F F F k k C*

A pair (P C) (P* C*) is called a slid pair if A pair (P,C), (P ,C ) is called a slid pair if F(P) = P* and F(C) = C*

Africacrypt 2010 42

slide-43
SLIDE 43

Complexity of the Slide Attack Complexity of the Slide Attack

K

  • Assume that P and P* is a slid pair

F P P* K Assume that P and P is a slid pair, then so is C and C*

  • Use this information to solve for K

V if h l i b h ki F C* K C

  • Verify the solution by checking

additional plaintext‐ciphertext pairs Complexity 1. The attacker is searching for collisions, which, due to the 1. The attacker is searching for collisions, which, due to the birthday paradox, have a high probability after 2n/2 pairs have been searched S l i f K h ld b K

Africacrypt 2010 43

  • 2. Solving for K should be << 2K
slide-44
SLIDE 44

Linear Approximation to NLF Linear Approximation to NLF

( ) NLF(x4, x3, x2, x1, x0) = x0⊕x1⊕x0x1⊕x0x3⊕x0x4⊕x1x2⊕ x2x3⊕x2x4⊕x0x1x4⊕x0x2x4⊕x1x3x4⊕x2x3x4

The best linear approximation, used in the slide‐

determine attack, is x0⊕ x1. Pr(NLF(x4, x3, x2, x1, x0) = 0|x0⊕ x1 = 0) = 5/8 Pr(NLF(x4, x3, x2, x1, x0) = 1 |x0⊕ x1 = 1 ) = 5/8

Africacrypt 2010 44

slide-45
SLIDE 45

Best Determine Slide Attack Best Determine‐Slide Attack

Data: 232 known plaintexts (full codebook) Complexity: ≈ 237 Keeloq encryptions

Complexity: 2 Keeloq encryptions

Africacrypt 2010 45

slide-46
SLIDE 46

Slide/F Slide/Fixed P ixed Point Attacks int Attacks Slide/F Slide/Fixed P ixed Point Attacks int Attacks

Africacrypt 2010 46

slide-47
SLIDE 47

Cycle Structure of Keeloq Cycle Structure of Keeloq

32 bits 32 bits 1 key register cycle

8 k

f

(8 cycles) (k – k ) c (32 bits)

Africacrypt 2010 47

(k15 k0)

slide-48
SLIDE 48

Slide Determine Attack Slide‐Determine Attack

Remove the ¼ cycle by guessing the first 16 key

bits and decrypting the ciphertext by 16 rounds

Given the pair (p, c), Search for fixed points

About 216 pairs will be found (birthday paradox)

( )

8 k

f p p =

Store the triples (p,c,(k15,…,k0)) Apply an algebraic attack to determine the

unknown 48 key bits

Verify solutions by checking additional plaintext‐

ciphertext pairs

Africacrypt 2010 48

slide-49
SLIDE 49

Complexity Complexity

Data: 232 known plaintexts (full codebook) Version A: Average = 231.1 Keeloq encryptions Version B (optimised): Average = 227.7 Keeloq

encryptions

Africacrypt 2010 49

slide-50
SLIDE 50

Safe Keys Safe Keys

The success of the attack depends on the existence

  • f fixed points, and this is a function of the key

Version A works for about 63% of keys The attack does not work for about 37% of keys Optimised version A works for about 30% of

keys

Africacrypt 2010 50

slide-51
SLIDE 51

Slide/Meet Slide/Meet in in the the Middle Attack Middle Attack Slide/Meet Slide/Meet-in in-the the-Middle Attack Middle Attack

Africacrypt 2010 51

slide-52
SLIDE 52

Slide/Meet in the Middle Attack Slide/Meet‐in‐the‐Middle Attack

Participating research groups Computer science department, Technion, Israel Research group COSIC of the Katholieke

Universiteit Leuven, Belgium

Math department of the Hebrew University,

Israel

Africacrypt 2010 52

slide-53
SLIDE 53

Recovering Key Bits Recovering Key Bits

16 steps later State 16 bits U L*

( )

,

i

K

g L U =

U L

( )

i

K

g 16 bits U L Ki = (k16i …k16i + 15), i = 0,1,2,3 K is easily solved if L L* and U are known

Africacrypt 2010

Ki is easily solved if L, L and U are known

53

slide-54
SLIDE 54

Meet in the Middle Attack Meet‐in‐the‐Middle Attack

i

P

i

X

i

X∗

j

P∗

j

P

g g g g k0…k15 k16…k31 k32…k47 k48…k63 k0…k15

C Y C∗ Y ∗ C

g g g g

i

C

j

Y

i

C∗

j

Y

j

C

Africacrypt 2010 54

slide-55
SLIDE 55

Meet in the Middle Attack Meet‐in‐the‐Middle Attack

i

P

i

X

i

X∗

j

P∗

j

P

g g g g k0…k15 k16…k31 k32…k47 k48…k63 k0…k15

C Y C∗ Y ∗ C

g g g g

i

C

j

Y

i

C∗

j

Y

j

C

Africacrypt 2010 55

slide-56
SLIDE 56

Meet in the Middle Attack Meet‐in‐the‐Middle Attack

i

P

i

X

i

X∗

j

P∗

j

P

g g g g k0…k15 k16…k31 k32…k47 k48…k63 k0…k15

C Y C∗ Y ∗ C

g g g g

i

C

j

Y

i

C∗

j

Y

j

C

Africacrypt 2010 56

slide-57
SLIDE 57

Complexity of the Attack Complexity of the Attack

216(32·216 + 216(32·216 + 216(32 + 4))) = 254.0 rounds (3 (3 (3 4)))

Data: 216 known plaintexts

65 minutes to obtain data 65 minutes to obtain data

Time complexity: 245.0 Keeloq encryptions

8 d 6 CPU

7.8 days on 64 CPU cores Variant requires 3.4 days on 64 CPU cores

Africacrypt 2010 57

slide-58
SLIDE 58

Discussion Discussion Discussion Discussion

Africacrypt 2010 58

slide-59
SLIDE 59

Discussion Discussion

Keeloq has been successfully cracked, but a pure

algebraic attack requires more research

Improvements:

Scale up the Keeloq block and key lengths Slight structural changes to the key schedule

would stop slide attacks

Africacrypt 2010 59

slide-60
SLIDE 60

Benefit of Hindsight Benefit of Hindsight

The design team underestimated

The rapid progress in brute force computational

capabilities

Discovery of new attacks, such as the slide

attack

Africacrypt 2010 60

slide-61
SLIDE 61

Conclusion Conclusion

Keeloq was a significant improvement

  • n ciphers used in the 1980’s for remote
  • n ciphers used in the 1980 s for remote

car entry

Africacrypt 2010 61