CS 166: Information Security
- Prof. Tom Austin
Symmetric Key Crypto, Part 2 Prof. Tom Austin San Jos State - - PowerPoint PPT Presentation
CS 166: Information Security Symmetric Key Crypto, Part 2 Prof. Tom Austin San Jos State University REVIEW: A5/1 lab X x 0 x 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x 12 x 13 x 14 x 15 x 16 x 17 x 18 Y y 0 y 1 y 2 y 3 y 4 y 5 y
y0 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 y17 y18 y19 y20 y21 z0 z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13 z14 z15 z16 z17 z18 z19 z20 z21 z22
X Y Z
Å Å Å Å
x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18
– ByteSub (nonlinear layer) – ShiftRow (linear mixing layer) – MixColumn (nonlinear layer) – AddRoundKey (key addition layer)
– details next slide
1. a nonlinear (but invertible) composition of 2 math operations; or 2. a lookup table
a00 a01 a02 a03 a10 a11 a12 a13 a20 a21 a22 a23 a30 a31 a32 a33 b0 b0
1
b0
2
b0
3
b1 b1
1
b1
2
b1
3
b2 b2
1
b2
2
b2
3
b3 b3
1
b3
2
b3
3
ByteSub
First 4 bits of input Last 4 bits of input
a0 a0
1
a0
2
a0
3
a1 a1
1
a1
2
a1
3
a2 a2
1
a2
2
a2
3
a3 a3
1
a3
2
a3
3
a0 a0
1
a0
2
a0
3
a1
1
a1
2
a1
3
a1 a2
2
a2
3
a2 a2
1
a3
3
a3 a3
1
a3
2
ShiftRow
a0i a1i a2i a3i b0i b1i b2i b3i MixColumn
for 1 = 0, 1, 2, 3
Ri = Li-1 Å Ki Li = Ri-1 Å F(Li-1 Å Ki)
– Each S-box maps 8 bits to 32 bits
– S-boxes determined by the key
– Block size – Key size – Number of rounds
– Unusual for algorithm to depend on plaintext
[Jacob Appelbaum 2014]
(K[0],K[1],K[2],K[3]) = 128 bit key (L,R) = plaintext (64-bit block) delta = 0x9e3779b9 sum = 0 for i = 1 to 32 sum += delta L += ((R<<4)+K[0])^(R+sum)^((R>>5)+K[1]) R += ((L<<4)+K[2])^(L+sum)^((L>>5)+K[3]) next i ciphertext = (L,R)
(K[0],K[1],K[2],K[3]) = 128 bit key (L,R) = ciphertext (64-bit block) delta = 0x9e3779b9 sum = delta << 5 for i = 1 to 32 R -= ((L<<4)+K[2])^(L+sum)^((L>>5)+K[3]) L -= ((R<<4)+K[0])^(R+sum)^((R>>5)+K[1]) sum -= delta next i plaintext = (L,R)
– As bad as (or worse than) a one-time pad!
– That is, can we “chain” the blocks together?
– We won’t discuss this issue
– Encrypt each block independently – Most obvious, but has a serious weakness
– Chain the blocks together – More secure than ECB, virtually no extra work
– Block ciphers acts like a stream cipher – Popular for random access
Encrypt Decrypt C0 = E(P0, K) P0 = D(C0, K) C1 = E(P1, K) P1 = D(C1, K) C2 = E(P2, K) … P2 = D(C2, K) …
– With a different codebook for each key
C0 = E(IV Å P0, K), P0 = IV Å D(C0, K), C1 = E(C0 Å P1, K), P1 = C0 Å D(C1, K), C2 = E(C1 Å P2, K),… P2 = C1 Å D(C2, K),…
C0 = E(IV Å P0, K), C1 = E(C0 Å P1, K), C2 = E(C1 Å P2, K),… CN-1 = E(CN-2 Å PN-1, K) = MAC
C0 = E(IVÅP0,K), C1 = E(C0ÅP1,K), C2 = E(C1ÅP2,K), C3 = E(C2ÅP3,K) = MAC
C0 = E(IVÅP0,K), C1 = E(C0ÅX,K), C2 = E(C1ÅP2,K), C3 = E(C2ÅP3,K) = MAC' ¹ MAC
– Send last encrypted block (MAC) twice? – This cannot add any security!
– But, twice as much work as encryption alone – Can do a little better – about 1.5 “encryptions”