+ All Categories
Home > Documents > Chapter 3

Chapter 3

Date post: 01-Jan-2016
Category:
Upload: curran-anderson
View: 25 times
Download: 1 times
Share this document with a friend
Description:
Chapter 3. Block Ciphers and the Advanced Encryption Standard. Outline. 3.1 Introduction 3.2 Substitution-Permutation Networks 3.3 Linear cryptanalysis 3.4 Differential cryptanalysis 3.5 The Data Encryption Standard 3.6 The Advanced Encryption Standard 3.7 Modes of Operation. - PowerPoint PPT Presentation
46
1 Chapter 3 Block Ciphers and the Advanced Encryption Standard
Transcript

1

Chapter 3

Block Ciphers and the Advanced Encryption

Standard

2

Outline

3.1 Introduction 3.2 Substitution-Permutation

Networks 3.3 Linear cryptanalysis 3.4 Differential cryptanalysis 3.5 The Data Encryption Standard 3.6 The Advanced Encryption

Standard 3.7 Modes of Operation

3

3.1 Introduction A commonly used design for modern-day

block ciphers is that of an iterated cipher: The cipher requires the specification of a

round function and a key schedule, and the encryption of a plaintext will proceed through Nr similar rounds. random key K: used to construct Nr round keys

(also called subkeys), which are denoted K1,…,KNr. key schedule (K1,…,KNr): constructed from K using

a fixed, public algorithm. round function g: takes two inputs: a round key (Kr)

and a current state (wr-1). wr=g(wr-1,Kr) is the next state.

plaintext x: the initial state w0. Ciphertext y: the state after all Nr rounds done.

4

Introduction Encryption operations: Decryption operations:

Nr

NrNrNr

NrNrNr

wy

Kwgw

Kwgw

Kwgw

Kwgw

xw

),(

),(

),(

),(

1

121

212

101

0

0

1110

2211

11

),(

),(

),(

wx

Kwgw

Kwgw

Kwgw

ywNrNrNr

Nr

Note: function g is injective (one-to-one)

5

3.2 Substitution-Permutation Networks (SPN)

Cryptosystem 3.1: SPN and Nr are positive integers is a substitution is a permutation. , and consist of all

possible key schedules that could be derived from an initial key K using the key scheduling algorithm.

For a key schedule , we encrypt the plaintext x using Algorithm 3.1.

ml,ll

S }1,0{}1,0{: },...,1{},...,1{: lmlmP

lmCP }1,0{ 1)}1,0({ NrlmK

),...,( 11 NrKK

6

Substitution-Permutation Networks

Algorithm 3.1: SPN

)(output

)( do

to1for

),...,(

)( do

to1for do

1 to1for

1

)()(

1

)()1(

)()(

1

0

y

Kvy

uv

mi

Kwu

vvw

uv

mi

Kwu

Nrr

xw

NrNr

NriS

Nri

NrNrNr

rlm

rr

riS

ri

rrr

PP

)),...,(,,,( 11 NrPS KKx

ur is the input to the S-boxes in round r. vr is the output of the S-boxes in round r. wr is obtained from vr by applying . ur+1 is constructed from wr by xor-ing with the round key Kr+1 (called round key mixing). The very first and last operations are xors with subkeys (called whitening).

P

7

Substitution-Permutation Networks

Example 3.1: Suppose . Let be defined as

follows, where the input and the output are written in hexadecimal:

Let be defined as follows:

See Figure 3.1 for a pictorial representation of this particular SPN, where Sir means i-th round, r-th S-box.

4 Nrml S

P

8

x

v1

u1

w1

u2

v2

w2

u3

v3

w3

u4

v4

y

Figure 3.1: A substitution-permutation network

9

Substitution-Permutation Networks Key schedule: suppose we begin with a 32-bit key

. For , define Kr to consist of 16 consecutive bits of K, beginning with k4r-3.

K= 0011 1010 1001 0100 1101 0110 0011 1111 Round keys:

K1= 0011 1010 1001 0100K2= 1010 1001 0100 1101K3= 1001 0100 1101 0110K4= 0100 1101 0110 0011K5= 1101 0110 0011 1111

32321 }1,0{),...,( kkK 51 r

10

Substitution-Permutation Networks Suppose the plaintext is x= 0010 0110 1011 0111. Then the encryption of x proceeds as follows:

w0= 0010 0110 1011 0111K1= 0011 1010 1001 0100u1= 0001 1100 0010 0011v1= 0100 0101 1101 0001w1= 0010 1110 0000 0111K2= 1010 1001 0100 1101u2= 1000 0111 0100 1010v2= 0011 1000 0010 0110w2= 0100 0001 1011 1000

11

Substitution-Permutation Networks

K3= 1001 0100 1101 0110

u3= 1101 0101 0110 1110v3= 1001 1111 1011 0000w3= 1110 0100 0110 1110K4= 0100 1101 0110 0011u4= 1010 1001 0000 1101v4= 0110 1010 1110 1001K5= 1101 0110 0011 1111, and y= 1011 1100 1101 0110

is the ciphertext.

12

3.3 Linear Cryptanalysis We want to find a probability linear relationship

between a subset of plaintext bits and a subset of data bits preceding the last round. This relation behaves in a non-random fashion.

The attacker has a lot of plaintext-ciphertext pairs (known plaintext attack).

For each candidate subkey, we partially decrypt the cipher and check if the relation holds. If the relation holds then increment its corresponding counter. At the end, the candidate key that counts furthest from ½ is the most likely subkey.

13

Linear Cryptanalysis

3.3.1 The Piling-up Lemma Suppose X1, X2,… are independent random variables

from {0,1}. And

The independence of Xi, Xj implies

,...2,1 , 1]1Pr[

Hence, ,...2,1 , ]0Pr[

ipX

ipX

ii

ii

)1)(1(]1,1Pr[

)1(]0,1Pr[

)1(]1,0Pr[

]0,0Pr[

jiji

jiji

jiji

jiji

ppXX

ppXX

ppXX

ppXX

14

Linear Cryptanalysis

Now consider .

The bias of Xi is defined to be the quantity

And we have

ji XX

jijiji

jijiji

ppppXX

ppppXX

)1()1(]1Pr[

)1)(1(]0Pr[

21 ii p

. ]1Pr[

, ]0Pr[

,

21

21

21

21

ii

ii

i

X

X

15

Linear Cryptanalysis

Let denote the bias of .

Lemma 3.1 (Piling-up lemma) : Let denote the bias of the random variable

. Then

Corollary 3.2: Let denote the bias of the random variable . Suppose that for some j. Then .

kiii ,...,, 21

kii XX 1

kiii ,...,, 21

kii XX 1

. 21

1,...,, 21 jk i

k

j

kiii

kiii ,...,, 21

kii XX 1

0ji

0,...,, 21

kiii

16

Linear Cryptanalysis 3.3.2 Linear Approximations of S-boxes

Consider an S-box . Let the input m-tuple be X=(x1,…,xm). And the output n-

tuple be Y=(y1,…,yn). We can see that

Now we can compute the bias of the form

using the formulas stated above.

).,...,(),...,( if

2],...,,,...,Pr[

and ; ),...,(),...,( if

0],...,,,...,Pr[

11

1111

11

1111

mSn

mnnmm

mSn

nnmm

xxyy

yYyYxXxX

xxyy

yYyYxXxX

nmS }1,0{}1,0{:

lk jjii YYXX 11

17

Linear Cryptanalysis

Example 3.2: We use the S-box as Example 3.1.

18

Linear Cryptanalysis Consider . The probability that

can be determined by counting the number of rows in which , and then dividing by 16.

It is seen that

Hence, the bias is 0. If we instead analyze , we find that

the bias is –3/8.

241 YXX 0241 YXX

0241 YXX

21

241 ]0Pr[ YXX

4143 YYXX

19

Linear Cryptanalysis We can record the bias of all 28=256 possible

random variables. We represent the relevant random variable in

the form

where . We treat (a1,a2,a3,a4) and (b1,b2,b3,b4) as

hexadecimal digit (they are called input sum and output sum, respectively)

ii

iii

i

YbXa4

1

4

1

4,3,2,1},1,0{},1,0{ iba ii

20

Linear Cryptanalysis

Let NL(a,b) denote the number of binary eight-tuples (x1,x2,x3,x4,y1,y2,y3,y4) s.t

and

The bias is computed as . The table of all NL is called the linear

approximation table (Figure 3.2).

),,,(),,,( 43214321 xxxxyyyy S

04

1

4

1

ii

iii

i

YbXa

16/)8),((),( baNba L

21

Figure 3.2: Linear approximation table: values of NL(a,b)-8

Example 3.2

22

Linear Cryptanalysis 3.3.3 Linear Attack on an SPN

Linear cryptanalysis requires a set of linear approximations of S-boxes that can be used to derive a linear approximation of the entire SPN (excluding the last round).

Figure 3.3 illustrates the structure of the approximation we will use. Arrows are the random variables involved in the

approximations and the labeled S-boxes (active S-boxes) are used in the approximations.

23

Figure 3.3: A linear approximation of an SPN

x

v1

u1

w1

u2

v2

w2

u3

v3

w3

u4

v4

y

24

Linear Cryptanalysis The approximation incorporates four active S-

boxes: In S12, has bias ¼ In S22, has bias -¼ In S32, has bias -¼ In S34, has bias -¼

have biases that are high in absolute value. Further, we will see their XOR will lead to cancellations of “intermediate” random variables.

16

18

17

151 VUUUT

28

26

262 VVUT

38

36

363 VVUT

316

314

3144 VVUT

4321 ,,, TTTT

25

Linear Cryptanalysis

Using Piling-up lemma, has bias equal to 23(1/4)(-1/4)3=-1/32. Note: we assume the four r.v are independent.

Then can be expressed in terms of plaintext bits, bits of u4 (input to the last round) and key bits as follows:

4321 ,,, TTTT

4321 TTTT

316

314

314

28

316

314

3144

38

36

36

26

38

36

363

28

26

26

16

28

26

262

16

188

177

155

16

18

17

151

VVKVVVUT

VVKVVVUT

VVKVVVUT

VKXKXKXVUUUT

26

Linear Cryptanalysis

XOR the right side and we get

Then replace by and key bits:

Now substitute them into 3.1:

(3.1) 314

36

26

18

17

15

316

314

38

36875

KKKKKK

VVVVXXX

3iV

4iU

416

416

316

48

48

314

414

414

38

46

46

36

KUVKUV

KUVKUV

(3.2) 416

414

48

46

314

36

26

18

17

15

416

414

48

46875

KKKKKKKKKK

UUUUXXX

27

Linear Cryptanalysis The expression above only involves plaintext

bits, bits of u4 and key bits. Suppose the key bits are fixed. Then

has the (fixed) value 0 or 1. It follows that

has bias -1/32 or 1/32 where the sign depends on the key bits (=0 or =1).

416

414

48

46

314

36

26

18

17

15 KKKKKKKKKK

(3.3) 416

414

48

46875 UUUUXXX

28

Linear Cryptanalysis The fact that (3.3) has bias bounded away

from 0 allows us to carry out linear attack. Suppose that we have T plaintext-ciphertext

pairs (denoted by ), all use the same unknown key, K. The attack will allow us to obtain the eight key bits,

There are 28=256 possibilities for the eight key bits. We refer to a binary 8-tuple as a candidate subkey.

516

515

514

513

58

57

56

55 ,,,,,,, KKKKKKKK

29

Linear Cryptanalysis For each and for each candidate

subkey, we compute a partial decryption of y and obtain the resulting value for .

Then we compute the value

We maintain an array of counters indexed by the 256 possible candidate subkeys, and increment the counter corresponding to a particular subkey when (3.4) has the value 0.

In the end, we expect most counters will have a value close to T/2, but the correct candidate subkey will close to T/2±T/32.

),( yx

4)4(

4)2( ,uu

(3.4) 416

414

48

46875 uuuuxxx

30

Linear Cryptanalysis The attack is presented as Algorithm 3.2.

L1 and L2 are hexadecimal value. is the inverse of the S-box. The output, maxkey, contains the most likely subkey.

In general, it is suggested that a linear attack based on a linear approximation having bias will be successful if the number of plaintext-ciphertext pairs is approximately for some “small” constant c.

1S

2c

31

)(output

),(

],[ then

max],[ if

|2/],[|],[

do

),( to)0,0(),(for

1

1],[],[ then

0 if

)(

)(

do

),( to)0,0(),(for

do

),(each for

0],[ do

),( to)0,0(),(for

21

21

21

2121

21

2121

416

414

48

46875

4)4(

14)4(

4)2(

14)2(

)4(24

)4(

)2(14

)2(

21

21

21

maxkey

LLmaxkey

LLCountmax

LLCount

TLLCountLLCount

FFLL

max

LLCountLLCount

z

uuuuxxxz

vu

vu

yLv

yLv

FFLL

yx

LLCount

FFLL

S

S

Algorithm 3.2: LINEARATTACK( )

1,, ST

32

3.4 Differential Cryptanalysis The main difference from linear attack is that

differential attack involves comparing the XOR of two inputs to the XOR of the corresponding outputs.

Differential attack is a chosen-plaintext attack. We consider inputs x and x* having a specified

XOR value denoted by . We decrypt y and y* using all possible key and

determine if their XOR has a certain value. Whenever it does, increment the corresponding counter. At the end, we expect the largest one is the most likely subkey.

*' xxx

33

Differential Cryptanalysis Definition 3.1:

Let be an S-box. Consider an (ordered) pair of bitstrings of length m, say (x,x*). We say that the input XOR of the S-box is and the output XOR is

.For any , define the set to consist of all the ordered pairs (x,x*) having input XOR equal to x’.

nmS }1,0{}1,0{:

*xx*)()( xx SS

mx }1,0{' )'(x

34

Differential Cryptanalysis It is easy to see that any set contains 2m

pairs, and that

For each pair in , we can compute the output XOR of the S-box. Then we can tabulate the distribution of output XORs. There are 2m output XORs which are distributed among 2n possible values. A non-uniform output distribution will be the basis for

a successful attack.

)'(x

)'(x}}1,0{:)',{()'( mxxxxx

35

Differential Cryptanalysis

Example 3.3: We use the same S-box as before. Suppose we

consider input XOR x’=1011. Then

We compute the following table, where

)}0100,1111(),...,1010,0001(),1011,0000{()1011(

*'

*),(*),(

,1011*

yyy

xyxy

xx

SS

36

x x* y y* y’

0000000100100011010001010110011110001001101010111100110111101111

1011101010011000111111101101110000110010000100000111011001010100

1110010011010001001011111011100000111010011011000101100100000111

1100011010100011011100001001010100011101010011101000101111110010

0010001001110010010111110010110100100111001000101101001011110101

0000 0 1000 0

0001 0 1001 0

0010 8 1010 0

0011 0 1011 0

0100 0 1100 0

0101 2 1101 2

0110 0 1110 0

0111 2 1111 2

Number of output

Distribution table for x’=1011

37

Differential Cryptanalysis

In Example 3.3, only 5 of the 16 possible output XORs occur. It has a very non-uniform distribution.

We can compute all possible input XORs as Example 3.3.

Define

ND(x’,y’) counts the number of pairs with input XOR equal to x’ and output XOR equal to y’. (Figure 3.4)

|}'*)()(:)'(*),{(|)','( yxxxxxyxN SSD

38

Figure 3.4: Difference distribution table: values of ND(x’,y’)

Example 3.3

39

Differential Cryptanalysis

An input XOR is computed as

Therefore, the input XOR does not depend on the subkey bits used in round r; it is equal to the (permuted) output XOR of round r-1.

Let a’ denote the input XOR and let b’ denote the output XOR. (a’,b’) is called a differential.

*)(

)*)(()()*(1

)(1

)(

)(1

)()(1

)()()(

ri

ri

ri

ri

ri

ri

ri

ri

ww

KwKwuu

40

Differential Cryptanalysis propagation ratio Rp(a’,b’):

Rp(a’,b’) can be interpreted as a conditional probability:

We combine differentials in consecutive rounds to form a differential trail. A particular differential trail is shown in Figure 3.5.

mD

p

baNbaR

2

)','()','(

)','(]'XORinput |'XORoutput Pr[ baRab p

41

Figure 3.5: A differential trail for a SPN

x

v1

u1

w1

u2

v2

w2

u3

v3

w3

u4

v4

y

42

Differential Cryptanalysis The differential attack arising from Figure 3.5

uses the following propagation ratios of differentials: In In In In

We therefore obtain a propagation ratio for a differential trail of the first three rounds of the SPN:

8/3)0101,0010( ,

8/3)0101,0010( ,

8/3)0110,0100( ,

2/1)0010,1011( ,

33

32

23

12

p

p

p

p

RS

RS

RS

RS

1024

27

8

3

2

1)0000 0101 0101 0000 ,0000 0000 1011 0000(

3

pR

43

Differential Cryptanalysis

In other words,

with probability 27/1024. However,

Hence, it follows that

with probability 27/1024.

0000 0101 0101 0000)'(0000 0000 1011 0000' 3 vx

0110 0000 0110 0000)'(0000 0101 0101 0000)'( 43 uv

0110 0000 0110 0000)'(0000 0000 1011 0000' 4 ux

44

Differential Cryptanalysis Algorithm 3.3 presents the attack algorithm. The input and output are similar to linear

attack, except that is a set (x,x*,y,y*), where x’ is fixed.

Algorithm 3.3 makes use of a certain filtering operation. Tuples (x,x*,y,y*) for which the differential holds are often called right pairs, and allow us to determine the key bits. A right pair has the form

Hence we consider those and .

0000)'()'( 4)3(

4)1( uu

*)( )1()1( yy *)( )3()3( yy

45

1],[],[ then

)0110)'(( and )0110)'(( if

*)()'(

*)()'(

)*)(()*(

)*)(()*(

*)()*(

*)()*(

)(

)(

do

),( to)0,0(),(for

then

)*)(( and )*)(( if

do

*)*,,,(each for

0],[ do

),( to)0,0(),(for

2121

4)4(

4)2(

4)4(

4)4(

4)4(

4)2(

4)2(

4)2(

4)4(

14)4(

4)2(

14)2(

)4(24

)4(

)2(14

)2(

4)4(

14)4(

4)2(

14)2(

)4(24

)4(

)2(14

)2(

21

)3()3()1()1(

21

21

LLCountLLCount

uu

uuu

uuu

vu

vu

yLv

yLv

vu

vu

yLv

yLv

FFLL

yyyy

yxyx

LLCount

FFLL

S

S

S

S

)(output

),(

],[ then

],[ if

do

),( to)0,0(),(for

1

21

21

21

21

maxkey

LLmaxkey

LLCountmax

maxLLCount

FFLL

max

Algorithm 3.3: DIFFERENTIALATTACK( )1,,

ST

46

Differential Cryptanalysis

A differential attack based on a differential trail having propagation ratio equal to will often be successful if the number of tuples (x,x*,y,y*), which we denote by T, is approximately , for a “small” constant c.

1c


Recommended