22.01.2015 Views

AES Guest Lecturer

AES Guest Lecturer

AES Guest Lecturer

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>AES</strong><br />

Advanced<br />

Encryption<br />

Standard<br />

CSC 7002 Computer Security<br />

William Roche<br />

http://ouray.cudenver.edu/~wrroche/Security/Presentation.html


Advanced Encryption Standard<br />

• Adopted by National Institute of Standards<br />

and Technology (NIST) on May 26, 2002.<br />

• <strong>AES</strong> is a simple design, a high speed<br />

algorithm, with low memory costs.<br />

• <strong>AES</strong> is a symmetric block cipher.<br />

– The same key is used to encrypt and decrypt<br />

the message.<br />

– The plain text and the cipher text are the<br />

same size.


<strong>AES</strong> Block<br />

• <strong>AES</strong> has a fixed block size of 128 bits called a<br />

state<br />

ABCDEFGHIJKLMNOP<br />

A E I M 41 45 49 4D<br />

B F J N<br />

C G K O<br />

(ASCII)<br />

42 46 4A 4E<br />

43 47 4B 4F<br />

D H L P 44 48 4C 50


<strong>AES</strong> Key<br />

• <strong>AES</strong> key is either 128 bits, 192 bits or<br />

256 bits<br />

128 bits (4 words):<br />

11223344556677889900AABBCCDDEEFF<br />

11 22 33 44<br />

55 66 77 88<br />

99 00 AA BB<br />

CC DD EE FF


<strong>AES</strong> Key<br />

or 192 bits (6 words)<br />

1122334455667788<br />

9900AABBCCDDEEFF<br />

1122334455667788<br />

11 22 33 44<br />

55 66 77 88<br />

99 00 AA BB<br />

CC DD EE FF<br />

11 22 33 44<br />

55 66 77 88<br />

or 256 bits (8 words)<br />

1122334455667788<br />

9900AABBCCDDEEFF<br />

1122334455667788<br />

9900AABBCCDDEEFF<br />

11 22 33 44<br />

55 66 77 88<br />

99 00 AA BB<br />

CC DD EE FF<br />

11 22 33 44<br />

55 66 77 88<br />

99 00 AA BB<br />

CC DD EE FF


Comparisons<br />

Key Length<br />

(N k words)<br />

Expanded<br />

Key Length<br />

(words)<br />

Block Size<br />

(N b words)<br />

Number of<br />

Rounds N r<br />

<strong>AES</strong>-128 4 44 4 10<br />

<strong>AES</strong>-192 6 52 4 12<br />

<strong>AES</strong>-256 8 60 4 14<br />

4 10<br />

Rijndael - 128 4 44 6 12<br />

8 14<br />

4 12<br />

Rijndael - 192 6 52 6 12<br />

8 14<br />

4 14<br />

Rijndael - 256 8 60 6 14<br />

8 14<br />

DES 2 * 256 2 16<br />

* of 64 bits, only 56 are used


Security<br />

• The key security feature is the size of the<br />

key.<br />

Assuming that one could build a machine that<br />

could recover a DES key in a second (i.e., try<br />

2 55 keys per second), then it would take that<br />

machine approximately 149 thousand-billion<br />

(149 trillion) years to crack a 128-bit <strong>AES</strong> key.<br />

To put that into perspective, the universe is<br />

believed to be less than 20 billion years old.<br />

• Accepting Moore's Law, doubling processor<br />

speed every 18 months, <strong>AES</strong>-128 will be<br />

secure for another 109.5 years.


<strong>AES</strong> Operations<br />

b 7 x 7 + b 6 x 6 + b 5 x 5 + b 4 x 4 + b 3 x 3 + b 2 x 2 + b 1 x + b 0<br />

• Multiplication in GF(2 8 ) consists of<br />

multiplying two polynomials modulo an<br />

irreducible polynomial of degree 8.<br />

– <strong>AES</strong> uses the following irreducible polynomial<br />

m(x) = x 8 + x 4 + x 3 + x + 1


<strong>AES</strong> Algorithm<br />

KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)],Nk)<br />

Cipher(byte in[4*Nb],byte out[4*Nb],word w[Nb*(Nr+1)])<br />

begin<br />

byte state[4,Nb]<br />

state = in<br />

AddRoundKey(state, w[0, Nb-1])<br />

for round = 1 step 1 to Nr–1<br />

SubBytes(state)<br />

ShiftRows(state)<br />

MixColumns(state)<br />

AddRoundKey(state,w[round*Nb,(round+1)*Nb-1])<br />

end for<br />

SubBytes(state)<br />

ShiftRows(state)<br />

AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])<br />

out = state<br />

end


<strong>AES</strong> Algorithm<br />

KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)],Nk)<br />

Cipher(byte in[4*Nb],byte out[4*Nb],word w[Nb*(Nr+1)])<br />

begin<br />

byte state[4,Nb]<br />

state = in<br />

AddRoundKey(state, w[0, Nb-1])<br />

for round = 1 step 1 to Nr–1<br />

SubBytes(state)<br />

ShiftRows(state)<br />

MixColumns(state)<br />

AddRoundKey(state,w[round*Nb,(round+1)*Nb-1])<br />

end for<br />

SubBytes(state)<br />

ShiftRows(state)<br />

AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])<br />

out = state<br />

end


– Sample Key:<br />

<strong>AES</strong> Algorithm<br />

Key Expansion<br />

11223344556677889900AABBCCDDEEFF<br />

• The first 4 (N k ) words are set equal to the key<br />

w[0] 11 22 33 44<br />

w[1] 55 66 77 88<br />

w[2] 99 00 AA BB<br />

w[3] CC DD EE FF


<strong>AES</strong> Algorithm<br />

Key Expansion<br />

For words 4 through 43<br />

i = N k // N k = 4<br />

while (i < N b *(N r +1)) { // N b *(N r +1)= 4*(10+1)= 44<br />

temp = w[ i – 1 ]<br />

If ( i%N k == 0 )<br />

rotate word left 1 byte<br />

process each byte through sbox<br />

XOR with RCON[i/N k -1] // just first byte of w[i]<br />

w[ i ] = w[ i-4 ] XOR temp<br />

i++}


<strong>AES</strong> Algorithm<br />

Key Expansion<br />

w[0] 11 22 33 44<br />

w[1] 55 66 77 88<br />

w[2] 99 00 AA BB<br />

w[3] CC DD EE FF<br />

i = N k // N k = 4<br />

while (i < N b *(N r +1)) { // N b *(N r +1)= 4*(10+1)= 44<br />

temp = w[ i - 1 ]<br />

i = 4<br />

temp = w[3] = CC DD EE FF


<strong>AES</strong> Algorithm<br />

Key Expansion<br />

If ( i%N k == 0 )<br />

rotate word left 1 byte<br />

process each byte through sbox<br />

temp = CC DD EE FF<br />

temp = DD EE FF CC<br />

temp = sbox[DD] sbox[EE] sbox[FF] sbox[CC]<br />

= C1 28 16 4B<br />

XOR with RCON[i/N k -1] RCON[0] = 01<br />

temp = (C1 ⨁ 01) 28 16 4B<br />

temp = C0 28 16 4B


Con – round<br />

Constants<br />

Powers of x = 0x02<br />

i 0 1 2 3 4 5 6 7<br />

x i 0x01 0x02 0x04 0x08 0x10 0x20 0x40 0x80<br />

Powers of x = 0x02<br />

i 8 9 A B C D E<br />

x i 0x1b 0x36 0x6c 0xd8 0xab 0x4d 0x9a<br />

• rCon can be implemented with a look-up-table<br />

• 2 i in GF(2 8 )<br />

• Removes symmetry and linearity from key expansion.


<strong>AES</strong> Algorithm<br />

Key Expansion<br />

For words 4 through 43<br />

i = N k // N k = 4<br />

while (i < N b *(N r +1)) {// N b *(N r +1)= 4*(10+1)= 44<br />

temp = W[i-1]<br />

If (i%N k == 0)<br />

i = 4<br />

rotate word left 1 byte<br />

process each byte through sbox<br />

XOR with RCON[i]<br />

w[i] = w[i-4] XOR ⨁ temp temp<br />

i++}<br />

temp // just = first C0 element 28 16 of w4B


<strong>AES</strong> Algorithm<br />

Key Expansion<br />

w[0] 11 22 33 44<br />

w[1] 55 66 77 88<br />

w[2] 99 00 AA BB<br />

w[3] CC DD EE FF<br />

w[4] D1 0A 25 0F<br />

w[4] = D1 0A 25 0F


<strong>AES</strong> Algorithm<br />

Key Expansion<br />

For words 4 through 43<br />

i = N k // Nk = 4 i = 5<br />

while (i < N b *(N r +1)) { // N b *(N r +1)= 4*(10+1)= 44<br />

temp = w[i-1]<br />

temp = w[4] = D1 0A 25 0F<br />

If (i%N k == 0)<br />

rotate word left 1 byte<br />

process each byte through sbox<br />

XOR with RCON[i/N k -1] // just first element of W<br />

w[i] = w[i-4] ⨁ temp<br />

i++}


<strong>AES</strong> Algorithm<br />

Key Expansion<br />

w[0] 11 22 33 44<br />

w[1] 55 66 77 88<br />

w[2] 99 00 AA BB<br />

w[3] CC DD EE FF<br />

w[4] D1 0A 25 0F<br />

i = 5<br />

temp = D1 0A 25 0F<br />

w[i] = w[i-4] ⨁ temp<br />

w[5] = (55 ⨁ D1) (66 ⨁ 0A) (77 ⨁ 25) (88 ⨁ 0F)<br />

w[5] = 84 C6 52 87


Beginning Key Expansion for:<br />

11 22 33 44 55 66 77 88 99 00 AA BB CC DD EE FF<br />

i subword rCon w[i-4]XORtemp<br />

w[i]<br />

0 11 22 33 44<br />

1 55 66 77 88<br />

2 99 00 AA BB<br />

3 CC DD EE FF<br />

4 C1 28 16 4B C0 28 16 4B D1 0A 25 0F<br />

5 84 6C 52 87<br />

6 1D 6C F8 3C<br />

7 D1 B1 16 C3<br />

8 C8 47 2E 3E CA 47 2E 3E 1B 4D 0B 31<br />

9 9F 21 59 B6<br />

10 82 4D A1 8A<br />

11 53 FC B7 49<br />

12 B0 A9 3B ED B4 A9 3B ED AF E4 30 DC<br />

13 30 C5 69 6A<br />

14 B2 88 C8 E0<br />

15 E1 74 7F A9<br />

16 92 D2 D3 F8 9A D2 D3 F8 35 36 E3 24<br />

17 05 F3 8A 4E<br />

18 B7 7B 42 AE<br />

19 56 0F 3D 07<br />

20 76 27 C5 B1 66 27 C5 B1 53 11 26 95<br />

21 56 E2 AC DB<br />

22 E1 99 EE 75<br />

23 B7 96 D3 72<br />

24 90 66 40 A9 B0 66 40 A9 E3 77 66 3C<br />

25 B5 95 CA E7<br />

26 54 0C 24 92<br />

27 E3 9A F7 E0<br />

28 B8 68 E1 11 F8 68 E1 11 1B 1F 87 2D<br />

29 AE 8A 4D CA<br />

30 FA 86 69 58<br />

31 19 1C 9E B8<br />

32 9C 0B 6C D4 1C 0B 6C D4 07 14 EB F9<br />

33 A9 9E A6 33<br />

34 53 18 CF 6B<br />

35 4A 04 51 D3<br />

36 F2 D1 66 D6 E9 D1 66 D6 EE C5 8D 2F<br />

37 47 5B 2B 1C<br />

38 14 43 E4 77<br />

39 5E 47 B5 A4<br />

40 A0 D5 49 58 96 D5 49 58 78 10 C4 77<br />

41 3F 4B EF 6B<br />

42 2B 08 0B 1C<br />

43 75 4F BE B8


<strong>AES</strong> Algorithm<br />

KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)],Nk)<br />

Cipher(byte in[4*Nb],byte out[4*Nb],word w[Nb*(Nr+1)])<br />

begin<br />

byte state[4,Nb]<br />

state = in<br />

AddRoundKey(state, w[0, Nb-1])<br />

for round = 1 step 1 to Nr–1<br />

SubBytes(state)<br />

ShiftRows(state)<br />

MixColumns(state)<br />

AddRoundKey(state,w[round*Nb,(round+1)*Nb-1])<br />

end for<br />

SubBytes(state)<br />

ShiftRows(state)<br />

AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])<br />

out = state<br />

end


<strong>AES</strong> Algorithm<br />

AddRoundKey<br />

• The state is XORed into the expanded key Nr +<br />

1 times.<br />

• This is the same as adding the expanded key to<br />

the state Nr+1 times in GF(2 8 )<br />

– in GF(2 8 ) adding two numbers together is the same<br />

as XORing them.<br />

void AddRoundKey(byte[][] state) {<br />

for (int c = 0; c < Nb; c++)<br />

for (int r = 0; r < 4; r++)<br />

state[r][c] = state[r][c] ˆ w[wCount++];}<br />

global counter


<strong>AES</strong> Algorithm<br />

AddRoundKey<br />

State<br />

41 45 49 4D<br />

42 46 4A 4E<br />

43 47 4B 4F<br />

44 48 4C 50<br />

41 ⨁ 11 45 ⨁ 55 49 ⨁ 99 4D ⨁ CC<br />

42 ⨁ 22 46 ⨁ 66 4A ⨁ 00 4E ⨁ DD<br />

43 ⨁ 33 47 ⨁ 77 4B ⨁ AA 4F ⨁ EE<br />

44 ⨁ 44 48 ⨁ 88 4C ⨁ BB 50 ⨁ FF<br />

Expanded Key<br />

w[0] w[4]<br />

11 22 33 44<br />

55 66 77 88<br />

99 00 AA BB<br />

CC DD EE FF<br />

After<br />

AddRoundKey<br />

50 10 D0 81<br />

60 20 4A 93<br />

70 30 E1 A1<br />

00 C0 F7 AF


<strong>AES</strong> Algorithm<br />

KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)],Nk)<br />

Cipher(byte in[4*Nb],byte out[4*Nb],word w[Nb*(Nr+1)])<br />

begin<br />

byte state[4,Nb]<br />

state = in<br />

AddRoundKey(state, w[0, Nb-1])<br />

for round = 1 step 1 to Nr–1<br />

SubBytes(state)<br />

ShiftRows(state)<br />

MixColumns(state)<br />

AddRoundKey(state,w[round*Nb,(round+1)*Nb-1])<br />

end for<br />

SubBytes(state)<br />

ShiftRows(state)<br />

AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])<br />

out = state<br />

end


<strong>AES</strong> Algorithm<br />

SubBytes<br />

• SubBytes is the SBOX for <strong>AES</strong><br />

• This make <strong>AES</strong> a non-linear cryptographic system.<br />

• For every value of b there is a unique value for b’<br />

– It is faster to use a substitution table (and easier).<br />

b' 0<br />

b' 1<br />

b' 2<br />

b' 3<br />

b' 4<br />

b' 5<br />

b' 6<br />

b' 7<br />

=<br />

1 0 0 0 1 1 1 1<br />

1 1 0 0 0 1 1 1<br />

1 1 1 0 0 0 1 1<br />

1 1 1 1 0 0 0 1<br />

1 1 1 1 1 0 0 0<br />

0 1 1 1 1 1 0 0<br />

0 0 1 1 1 1 1 0<br />

0 0 0 1 1 1 1 1<br />

x 0<br />

x 1<br />

x 2<br />

x 3<br />

x 4<br />

+<br />

x 5<br />

x 6<br />

x 7<br />

1<br />

1<br />

0<br />

0<br />

0<br />

1<br />

1<br />

0<br />

x is the inverse value of the byte b


<strong>AES</strong> Algorithm<br />

InvSubBytes<br />

b' 0<br />

-1<br />

1 0 0 0 1 1 1 1<br />

b' 1<br />

1 1 0 0 0 1 1 1<br />

b' 2 1 1 1 0 0 0 1 1<br />

b' 3 = 1 1 1 1 0 0 0 1<br />

b' 0 0 1 1 1 1 1 0<br />

6<br />

b' 0 0 0 1 1 1 1 1<br />

7<br />

b' 4 1 1 1 1 1 0 0 0<br />

b' 5<br />

0 1 1 1 1 1 0 0<br />

b' 0<br />

0 1 0 1 0 0 1 0<br />

b' 1 0 0 1 0 1 0 0 1<br />

b' 2 1 0 0 1 0 1 0 0<br />

b' 3 = 0 1 0 0 1 0 1 0<br />

b' 4 0 0 1 0 0 1 0 1<br />

b' 5 1 0 0 1 0 0 1 0<br />

b' 6 0 1 0 0 1 0 0 1<br />

1 0 1 0 0 1 0 0<br />

x is the inverse value of the byte b<br />

x 0<br />

x 1<br />

x 2<br />

x 3<br />

x 4<br />

x 0<br />

x 1<br />

x 2<br />

x 3<br />

x 4<br />

+<br />

x 5<br />

x 6<br />

x 6<br />

x 7<br />

+<br />

x 5<br />

x 6<br />

x 7<br />

1<br />

1<br />

0<br />

0<br />

0<br />

1<br />

1<br />

0<br />

1<br />

1<br />

0<br />

0<br />

0<br />

1<br />

1<br />

0


<strong>AES</strong> Algorithm<br />

SubBytes<br />

X<br />

Y<br />

0 1 2 3 4 5 6 7 8 9 a b c d e f<br />

0 63 7c 77 7b f2 6b 6f c5 30 1 67 2b fe d7 ab 76<br />

1 ca 82 c9 7d fa 59 47 f0 ad d4 a2 af 9c a4 72 c0<br />

2 b7 fd 93 26 36 3f f7 cc 34 a5 e5 f1 71 d8 31 15<br />

3 4 c7 23 c3 18 96 5 9a 7 12 80 e2 eb 27 b2 75<br />

4 9 83 2c 1a 1b 6e 5a a0 52 3b d6 b3 29 e3 2f 84<br />

5 53 d1 0 ed 20 fc b1 5b 6a cb be 39 4a 4c 58 cf<br />

6 d0 ef aa fb 43 4d 33 85 45 f9 2 7f 50 3c 9f a8<br />

7 51 a3 40 8f 92 9d 38 f5 bc b6 da 21 10 ff f3 d2<br />

8 cd 0c 13 ec 5f 97 44 17 c4 a7 7e 3d 64 5d 19 73<br />

9 60 81 4f dc 22 2a 90 88 46 ee b8 14 de 5e 0b db<br />

a e0 32 3a 0a 49 6 24 5c c2 d3 ac 62 91 95 e4 79<br />

b e7 c8 37 6d 8d d5 4e a9 6c 56 f4 ea 65 7a ae 8<br />

c ba 78 25 2e 1c a6 b4 c6 e8 dd 74 1f 4b bd 8b 8a<br />

d 70 3e b5 66 48 3 f6 0e 61 35 57 b9 86 c1 1d 9e<br />

e e1 f8 98 11 69 d9 8e 94 9b 1e 87 e9 ce 55 28 df<br />

f 8c a1 89 0d bf e6 42 68 41 99 2d 0f b0 54 bb 16


<strong>AES</strong> Algorithm<br />

InvSubBytes<br />

X<br />

Y<br />

0 1 2 3 4 5 6 7 8 9 a b c d e f<br />

0 52 9 6a d5 30 36 a5 38 bf 40 a3 9e 81 f3 d7 fb<br />

1 7c e3 39 82 9b 2f ff 87 34 8e 43 44 c4 de e9 cb<br />

2 54 7b 94 32 a6 c2 23 3d ee 4c 95 0b 42 fa c3 4e<br />

3 8 2e a1 66 28 d9 24 b2 76 5b a2 49 6d 8b d1 25<br />

4 72 f8 f6 64 86 68 98 16 d4 a4 5c cc 5d 65 b6 92<br />

5 6c 70 48 50 fd ed b9 da 5e 15 46 57 a7 8d 9d 84<br />

6 90 d8 ab 0 8c bc d3 0a f7 e4 58 5 b8 b3 45 6<br />

7 d0 2c 1e 8f ca 3f 0f 2 c1 af bd 3 1 13 8a 6b<br />

8 3a 91 11 41 4f 67 dc ea 97 f2 cf ce f0 b4 e6 73<br />

9 96 ac 74 22 e7 ad 35 85 e2 f9 37 e8 1c 75 df 6e<br />

a 47 f1 1a 71 1d 29 c5 89 6f b7 62 0e aa 18 be 1b<br />

b fc 56 3e 4b c6 d2 79 20 9a db c0 fe 78 cd 5a f4<br />

c 1f dd a8 33 88 7 c7 31 b1 12 10 59 27 80 ec 5f<br />

d 60 51 7f a9 19 b5 4a 0d 2d e5 7a 9f 93 c9 9c ef<br />

e a0 e0 3b 4d ae 2a f5 b0 c8 eb bb 3c 83 53 99 61<br />

f 17 2b 4 7e ba 77 d6 26 e1 69 14 63 55 21 0c 7d


<strong>AES</strong> Algorithm<br />

SubBytes<br />

State<br />

50 10 D0 81<br />

60 20 4A 93<br />

70 30 E1 A1<br />

00 C0 F7 AF<br />

Sbox( 50 ) Sbox( 10 ) Sbox( D0 ) Sbox( 81 )<br />

Sbox( 60 ) Sbox( 20 ) Sbox( 4A ) Sbox( 93 )<br />

Sbox( 70 ) Sbox( 30 ) Sbox( E1 ) Sbox( A1 )<br />

Sbox( 00 ) Sbox( C0 ) Sbox( F7 ) Sbox( AF )<br />

After SubBytes<br />

53 CA 70 0C<br />

D0 B7 D6 DC<br />

51 04 F8 32<br />

63 BA 68 79


<strong>AES</strong> Algorithm<br />

KeyExpansion(byte key[4*Nk],word w[Nb*(Nr+1)],Nk)<br />

Cipher(byte in[4*Nb],byte out[4*Nb],word w[Nb*(Nr+1)])<br />

begin<br />

byte state[4,Nb]<br />

state = in<br />

AddRoundKey(state, w[0, Nb-1])<br />

for round = 1 step 1 to Nr–1<br />

SubBytes(state)<br />

ShiftRows(state)<br />

MixColumns(state)<br />

AddRoundKey(state,w[round*Nb,(round+1)*Nb-1])<br />

end for<br />

SubBytes(state)<br />

ShiftRows(state)<br />

AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])<br />

out = state<br />

end


<strong>AES</strong> Algorithm<br />

ShiftRows<br />

• Simple routine which performs a left shift rows 1,<br />

2 and 3 by 1, 2 and 3 bytes respectively<br />

Before Shift Rows<br />

53 CA 70 0C<br />

D0 B7 D6 DC<br />

51 04 F8 32<br />

63 BA 68 79<br />

After Shift Rows<br />

53 CA 70 0C<br />

B7 D6 DC D0<br />

F8 32 51 04<br />

79 63 BA 68


<strong>AES</strong> Algorithm<br />

KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)],Nk)<br />

Cipher(byte in[4*Nb],byte out[4*Nb],word w[Nb*(Nr+1)])<br />

begin<br />

byte state[4,Nb]<br />

state = in<br />

AddRoundKey(state, w[0, Nb-1])<br />

for round = 1 step 1 to Nr–1<br />

SubBytes(state)<br />

ShiftRows(state)<br />

MixColumns(state)<br />

AddRoundKey(state,w[round*Nb,(round+1)*Nb-1])<br />

end for<br />

SubBytes(state)<br />

ShiftRows(state)<br />

AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])<br />

out = state<br />

end


<strong>AES</strong> Algorithm - MixColumns<br />

• This with shift rows provides diffusion<br />

• The columns are considered polynomials over<br />

GF(2 8 ) and multiplied modulo x 4 +1 with a(x)<br />

where a(x) = {03}x 3 + {01}x 2 + {01}x + {02}<br />

NOTE: x 4 +1 is relatively prime to a(x)<br />

a ’ j (a j *a(x))mod(x 4 +1)<br />

• This can also be written as matrix multiplication.<br />

a ’ 0<br />

02 03 01 01<br />

a 0<br />

a ’ 1<br />

a ’ 2<br />

=<br />

01 02 03 01<br />

01 01 02 03<br />

a 1<br />

a 2<br />

a ’ 3<br />

03 01 01 02<br />

a 3


<strong>AES</strong> Algorithm - MixColumns<br />

a ’ 0<br />

a ’ 1<br />

a ’ 2<br />

=<br />

02 03 01 01<br />

01 02 03 01<br />

01 01 02 03<br />

a 0<br />

a 1<br />

a 2<br />

a ’ 0 = 2a 0 ⨁ 3a 1 ⨁ a 2 ⨁ a 3<br />

a ’ 1 = a 0 ⨁ 2a 1 ⨁3a 2 ⨁a 3<br />

a ’ 2 = a 0 ⨁ a 1 ⨁ 2a 2 ⨁ 3a 3<br />

a ’ 3<br />

03 01 01 02<br />

a 3<br />

a ’ 3 = 3a 0 ⨁a 1 ⨁ a 2 ⨁ 2a 3<br />

Addition is easy in GF(2 8 ) : Addition is just the XOR operation<br />

Multiplication by 1 is easy in GF(2 8 ) : Multiplication by one is the identity<br />

Multiplication by 2 in GF(2 8 ) takes some work:<br />

. If multiplying by a value < 0x80 just shift all the bits left by 1<br />

. If multiplying by a value ≥ 0x80 shift left by 1 and XOR with 0x1b<br />

. This prevents overflow and keeps the values within range<br />

To Multiply by 3 in GF(2 8 ) : a * 03 = a * (02 + 01) = (a * 02) ⨁ (a * 01)


<strong>AES</strong> Algorithm - InvMixColumns<br />

a ’ 0<br />

a ’ 1<br />

a ’ 2<br />

a ’ 3<br />

=<br />

0e 0b 0d 09<br />

09 0e 0b 0d<br />

0d 09 0e 0b<br />

a 0<br />

a 1<br />

a 2<br />

a 3<br />

0b 0d 09 0e a 3<br />

To Multiply in GF(2 8 ) :<br />

a * 09 = a * (08 ⨁ 01)<br />

= (a * 02 * 02 * 02) ⨁ (a * 01)<br />

a * 0b = a * (08 ⨁ 02 ⨁ 01)<br />

= (a * 02 * 02 * 02) ⨁ (a * 02) ⨁ (a * 01)<br />

a * 0e = a * (08 ⨁ 04 ⨁ 02)<br />

= (a * 02 * 02 * 02) ⨁ (a * 02 * 02) ⨁ (a * 02)


<strong>AES</strong> Algorithm<br />

KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)],Nk)<br />

Cipher(byte in[4*Nb],byte out[4*Nb],word w[Nb*(Nr+1)])<br />

begin<br />

byte state[4,Nb]<br />

state = in<br />

AddRoundKey(state, w[0, Nb-1])<br />

for round = 1 step 1 to Nr–1<br />

SubBytes(state)<br />

ShiftRows(state)<br />

MixColumns(state)<br />

AddRoundKey(state,w[round*Nb,(round+1)*Nb-1])<br />

end for<br />

SubBytes(state)<br />

ShiftRows(state)<br />

AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1])<br />

out = state<br />

end


Sample Conversions<br />

Input String Key Output String (HEX)<br />

ABCDEFGHIJKLMNOP 11223344556677889900AABBCCDDEEFF BC4784A37D6F46452656B993D53393F5<br />

ABCDEFGHIJKLMNOP 01223344556677889900AABBCCDDEEFF 855866490543FDF6504FC84088FEDCA0<br />

ABCDEFFHIJKLMNOP 11223344556677889900AABBCCDDEEFF 372CCA446C0D391C4381392344630EE1<br />

Input String(HEX) Key Output String (HEX)<br />

00000000000000000000000000000000 00000000000000000000000000000000 66E94BD4EF8A2C3B884CFA59CA342B2E<br />

00000000000000000000000000000000 00000000000000000000000000000001 0545AAD56DA2A97C3663D1432A3D1C84<br />

00000000000000000000000000000001 00000000000000000000000000000001 A17E9F69E4F25A8B8620B4AF78EEFD6F


<strong>AES</strong> Algorithm<br />

Encryption<br />

PlainText<br />

Decryption<br />

Cipher Text<br />

RoundKey<br />

AddRoundKey<br />

1 st Round<br />

RoundKey *<br />

AddRoundKey<br />

1 st Round<br />

SubBytes<br />

InvShiftRows<br />

RoundKey<br />

ShiftRows<br />

MixColumns<br />

AddRoundKey<br />

Repeat<br />

N r -1<br />

Round<br />

RoundKey *<br />

InvSubBytes<br />

AddRoundKey<br />

InvMixColumns<br />

Repeat<br />

N r -1<br />

Round<br />

RoundKey<br />

SubBytes<br />

ShiftRows<br />

AddRoundKey<br />

Last<br />

Round<br />

RoundKey *<br />

InvShiftRows<br />

InvSubBytes<br />

AddRoundKey<br />

Last<br />

Round<br />

CipherText<br />

Plain Text<br />

*<br />

RoundKey Added in reverse order


Larger Plain Texts<br />

Encryption<br />

• How to encrypt texts larger than 16 bytes<br />

• Answer: Encrypt one block at a time<br />

Electronic CodeBook Mode<br />

But this can be subject to frequency analysis


Larger Plain Texts<br />

Encryption<br />

• How to avoid frequency analysis<br />

• Answer: Cipher Block Chaining<br />

The original image<br />

An image<br />

encrypted<br />

without any<br />

form of Cipher<br />

Block<br />

Chainging<br />

An image<br />

encrypted<br />

with cipher<br />

block<br />

chainging


Larger Plain Texts<br />

Encryption<br />

Cipher Block Chaining


Larger Plain Texts<br />

Decryption


Padding<br />

• If plaintext messages are not divisible by<br />

16 bytes. Padding may be a solution.<br />

• An easy method is to add a single 1 bit at<br />

the end of the message followed by<br />

enough 0’s to fill the block.<br />

– If the block is filled, encode one more block<br />

with a 1 followed by 0’s.


Attacks on <strong>AES</strong><br />

• Differential Cryptanalysis – Study of how<br />

differences in input affect differences in<br />

output.<br />

– Greatly reduced due to high number of rounds.<br />

• Linear Cryptanalysis – Study of correlations<br />

between input and output.<br />

– SBOX & Mix Columns are designed to frustrate<br />

Linear Analysis


Attacks on <strong>AES</strong><br />

• XSL Cryptanalysis – A new attack method<br />

developed in 2002, Analyses ciphers<br />

internal workings and generates a system<br />

on nonlinear simultaneous equations.<br />

– <strong>AES</strong> analyses to 8000 equations and 1600<br />

unknowns.<br />

– It is arguable if this can be solved any faster<br />

than a brute force attack.


Attacks on <strong>AES</strong><br />

• Side Channel Attacks – Attacks based on<br />

studying and measuring the actual<br />

implementation of the code.<br />

– For some implementations of <strong>AES</strong> the key has<br />

been obtained in under 100 minutes.<br />

• Computer running <strong>AES</strong> was 850MHz, Pentium III<br />

running FreeBSD 4.8


Types of Side Channel Attacks<br />

• Timing Attacks – Watches movement of<br />

data in and out of the CPU or memory.<br />

– It is difficult to retrieve an array element in a<br />

time that is not dependent on the index value.<br />

• Power Attacks – Watches power<br />

consumption by CPU or memory.<br />

– Changing one bit requires considerably less<br />

power than changing all bits in a byte.


Attack Precautions<br />

• Avoid use of arrays. Compute values in<br />

SBOX and rCon.<br />

• Design algorithms and devices to work<br />

with constant time intervals. (independent<br />

of key and plaintext.)<br />

– Hidden CPU timing data is a threat.<br />

• Use same memory throughout, Cache is<br />

faster than DRAM<br />

• Compute Key Expansion on the fly.<br />

• Utilize pipelining to stabilize CPU power<br />

consumption.


Joan Daemen & Vincent Rijmen’s<br />

<strong>AES</strong> Selling Points<br />

• Extremely fast compared to other block<br />

ciphers. (tradeoff between size and speed)<br />

• The round transformation is parallel by<br />

design. Important in dedicated hardware.<br />

• Amenable to pipelining<br />

• The cipher does not use arithmetic<br />

operations so has no bias towards big or<br />

little endian architectures.


Joan Daemen & Vincent Rijmen’s<br />

<strong>AES</strong> Selling Points


Joan Daemen & Vincent Rijmen’s<br />

<strong>AES</strong> Limitations<br />

• The inverse cipher is less suited to smart<br />

cards, as it takes more codes and cycles.<br />

• The cipher and inverse cipher make use of<br />

different codes and/or tables.<br />

• In hardware, The inverse cipher can only<br />

partially re-use circuitry which implements<br />

the cipher.


References<br />

About <strong>AES</strong><br />

<strong>AES</strong> Proposal : Rijndael<br />

Joan Daemen, Vincent Rijmen,<br />

2nd version of document to NIST<br />

Polynomials in the Nations Service: Using Algebra to Design the<br />

Advanced Encryption Standard Susan Landau<br />

The Mathmatical Association of America,<br />

Monthly 111 Feb 2004 Page(s):89-117<br />

Selecting the Advanced Encryption Standard Burr, W.E.;<br />

Security & Privacy Magazine, IEEE<br />

Volume 1, Issue 2, Mar-Apr 2003 Page(s):43 - 52<br />

Title: Introduction to Cryptography<br />

Author: Johannes A Buchman<br />

Publisher: Springer; 2 edition (July 13, 2004)


References<br />

Security and Attacking <strong>AES</strong><br />

Power-analysis attack on an ASIC <strong>AES</strong> implementation<br />

Ors, S.B.; Gurkaynak, F.; Oswald, E.; Preneel, B.;Information Technology:<br />

Coding and Computing, 2004. Proceedings. ITCC 2004. International<br />

Conference onVolume 2, 2004 Page(s):546 - 552 Vol.2<br />

Algebraic attacks on cipher systems<br />

Penzhorn, W.T.;<br />

AFRICON, 2004. 7th AFRICON Conference in Africa<br />

Volume 2, 2004 Page(s):969 - 974 Vol.2<br />

Cache-Timing attacks on <strong>AES</strong> Daniel J Bernstein<br />

Preliminary version of report to National Science Foundation, grant CCR-<br />

9983950


Applications / Implementations: <strong>AES</strong><br />

References<br />

A high throughput low cost <strong>AES</strong> processor<br />

Chih-Pin Su; Tsung-Fu Lin; Chih-Tsiun Huang; Cheng-Wen Wu;<br />

Communications Magazine, IEEE<br />

Volume 41, Issue 12, Dec. 2003 Page(s):86 - 91<br />

An efficient FPGA implementation of advanced encryption standard<br />

algorithm<br />

Shuenn-Shyang Wang; Wan-Sheng Ni;<br />

Circuits and Systems, 2004. ISCAS '04.<br />

Volume 2, 23-26 May 2004 Page(s):II - 597-600 Vol.2<br />

High-speed VLSI architectures for the <strong>AES</strong> algorithm<br />

Xinmiao Zhang; Parhi, K.K.;<br />

Very Large Scale Integration (VLSI) Systems<br />

Volume 12, Issue 9, Sept. 2004 Page(s):957 – 967<br />

Fast implementation of <strong>AES</strong> cryptographic algorithms in smart cards<br />

Chi-Feng Lu; Yan-Shun Kao; Hsia-Ling Chiang; Chung-Huang Yang;<br />

Security Technology, 2003.<br />

14-16 Oct. 2003 Page(s):573 - 579


References<br />

Applications / Implementations : <strong>AES</strong><br />

A new VLSI implementation of the <strong>AES</strong> algorithm<br />

Liang Deng; Hongyi Chen;<br />

Communications, Circuits and Systems and West Sino Expositions, IEEE<br />

2002 International Conference on<br />

Volume 2, 29 June-1 July 2002 Page(s):1500 - 1504 vol.2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!