13. SPN構造の概要
Substitution
非線形関数で乱雑化
小さい単位(バイト)ごとに処理することが多い
置換テーブル(S-box)が利用されることが多い
Permutation
全体をシャッフルして影響を広範化
ブロック全体に対する処理
Input
S S S S S S S S
Permutation
13
14. SPN構造の概要
Substitution
非線形関数で乱雑化
小さい単位(バイト)ごとに処理することが多い
置換テーブル(S-box)が利用されることが多い
Permutation
全体をシャッフルして影響を広範化
ブロック全体に対する処理
S S S S S S S S
Permutation
1byteの違いが
全体に影響
14
17. AESの構造 (1ラウンド)
Input
Key (K) (expanded)
Output
S S S S S S S S
MixColumns
1 AddRoundKey
2 SubBytes
ShiftRows 3 ShiftRows
4 MixColumns
17
18. AESの構造 (1ラウンド)
Input
Key (K) (expanded)
Output
S S S S S S S S
MixColumns
1 AddRoundKey
2 SubBytes
→ Substitution
ShiftRows 3 ShiftRows
→ Permutation
4 MixColumns
→ Permutation
Permutation
18
19. AESの全体概観
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
平文
暗号文
19
20. AESの全体概観
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
平文
暗号文
AESを書くのはしんどい
20
27. Subme Step1
Input
Key (K)
Output
S S S S S S S S
Permutation
1-2 S-box変換
=Substitution
1-3 置換テーブル変換
=Permutation
1-1 入力に鍵の値をXoR
=AddRoundKey
27
28. Subme Step2
Input
Key (K)
Output
S S S S S S S S
Permutation
1-2 S-box変換
=Substitution
1-3 置換テーブル変換
=Permutation
1-1 入力に鍵の値をXoR
=AddRoundKey
Step2はStep1と同じ処理
28
30. Subme 全体概観
Output
S S S S S S S S
Permutation
S S S S S S S S
Permutation
+
平文
暗号文
30
31. [再掲] AESの全体概観
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
平文
暗号文
31
32. 比較
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
Permutation
S S S S S S S S
Permutation
AES subme
32
33. 比較
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
ShiftRowsPermutation
S S S S S S S S
Permutation
S S S S S S S S
Permutation
AES subme
Submeは解けそうな気がする!
33
37. Submeの相関を見ていこう
S S S S S S S S
Permutation
S S S S S S S S
Permutation
+
平文
暗号文
Stepごとに相関を見ていく
37
38. 定義
Output
S S S S S S S S
Permutation
S S S S S S S S
Permutation
+
平文
暗号文
K1
K2
K3
C11
C12
C13
C21
C22
C23
C31
C=C33
38
39. Submeの相関(Step 1)
Input
Key (K)
Output
S S S S S S S S
Permutation
1-2 S-box変換
=Substitution
1-3 置換テーブル変換
=Permutation
1-1 入力に鍵の値をXoR
=AddRoundKey
C11
C12
C13
39
40. Submeの相関(Step 1)
Input
Output
S S S S S S S S
Permutation
Key (K)
C11に1byte差分を与える
Key (K)
Permutationで攪拌も
8bitにしか影響しない
Key (K)
S-boxで非線形変換されるが
他のbyteに影響はしない
C11
C12
C13
40
41. Submeの相関(Step1)
S S S S S S S S
Permutation
S S S S S S S S
Permutation
Perm(S(A)) Perm(S(A+⊿))
diff
A
A + ⊿
B
41
44. 攻撃原理 (Step1)
差分⊿を決定
あるC11ペア(A, A+⊿)を決定し差分パターンBを取得
44
S S S S S S S S
Permutation
S S S S S S S S
Permutation
C11[0] = A C11[0] = A + ⊿
K
diff
B
45. 攻撃原理 (Step1)
S S S S S S S S
Permutation
S S S S S S S S
Permutation
下記の平文を入力(σは{0,..,255}の任意の値)
K
45
P[0] = A+σ P[0] = A+⊿+σ
46. 攻撃原理 (Step1)
S S S S S S S S
Permutation
S S S S S S S S
Permutation
σ ≠ K[0]のとき:とくになし
K
46
P[0] = A+σ P[0] = A+⊿+σ
A + σ + K[0] A + ⊿ +σ + K[0]
47. 攻撃原理 (Step1)
S S S S S S S S
Permutation
S S S S S S S S
Permutation
σ = K[0]のとき:パターンが出る!
K
47
P[0] = A+σ P[0] = A+⊿+σ
A + K[0] + K[0] = A
A + ⊿ + K[0] + K[0]
= A + ⊿
48. 攻撃原理 (Step1)
S S S S S S S S
Permutation
S S S S S S S S
Permutation
σ = K[0]のとき:パターンが出る!
K
48
P[0] = A+σ P[0] = A+⊿+σ
A + K[0] + K[0] = A
A + ⊿ + K[0] + K[0]
= A + ⊿
暗号文に特定の差分パターンBが出た際の
平文の差分σの値が鍵の1バイトと推測可能!
49. 現実はstepは2回ある
S S S S S S S S
Permutation
S S S S S S S S
Permutation
1byte目に差分
Step1終了時に
8bit差分
Step2終了時に
全体に広がる
単に入力差分を与えるだけでは
Step2終了時に
全体に攪拌される
→ 解析しづらい
Step1の手法は
この時点の出力が
得られることが前提
49
50. 現実はstepは2回ある
S S S S S S S S
Permutation
S S S S S S S S
Permutation
1byte目に差分
Step1終了時に
8bit差分
Step2終了時に
全体に広がる
単に入力差分を与えるだけでは
Step2終了時に
全体に攪拌される
→ 解析しづらい
Step1の手法は
この時点の出力が
得られるこあと前提
50
Stepを2回実施することで
対策済み?
51. 方針
問題点
1回のStepだけなら鍵の推測が可能
2回のStep実施で鍵の推測が困難に
51
S S S S S S S S
Permutation
S S S S S S S S
Permutation
Step2への入力が
様々なbyteに広がる
ことが問題
52. 方針
問題点
1回のStepだけなら鍵の推測が可能
2回のStep実施で鍵の推測が困難に
考察
Step1の出力が広がらなければ
Step2の出力はStep1と同等に
52
S S S S S S S S
Permutation
S S S S S S S S
Permutation
都合のよい処理
をするStep1
Step1の出力が
1byteにしか
広がらなければ
Step2の出力が
先のStep1と同等に
53. 方針
問題点
1回のStepだけなら鍵の推測が可能
2回のStep実施で鍵の推測が困難に
考察
Step1の出力が広がらなければ
Step2の出力はStep1と同等に
53
S S S S S S S S
Permutation
全体に
広がってしまう…。
入力差分を
1bitにしてみる
S S S S S S S S
Permutation
S-boxが
byte-to-byte変換
54. 方針
問題点
1回のStepだけなら鍵の推測が可能
2回のStep実施で鍵の推測が困難に
考察
Step1の出力が広がらなければ
Step2の出力はStep1と同等に
54
S S S S S S S S
Permutation
全体に
広がってしまう…。
入力差分を
1bitにしてみる
S S S S S S S S
Permutation
S-boxが
byte-to-byte変換
ここじゃね?
55. 方針
問題点
1回のStepだけなら鍵の推測が可能
2回のStep実施で鍵の推測が困難に
考察
Step1の出力が広がらなければ
Step2の出力はStep1と同等に
55
S S S S S S S S
Permutation
鍵が解読できる
パターンが出力!
ここの差分が
1bitであれば
S S S S S S S S
Permutation
Permutationでは
影響範囲は広がらない
56. 方針
問題点
1回のStepだけなら鍵の推測が可能
2回のStep実施で鍵の推測が困難に
考察
Step1の出力が広がらなければ
Step2の出力はStep1と同等に
56
S S S S S S S S
Permutation
鍵が解読できる
パターンが出力!
ここの差分が
1bitであれば
S S S S S S S S
Permutation
Permutationでは
影響範囲は広がらない
とは言っても
直接内部状態は
いじれない
57. 方針
問題点
1回のStepだけなら鍵の推測が可能
2回のStep実施で鍵の推測が困難に
考察
Step1の出力が広がらなければ
Step2の出力はStep1と同等に
方針
S-boxを1回通過後に1bit差分を
生み出す平文ペアを入力
特定の出力が出る差分を探索
57
S S S S S S S S
Permutation
S S S S S S S S
Permutation
S-box通過後に1bit差分を生み
出すような平文ペアを入力
特定の出力
差分パターンをゲット!
58. 平文の作り方
S S S S S S S S
Permutation
S S S S S S S S
Permutation
実際に差分がある状態から逆算
K
58
C12[0] = D C12’[0] = D+1
59. 平文の作り方
S S S S S S S S
Permutation
S S S S S S S S
Permutation
実際に差分がある状態から逆算
K
59
C12[0] = D C12’[0] = D+1
C11[0] = inv_S[D] C12’[0] = inv_S[D+1]
60. 平文の作り方
S S S S S S S S
Permutation
S S S S S S S S
Permutation
実際に差分がある状態から逆算
K
60
C12[0] = D C12’[0] = D+1
C11[0] = inv_S[D] C12’[0] = inv_S[D+1]
P[0] = inv_S[D]+σ P’[0] = inv_S[D+1]+σ
61. 平文の作り方
S S S S S S S S
Permutation
S S S S S S S S
Permutation
実際に差分がある状態から逆算
K
61
C12[0] = D C12’[0] = D+ 1
C11[0] = inv_S[D] C12’[0] = inv_S[D+1]
P[0] = inv_S[D]+σ P’[0] = inv_S[D+1]+σ
σ=K[0]のとき暗号文に
特定の差分パターンBが出力
σの値が鍵の1バイトと推測可能!
62. K1, K2の鍵が解読可能?
S S S S S S S S
Permutation
S S S S S S S S
Permutation
1) 順次試していく
ことでK1が解読
62
2)ここで同様の手順
を実施することで
K2が解読
63. K1, K2の鍵が解読可能?
S S S S S S S S
Permutation
S S S S S S S S
Permutation
1) 順次試していく
ことでK1が解読
63
2)ここで同様の手順
を実施することで
K2が解読
なんか忘れてない?