41761fdc |
1 | \xcalways\section{Symmetric encryption}\x |
2 | |
3 | \xcalways\subsection{Syntax}\x |
4 | |
5 | \begin{slide} |
6 | \head{Symmetric encryption syntax} |
7 | |
8 | A \emph{symmetric encryption scheme} $\mathcal{E} = (E, D)$ is a set of |
9 | keys $\keys\mathcal{E}$ (usually $\{0, 1\}^k$ for some integer $k$) and |
10 | pair of algorithms: |
11 | \begin{itemize} |
12 | \item an \emph{encryption} algorithm $E\colon \keys\mathcal{E} \times \{0, |
13 | 1\}^* \to \{0, 1\}^*$; and |
14 | \item a \emph{decryption} algorithm $D\colon \keys\mathcal{E} \times \{0, |
15 | 1\}^* \to \{0, 1\}^*$. |
16 | \end{itemize} |
17 | We also have a \emph{correctness} requirement: for any $K \in |
18 | \keys\mathcal{E}$, and any plaintext $x$, if $E(K, x)$ returns $y$ then |
19 | $D(K, y)$ returns $x$. |
20 | |
21 | We write $E_K(\cdot)$ rather than $E(K, \cdot)$, and $D_K(\cdot)$ rather |
22 | than $D(K, \cdot)$. |
23 | \end{slide} |
24 | |
25 | \xcalways\subsection{Security notions}\x |
26 | |
27 | \begin{slide} |
28 | \head{Symmetric encryption security notions} |
29 | |
30 | In symmetric scheme, an adversary who doesn't know the key can't encrypt |
31 | data for itself. To modify our security notions by providing the adversary |
32 | with an encryption oracle. |
33 | |
34 | We consider semantic security, indistinguishability and non-malleability, |
35 | against chosen-plaintext and chosen-ciphertext attacks. To make life more |
36 | complicated, we have three different indistinguishability notions. |
37 | |
53aa10b5 |
38 | We use the same notation to describe the decryption oracles provided in |
41761fdc |
39 | various types of attacks: |
40 | \begin{tabular}[C]{l Mc Mc } |
41 | \hlx*{hv} |
42 | Attack & D_0(c) & D_1(c) \\ \hlx{vhv} |
43 | CPA & \bot & \bot \\ |
44 | CCA1 & D_K(c) & \bot \\ |
45 | CCA2 & D_K(c) & D_K(c) \\ \hlx*{vh} |
46 | \end{tabular} |
47 | \end{slide} |
48 | |
49 | \begin{slide} |
50 | \topic{semantic security} |
51 | \head{Semantic security} |
52 | |
53 | The semantic security game is as for the asymmetric case, except for the |
54 | presence of encryption oracles. |
55 | |
56 | \begin{program} |
57 | Experiment $\Expt{sem-\id{atk}-$b$}{\mathcal{E}}(A)$: \+ \\ |
58 | $K \getsr \keys\mathcal{E}$; \\ |
59 | $(\mathcal{M}, s) \gets A^{E_K(\cdot), D_0(\cdot)} |
60 | (\cookie{select})$; \\ |
61 | $x_0 \getsr \mathcal{M}$; $x_1 \getsr \mathcal{M}$; \\ |
62 | $y \gets E_K(x_1)$; \\ |
63 | $(f, \alpha) \gets A^{E_K(\cdot), D_1(\cdot)} |
64 | (\cookie{predict}, y, s)$; \\ |
65 | \IF $f(x_b) = \alpha$ \THEN \RETURN $1$; \\ |
66 | \ELSE \RETURN $0$; |
67 | \end{program} |
68 | The distribution $\mathcal{M}$ must be \emph{valid}: all strings in |
69 | $\supp\mathcal{M}$ must have the same length. |
70 | \end{slide} |
71 | |
72 | \begin{slide} |
73 | \topic{find-then-guess} |
74 | \head{Find-then-guess indistinguishability} |
75 | |
76 | The `find-then-guess' (FTG) game corresponds to the standard public-key |
77 | indistinguishability notion. |
78 | \begin{program} |
79 | Experiment $\Expt{ftg-\id{atk}-$b$}{\mathcal{E}}(A)$: \+ \\ |
80 | $K \getsr \keys\mathcal{E}$; \\ |
81 | $(x_0, x_1, s) \gets A^{E_K(\cdot), D_0(\cdot)}(\cookie{find})$; \\ |
82 | \IF $|x_0| \ne |x_1|$ \THEN \RETURN $0$; \\ |
83 | $y \gets E_K(x_b)$; \\ |
84 | $b' \gets A^{E_K(\cdot), D_1(\cdot)}(\cookie{guess}, y, s)$; \\ |
85 | \RETURN $b'$; |
86 | \end{program} |
87 | \end{slide} |
88 | |
89 | \begin{slide} |
90 | \topic{left-or-right} |
91 | \head{Left-or-right indistinguishability} |
92 | |
93 | The `left-or-right' (LOR) notion is a natural extension of find-then-guess. |
94 | Rather than having to guess the hidden bit using a single challenge |
95 | ciphertext, the adversary is allowed to request more as it likes. It is |
96 | given an encryption oracle which accepts two arguments: it selects either |
97 | the left or the right plaintext, according to the hidden bit, and returns |
98 | the ciphertext. |
99 | \begin{program} |
100 | Experiment $\Expt{lor-\id{atk}-$b$}{\mathcal{E}}(A)$; \+ \\ |
101 | $K \getsr \keys\mathcal{E}$; \\ |
102 | $b' \gets A^{E_K(\id{lr}_b(\cdot, \cdot)), D_1(\cdot)}$; \\ |
103 | \RETURN $b'$; \- \\[\smallskipamount] |
104 | Function $\id{lr}_b(x_0, x_1)$: \+ \\ |
105 | \RETURN $x_b$; |
106 | \end{program} |
107 | Note that, because the adversary only runs in one stage, we can only |
108 | consider chosen-plaintext and adaptive chosen-ciphertext attacks. |
109 | \end{slide} |
110 | |
111 | \begin{slide} |
112 | \topic{real-or-random} |
113 | \head{Real-or-random indistinguishability} |
114 | |
115 | The `real-or-random' (ROR) notion is somewhat less natural, but turns out |
116 | to be useful for analysing block cipher encryption modes. |
117 | |
118 | The adversary is given an oracle which, when given a plaintext $x$, either |
119 | returns an encryption of $x$ or an encryption of a random string with the |
120 | same length as $x$. |
121 | \begin{program} |
122 | Experiment $\Expt{ror-\id{atk}-$0$}{\mathcal{E}}(A)$; \+ \\ |
123 | $K \getsr \keys\mathcal{E}$; \\ |
124 | $b' \gets A^{E_K(\id{rand}(\cdot)), D_1(\cdot)}$; \\ |
125 | \RETURN $b'$; \- \\[\smallskipamount] |
126 | Function $\id{rand}(x)$: \+ \\ |
127 | $x' \getsr \{0, 1\}^{|x|}$; \\ |
128 | \RETURN $x'$; |
129 | \next |
130 | Experiment $\Expt{ror-\id{atk}-$1$}{\mathcal{E}}(A)$; \+ \\ |
131 | $K \getsr \keys\mathcal{E}$; \\ |
132 | $b' \gets A^{E_K(\cdot), D_1(\cdot)}$; \\ |
133 | \RETURN $b'$; |
134 | \end{program} |
135 | Again, only chosen-plaintext and adaptive chosen-ciphertext attacks are |
136 | applicable. |
137 | \end{slide} |
138 | |
139 | \begin{slide} |
140 | \topic{relations between notions} |
141 | \head{Relations between notions \cite{Bellare:2000:CST}} |
142 | |
143 | \[ \xymatrix @=2cm { |
144 | \txt{LOR} \ar@<0.5ex>[r]^1 \ar@<-0.5ex>[d]_3 & |
145 | \txt{ROR} \ar@<0.5ex>[l]^2 \\ |
146 | \txt{FTG} \ar@{-->}@<-0.5ex>[u]_4 \ar@<0.5ex>[r] & |
147 | \txt{SEM} \ar@<0.5ex>[l] |
148 | } \] |
149 | \begin{list}{}{ |
150 | \settowidth{\labelwidth}{\textbf{Key}} |
151 | \leftmargin\labelwidth\advance\leftmargin\labelsep |
152 | \itemindent0pt\let\makelabel\textbf} |
153 | \item[Key] \begin{itemize} |
154 | \item A solid arrow $\xy\ar*+{A};<1.5cm, 0cm>*+{B}\endxy$ indicates an |
155 | \emph{security-preserving} reduction: if a scheme is secure in notion |
156 | $A$ then it is as secure in notion $B$, to within a small constant |
157 | factor. |
158 | \item A broken arrow $\xy\ar@{-->}*+{A};<1.5cm, 0cm>*+{B}\endxy$ |
159 | indicates a non-security-preserving reduction. |
160 | \item The numbers refer to sections of the proof provided in the notes. |
161 | \end{itemize} |
162 | \end{list} |
163 | \end{slide} |
164 | |
165 | \begin{proof} |
166 | We deal with the propositions one at a time. Most of them are pretty easy, |
167 | with the exception of the security-losing reduction from FTG to LOR. |
168 | \begin{enumerate} |
169 | |
170 | \item We show that $\text{LOR-\id{atk}} \implies \text{ROR-\id{atk}}$. |
171 | Suppose $A'$ attacks $\mathcal{E}$ in the real-or-random sense. |
172 | \begin{program} |
173 | Adversary $A^{E(\cdot, \cdot), D(\cdot)}$: \+ \\ |
174 | \RETURN $A'^{\id{ror-hack}(\cdot), D(\cdot)}$; \-\\[\smallskipamount] |
175 | Oracle $\id{ror-hack}(x)$: \+ \\ |
176 | $x' \getsr \{0, 1\}^{|x|}$; \\ |
177 | \RETURN $E(x', x)$; |
178 | \end{program} |
179 | Since this provides a perfect simulation of the ROR game, |
180 | \[ \Adv{lor-\id{atk}}{\mathcal{E}}(A) = |
181 | \Adv{ror-\id{atk}}{\mathcal{E}}(A'), \]% |
182 | and hence |
183 | \[ \InSec{ror-\id{atk}}(\mathcal{E}; t, q_E, q_D) \le |
184 | \InSec{lor-\id{atk}}(\mathcal{E}; t, q_E, q_D). \]% |
185 | |
186 | \item We show that $\text{ROR-\id{atk}} \implies \text{LOR-\id{atk}}$. |
187 | Suppose $A'$ attacks $\mathcal{E}$ in the left-or-right sense. |
188 | \begin{program} |
189 | Adversary $A^{E(\cdot), D(\cdot)}$: \+ \\ |
190 | $\hat{b} \gets \{0, 1\}$; \\ |
191 | $b' \gets A'^{\id{lor-hack}(\cdot, \cdot), D(\cdot)}$; \\ |
192 | \IF $b' = \hat{b}$ \THEN \RETURN $1$; \\ |
193 | \ELSE \RETURN $0$; \- \\[\smallskipamount] |
194 | Oracle $\id{lor-hack}(x_0, x_1)$: \+ \\ |
195 | \RETURN $E(x_{\hat{b}})$; |
196 | \end{program} |
197 | If the ROR oracle is returning correct encryptions, then $A'$ will return |
198 | the correct bit $\hat{b}$ with probability |
199 | \[ \frac{\Adv{lor-\id{atk}}{\mathcal{E}}(A')}{2} + \frac{1}{2}; \] |
200 | if the ROR oracle is returning ciphertexts for random plaintexts, then |
201 | $A'$ is being given no information about $\hat{b}$, and hence guesses |
202 | correctly with probability exactly $\frac{1}{2}$. We conclude that |
203 | \[ \Adv{ror-\id{atk}}{\mathcal{E}}(A) = |
204 | \frac{1}{2}\Adv{lor-\id{atk}}{\mathcal{E}}(A'), \]% |
205 | and hence |
206 | \[ \InSec{lor-\id{atk}}(\mathcal{E}; t, q_E, q_D) \le |
207 | 2 \cdot \InSec{ror-\id{atk}}(\mathcal{E}; t, q_E, q_D). \]% |
208 | |
209 | \item We show that $\text{LOR-\id{atk}} \implies \text{FTG-\id{atk}}$. |
210 | Suppose $A'$ attacks $\mathcal{E}$ in the find-then-guess sense. We |
211 | assume, without loss of generality, that $A'$ never queries its |
212 | decryption oracle on ciphertexts it obtained from its encryption oracle. |
213 | \begin{program} |
214 | Adversary $A^{E(\cdot, \cdot), D(\cdot)}$: \+ \\ |
215 | $(x_0, x_1, s) \gets A'^{\id{encrypt}(\cdot), D(\cdot)} |
216 | (\cookie{find})$; \\ |
217 | $y \gets E(x_0, x_1)$; \\ |
218 | $b' \gets A'^{\id{encrypt}(\cdot), D(\cdot)} |
219 | (\cookie{guess}, y, s);$ \\ |
220 | \RETURN $b'$; \- \\[\smallskipamount] |
221 | Oracle $\id{encrypt}(x)$: \+ \\ |
222 | \RETURN $E(x, x)$; |
223 | \end{program} |
224 | Since this provides a perfect simulation of the FTG game, |
225 | \[ \Adv{lor-\id{atk}}{\mathcal{E}}(A) = |
226 | \Adv{ftg-\id{atk}}{\mathcal{E}}(A'), \]% |
227 | and hence |
228 | \[ \InSec{ftg-\id{atk}}(\mathcal{E}; t, q_E, q_D) \le |
229 | \InSec{lor-\id{atk}}(\mathcal{E}; t, q_E + 1, q_D). \]% |
230 | |
231 | \item We show that $\text{FTG-\id{atk}} \implies \text{LOR-\id{atk}}$, |
232 | though with a factor of $q_E$ loss of security. |
233 | |
234 | This proof is slightly more tricky than the others. Consider the |
235 | following `hybrid' games, defined for $0 \le i \le q_E$: |
236 | \begin{program} |
237 | Experiment $\Expt{hyb-$i$-\id{atk}-$b$}{\mathcal{E}}$: \+ \\ |
238 | $K \getsr \keys\mathcal{E}$; \\ |
239 | $j \gets 0$; \\ |
240 | $b' \gets A^{E(\id{lr-hack}_b(\cdot, \cdot)), D_1(\cdot)}$; \\ |
241 | \RETURN $b'$; \- \\[\smallskipamount] |
242 | \next |
243 | Function $\id{lr-hack}_b(x_0, x_1)$: \+ \\ |
244 | \IF $j < i$ \THEN $x \gets x_0$; \\ |
245 | \ELSE \IF $j > i$ \THEN $x \gets x_1$; \\ |
246 | \ELSE $x \gets x_b$; \\ |
247 | $j \gets j + 1$; \\ |
248 | \RETURN $E_K(x_b)$; |
249 | \end{program} |
250 | As usual, we define |
251 | \[ \Adv{hyb-$i$-\id{atk}}{\mathcal{E}}(A) = |
252 | \Pr[\Expt{hyb-$i$-\id{atk}-$1$}{\mathcal{E}} = 1] - |
253 | \Pr[\Expt{hyb-$i$-\id{atk}-$0$}{\mathcal{E}} = 1]. \]% |
254 | |
255 | Observe that we have the identities |
256 | \begin{eqnarray*}[rl] |
257 | \Expt{lor-\id{atk}-$0$}{\mathcal{E}} &\equiv |
258 | \Expt{hyb-$(q_E{-}1)$-\id{atk}-$0$}{\mathcal{E}} |
259 | \\ |
260 | \Expt{lor-\id{atk}-$1$}{\mathcal{E}} &\equiv |
261 | \Expt{hyb-$0$-\id{atk}-$1$}{\mathcal{E}} |
262 | \\ |
263 | \tabpause{and, for $0 \le i < q_E$,} |
264 | \Expt{hyb-$i$-\id{atk}-$0$}{\mathcal{E}} &\equiv |
265 | \Expt{hyb-$(i{+}1)$-\id{atk}-$1$}{\mathcal{E}}. |
266 | \end{eqnarray*} |
267 | Thus, |
268 | \begin{eqnarray*}[rclclc] |
269 | \Adv{lor-\id{atk}}{\mathcal{E}}(A) |
270 | &=& \Pr[\Expt{lor-\id{atk}-$1$}{\mathcal{E}}(A) = 1] &-& |
271 | \Pr[\Expt{lor-\id{atk}-$0$}{\mathcal{E}}(A) = 1] |
272 | \\* |
273 | &=& \Pr[\Expt{hyb-$0$-\id{atk}-$1$}{\mathcal{E}}(A) = 1] &-& |
274 | \Pr[\Expt{hyb-$(q_E{-}1)$-\id{atk}-$0$}{\mathcal{E}}(A) = 1] |
275 | \\ |
276 | &=& \Pr[\Expt{hyb-$0$-\id{atk}-$1$}{\mathcal{E}}(A) = 1] &-& |
277 | \Pr[\Expt{hyb-$0$-\id{atk}-$0$}{\mathcal{E}}(A) = 1] &+ \\* |
278 | & & \Pr[\Expt{hyb-$1$-\id{atk}-$1$}{\mathcal{E}}(A) = 1] &-& |
279 | \Pr[\Expt{hyb-$1$-\id{atk}-$0$}{\mathcal{E}}(A) = 1] &+ \\* |
280 | & & \multicolumn{1}{c}{\smash\vdots} &-& |
281 | \multicolumn{1}{c}{\smash\vdots} &+ \\* |
282 | & & \Pr[\Expt{hyb-$(q_E{-}1)$-\id{atk}-$1$}{\mathcal{E}}(A) = 1] &-& |
283 | \Pr[\Expt{hyb-$(q_E{-}1)$-\id{atk}-$0$}{\mathcal{E}}(A) = 1] |
284 | \\* |
285 | &=& \sum_{0\le i<q_E} \Adv{hyb-$i$-\id{atk}}{\mathcal{E}}(A) |
286 | \end{eqnarray*} |
287 | Now, there must be at least one $i$ for which |
288 | \[ \Adv{hyb-$i$-\id{atk}}{\mathcal{E}}(A) \ge |
289 | \frac{1}{q_E} \Adv{lor-\id{atk}}{\mathcal{E}}(A). \]% |
290 | |
291 | Suppose that $A'$ is an adversary attacking $\mathcal{E}$ in the LOR |
292 | sense. We can construct an FTG adversary $A$ for which |
293 | \[ \Adv{ftg-\id{atk}}{\mathcal{E}}(A) \ge |
294 | \frac{1}{q_E} \Adv{lor-\id{atk}}{\mathcal{E}}(A') \]% |
295 | as follows:\footnote{% |
296 | The expression of the FTG adversary requires control flow operations |
297 | which aren't easily expressed in the pseudocode language we've used so |
298 | far, hence the cop-out into English.} |
299 | \begin{enumerate} |
300 | \item When invoked in the $\cookie{find}$ stage, run the LOR adversary, |
301 | passing it $A$'s decryption oracle. |
302 | \item Respond to its first $i$ left-or-right queries $(x_0, x_1)$ with |
303 | $E(x_0)$. |
304 | \item On the $(i + 1)$-th left-or-right query, $(x_0, x_1)$, package up |
305 | all of $A'$'s state, and return that, together with the pair $(x_0, |
306 | x_1)$ as the result of $A$'s $\cookie{find}$ stage. |
307 | \item When reinvoked in the $\cookie{guess}$ stage, return the challenge |
308 | ciphertext $y$ as the result of $A'$'s $(i + 1)$-th query. |
309 | \item Respond to the remaining $q_E - i - 1$ left-or-right queries |
310 | $(x_0, x_1)$ with $E(x_1)$. |
311 | \item Return the bit output by $A'$. |
312 | \end{enumerate} |
313 | This evidently simulates the environment of |
314 | $\Expt{hyb-$i$-\id{atk}-$b$}{\mathcal{E}}(A')$; hence $A$ achieves the |
315 | claimed advantage. Thus, |
316 | \[ \InSec{lor-\id{atk}}(\mathcal{E}; t, q_E, q_D) \le |
317 | q_E \cdot \InSec{ftg-\id{atk}}(\mathcal{E}; t, q_E - 1, q_D). \]% |
318 | |
319 | Now we show that we can't obtain a better reduction. Suppose that |
320 | $\mathcal{E} = (E, D)$ is $(t, q_E, q_D, \epsilon)$-secure in the FTG |
53aa10b5 |
321 | sense. We construct a \emph{$p$-leaky} version, $\mathcal{E}' = (E', |
41761fdc |
322 | D')$. Let $\id{maybe}(p)$ denote a function which returns $1$ with |
323 | probability $p$. |
324 | \begin{program} |
325 | Algorithm $E'_K(x)$: \+ \\ |
326 | \IF $\id{maybe}(p) = 1$ \THEN \RETURN $1 \cat x$; \\ |
327 | \RETURN $0 \cat E_K(x)$; |
328 | \next |
329 | Algorithm $D'_K(y')$: \+ \\ |
330 | \PARSE $y'$ \AS $1\colon b, y$; \\ |
331 | \IF $b = 1$ \THEN \RETURN $y$; \\ |
332 | \RETURN $D_K(y)$; |
333 | \end{program} |
334 | A simple simulation argument shows that this scheme is still secure, |
335 | except for an additional term $p$, handling the case where the challenge |
336 | ciphertext $y^* = 1 \cat x^*$. It is easy to see that |
337 | \[ \InSec{lor-\id{atk}}(\mathcal{E}'; t, q_E, 0) \ge q_E p, \] |
338 | concluding the proof. |
339 | \end{enumerate} |
340 | |
341 | The proofs that $\text{FTG-\id{atk}} \implies \text{SEM-\id{atk}}$ and |
342 | $\text{SEM-\id{atk}} \implies \text{FTG-\id{atk}}$ are just as in the |
343 | public-key case (page~\pageref{pf:pub-ind-eq-sem}), except for the presence |
344 | of encryption oracles (which are passed on unmolested). And that's all we |
345 | need. |
346 | \end{proof} |
347 | |
348 | \begin{exercise} |
349 | Consider the following `ciphertext-or-random-string' security notion. |
350 | \begin{program} |
351 | Experiment $\Expt{cor-\id{atk}-$0$}{\mathcal{E}}(A)$: \+ \\ |
352 | $b' \gets A^{\id{rand}(E_K(\cdot)), D_1(\cdot)}$; \\ |
353 | \RETURN $b'$; \- \\[\smallskipamount] |
354 | Function $\id{rand}(x)$: \+ \\ |
355 | $x' \getsr \{0, 1\}^{|x|}$; \\ |
356 | \RETURN $x'$; |
357 | \next |
358 | Experiment $\Expt{cor-\id{atk}-$1$}{\mathcal{E}}(A)$; \+ \\ |
359 | $K \getsr \keys\mathcal{E}$; \\ |
360 | $b' \gets A^{E_K(\cdot), D_1(\cdot)}$; \\ |
361 | \RETURN $b'$; |
362 | \end{program} |
363 | Relate this notion to the others we've already seen. |
364 | \answer% |
365 | It's not hard to see that $\text{COR} \implies \text{LOR}$; the proof is |
366 | similar to $\text{ROR} \implies \text{LOR}$, and we have |
367 | $\InSec{cor-\id{atk}}(\mathcal{E}; t, q_E, q_D) \le 2\cdot |
368 | \InSec{lor-\id{atk}}(\mathcal{E}; t, q_E, q_D)$. On the other hand, |
369 | $\text{LOR} \not\implies \text{COR}$. To see this, let $\mathcal{E} = (E, |
370 | D)$ be an encryption scheme secure in the LOR-\id{atk} sense, and define |
371 | $\mathcal{E}' = (E', D')$ by $E'_K(x) = 0^n \cat E_K(x)$ and $D'_K(y') = |
372 | D_K(y)$ if $y' = 0^n \cat y$ for some $y$, or $\bot$ otherwise. Because |
373 | the fixed padding is independent of the plaintext, |
374 | $\InSec{lor-\id{atk}}(\mathcal{E}'; t, q_E, q_D) \le |
375 | \InSec{lor-\id{atk}}(\mathcal{E}; t, q_E, q_D)$. But $\mathcal{E}'$ is not |
376 | COR-CPA secure because an adversary can check for the fixed padding; hence |
377 | $\InSec{cor-cpa}(\mathcal{E}'; t, q_E, q_D) \ge 1 - q_E 2^{-n}$. |
378 | \end{exercise} |
379 | |
380 | \begin{exercise} |
381 | Let $F\colon \{0, 1\}^k \times \{0, 1\}^l \to \{0, 1\}^l$ be a PRF, and let |
382 | $g\colon \{0, 1\}^l \to \{0, 1\}^{2l}$ be a length-doubling PRG. Recall |
383 | from Exercise~\ref{ex:dbl-prg} the construction $g^(i)$, defined by |
384 | \[ g^{(1)}(x) = g(x); \qquad |
385 | g^{(i+1)}(x) = g_0(x) \cat g^{(i)}(g_1(x)). \]% |
386 | We define an encryption scheme $\mathcal{E} = (E, D)$ as follows: |
387 | \begin{program} |
388 | Algorithm $E_K(x)$: \\ |
389 | $i \getsr \{0, 1\}^l$; \\ |
390 | $n \gets \bigl\lceil \frac{|x|}{L} \bigr\rceil - 1$; \\ |
391 | $s \gets F_K(i)$; \\ |
392 | $p \gets g^{(n)}(s)$; \\ |
393 | $y \gets i \cat (x \xor p)$; \\ |
394 | \RETURN $y$; |
395 | \next |
396 | Algorithm $D_K(y)$: \\ |
397 | \PARSE $y$ \AS $l\colon i, y'$; \\ |
398 | $n \gets \bigl\lceil \frac{|x|}{L} \bigr\rceil - 1$; \\ |
399 | $s \gets F_K(i)$; \\ |
400 | $p \gets g^{(n)}(s)$; \\ |
401 | $x \gets y' \xor p$; \\ |
402 | \RETURN $x$; |
403 | \end{program} |
404 | Prove that |
405 | \[ \InSec{lor-cpa}(\mathcal{E}; t, q, \mu) \le |
406 | 2 \cdot \InSec{prf}(F; t, q) + |
407 | 2 q \mu \cdot \InSec{prg}(g; t) + q(q - 1), \]% |
408 | where $\mu$ is the maximum value of $n$, as computed by $E_K(\cdot)$, for |
409 | any encryption query. |
410 | Hints: |
411 | \begin{parenum} |
412 | \item use a sequence of games, ending with one in which the `ciphertext' |
413 | are random strings of the right length; |
414 | \item attack the PRF first; |
415 | \item use a hybrid argument to attack the PRG, as was used in the proof |
416 | that $\text{FTG} \implies \text{LOR}$. |
417 | \end{parenum} |
418 | \answer% |
419 | For each game~$\G{i}$, $S_i$~is the event that the adversary guesses |
420 | correctly. Game~$\G0$ is the original attack game (with the hidden bit~$b$ |
421 | selected uniformly). Game~$\G1$ is the same, except that if, for any pair |
422 | of ciphertexts, the $i$-values are equal, the game ends immediately: the |
423 | standard collision bound shows that $|{\Pr[S_1]} - \Pr[S_0]| \le q(q - |
424 | 1)/2$. In game~$\G2$, rather than using $F_K$ to compute the seeds~$s$, we |
425 | just choose $s \in \{0, 1\}^l$ at random each time. Note that the |
426 | $i$-values are distinct; hence considering an adversary attacking $F$ as a |
427 | PRF, which simulates either $\G1$ or $\G2$ depending on whether its oracle |
428 | is an instance of~$F$ or a random function respectively, shows that |
429 | $|{\Pr[S_2]} - \Pr[S_1]| \le \InSec{prf}(F; t, q)$. |
430 | |
431 | In game~$\G3$, rather than using the PRG~$g^{(n)}$, we generate the strings |
432 | $p$ uniformly at random from $\{0, 1\}^{l(n+1)}$, and claim that |
433 | $|{\Pr[S_3]} - \Pr[S_2]| \le q \mu \cdot \InSec{prg}(g; t)$ (proven below). |
434 | Finally, in game~$\G4$, rather than computing the ciphertext as $i \cat (x |
435 | \xor p)$, we just generate a random string $\{0, 1\}^{l(n+2)}$. Since $i$ |
436 | and $p$ are uniform and random anyway, this doesn't affect the |
437 | distribution; it does show that the result is independent of the |
438 | adversary's ciphertext, however, so $\Pr[S_4] = \Pr[S_3] = \frac{1}{2}$. |
439 | Tying all of this together, $(\Adv{lor-cpa}{\mathcal{E}}(A) + 1)/2 \le |
440 | \frac{1}{2} + \InSec{prf}(F; t, q) + q\mu \cdot \InSec{prg}(g; t) + q(q - |
441 | 1)/2$. Multiplying through by~2 and rearranging yields the required |
442 | result. |
443 | |
444 | \def\H#1{\G[H]{#1}}% |
445 | We finally turn to the claim made earlier. In $\G2$, we use the PRG; in |
446 | $\G3$ we don't. We construct a number of hybrid games~$\H{i}$ for $0 \le i |
447 | \le q$ in which encryption query~$j$ (for $0 \le j < q$) is handled as |
448 | follows: if $0 \le j < i$ then the query is handled as in $\G3$; if $i \le |
449 | j < q$ then the query is handed as in $\G2$. Let $T_i$ be the event that |
450 | the adversary wins in game $\H{i}$. Clearly, $\H0 \equiv \G2$, and $\H{q} |
451 | \equiv \G3$. For each adjacent pair of hybrid games $\H{i}, \H{i+1}$ (for |
452 | $0 \le i < q$), we can bound $|{\Pr[T_{i+1}} - \Pr[T_i]|$ by considering an |
453 | adversary attacking~$g^{(n)}$ by running~$A$ and using its input as the XOR |
454 | mask~$p$ for query~$i$, and following the rules of game~$\H{i}$ for the |
455 | other queries: then if $y$~is random, it simulates $\H{i+1}$, whereas if |
456 | $y$ is the output of $g^{(n)}$ then it simulates $\H{i}$. Thus |
457 | $|{\Pr[T_{i+1}} - \Pr[T_i]| \le \mu \cdot \InSec{prg}(g; t)$ (by the answer |
458 | to \ref{ex:dbl-prg}), and $|{\Pr[S_3]} - \Pr[S_2]| = |{\Pr[T_{q-1}]} - |
459 | \Pr[T_0]| \le q \mu \cdot \InSec{prg}(g; t)$ as claimed. |
460 | \end{exercise} |
461 | |
462 | \xcalways\subsection{Block cipher modes}\x |
463 | |
464 | \begin{slide} |
465 | \head{Block cipher modes} |
466 | |
467 | Block ciphers (which we model as PRPs) are readily available components, |
468 | and we have good tools for analysing their (heuristic) security. It'd be |
469 | good if we could use them to construct secure encryption schemes. |
470 | |
471 | We analyse three standard \emph{modes of operation}: |
472 | \begin{description} |
473 | \item[Electronic Code Book (ECB)] Each plaintext block is encrypted |
474 | independently of the others, using the block cipher. |
475 | \item[Counter (CTR)] Choose a random starting point $i$. The plaintext |
476 | blocks are XORed with the result of encrypting the counter values $i$, |
477 | $i + 1$, \ldots |
478 | \item[Ciphertext Block Chaining (CBC)] The first plaintext block is XORed |
479 | with a random \emph{initialization vector} and encrypted using the block |
480 | cipher; thereafter, each plaintext block are XORed with the previous |
481 | ciphertext block and then encrypted with the block cipher. |
482 | \end{description} |
483 | \end{slide} |
484 | |
485 | \begin{slide} |
486 | \head{General notation} |
487 | |
488 | We consider pseudorandom permutations $E\colon \{0, 1\}^k \times \{0, 1\}^l |
489 | \to \{0, 1\}^l$ operating on $l$-bit blocks. We write $E_K(\cdot)$ rather |
490 | than $E(K, \cdot)$. |
491 | |
492 | For the sake of simplicity, we assume that plaintexts are a multiple of $l$ |
493 | bits in length. We shall consider chosen-plaintext attacks, and we shall |
494 | be quantifying our results in terms of: |
495 | \begin{itemize} |
496 | \item the running time $t$ of adversaries; |
497 | \item the number $q$ of queries made to the encryption oracle; and |
498 | \item the maximum size in bits $\mu$ of any individual encryption query. |
499 | \end{itemize} |
500 | |
501 | We shall write `\FOREACH $l\colon z$ \FROM $x$ \DO \ldots' to denote |
502 | iteration over each $l$-bit block $z$ of $x$ in turn. |
503 | |
504 | We use $\emptystring$ to denote the empty string. |
505 | \end{slide} |
506 | |
507 | \begin{slide} |
508 | \topic{ECB} |
53aa10b5 |
509 | \resetseq |
510 | \head{Electronic Code Book (ECB), \seq: description} |
41761fdc |
511 | |
512 | We define the scheme $\Xid{\mathcal{E}}{ECB}^E = (\Xid{E}{ECB}^E, |
513 | \Xid{D}{ECB}^E))$ by setting $\keys\Xid{\mathcal{E}}{ECB}^E = \{0, 1\}^k$ |
514 | and |
515 | \begin{program} |
516 | Algorithm $\Xid{E}{ECB}^E_K(x)$: \+ \\ |
517 | $y \gets \emptystring$; \\ |
518 | \FOREACH $l\colon z$ \FROM $x$ \DO \\ |
519 | \quad $y \gets y \cat E_K(z)$; \\ |
520 | \RETURN $y$; |
521 | \next |
522 | Algorithm $\Xid{D}{ECB}^E_K(y)$: \+ \\ |
523 | $x \gets \emptystring$; \\ |
524 | \FOREACH $l\colon z$ \FROM $y$ \DO \\ |
525 | \quad $x \gets x \cat E_K^{-1}(z)$; \\ |
526 | \RETURN $x$; |
527 | \end{program} |
528 | \end{slide} |
529 | |
530 | \begin{slide} |
34a3c16f |
531 | \head{Electronic Code Book (ECB), \seq: diagram} |
532 | |
533 | \vfil |
534 | \[ \begin{graph} |
535 | []!{0; <1cm, 0cm>: <0cm, 1.5cm>::} |
536 | *+=(1, 0)+[F]{\mathstrut x_0}="x" :[dd] *+[F]{E}="e" |
537 | :[dd] *+=(1, 0)+[F]{\mathstrut y_0} |
538 | "e" [l] {K} :"e" "x" [rrr] |
539 | *+=(1, 0)+[F]{\mathstrut x_1}="x" :[dd] *+[F]{E}="e" |
540 | :[dd] *+=(1, 0)+[F]{\mathstrut y_1} |
541 | "e" [l] {K} :"e" "x" [rrr] |
542 | *+=(1, 0)+[F--]{\mathstrut x_i}="x" :@{-->}[dd] *+[F]{E}="e" |
543 | :@{-->}[dd] *+=(1, 0)+[F--]{\mathstrut y_i} |
544 | "e" [l] {K} :@{-->}"e" "x" [rrr] |
545 | *+=(1, 0)+[F]{\mathstrut x_n}="x" :[dd] *+[F]{E}="e" |
546 | :[dd] *+=(1, 0)+[F]{\mathstrut y_n} |
547 | "e" [l] {K} :"e" "x" [rrr] |
548 | \end{graph} \] |
549 | \vfil |
550 | \end{slide} |
551 | |
552 | \begin{slide} |
53aa10b5 |
553 | \head{Electronic Code Book (ECB), \seq: analysis} |
41761fdc |
554 | |
555 | ECB fails to disguise equality of message blocks. Hence, it is insecure in |
556 | the left-or-right sense. |
557 | \begin{program} |
558 | Adversary $A^{E(\cdot, \cdot)}$: \+ \\ |
559 | $y \gets E(0^l \cat 1^l, 0^l \cat 0^l)$; \\ |
560 | \PARSE $y$ \AS $l\colon y_0, l\colon y_1$; \\ |
561 | \IF $y_0 = y_1$ \THEN \RETURN $1$; \\ |
562 | \ELSE \RETURN $0$; |
563 | \end{program} |
564 | Since $\Xid{\mathcal{E}}{ECB}^E$ always encrypts blocks independently, and |
565 | the block cipher $E$ is deterministic, $A$ always succeeds. Hence, |
566 | \[ \InSec{lor-cpa}(\Xid{\mathcal{E}}{ECB}^E; t, 1, 2 l) = 1 \] |
567 | for some small $t$ describing the running-time of the adversary $A$. |
568 | |
569 | According to our formal definitions, then, ECB mode is \emph{completely |
570 | insecure}. |
571 | \end{slide} |
572 | |
573 | \begin{slide} |
574 | \topic{stateful counter mode} |
53aa10b5 |
575 | \resetseq |
576 | \head{Counter (CTR), \seq: a stateful mode} |
41761fdc |
577 | |
578 | We define two schemes. Firstly, a stateful-sender scheme |
579 | $\Xid{\mathcal{E}}{CTRS}^E = (\Xid{E}{CTRS}^E, \Xid{D}{CTRS}^E))$. We set |
580 | $\keys\Xid{\mathcal{E}}{ECB}^E = \{0, 1\}^k$, initialize $i \gets 0$, and |
581 | define |
582 | \begin{program} |
583 | Algorithm $\Xid{E}{CTRS}^E_K(x)$: \+ \\ |
584 | $y \gets i$; \\ |
585 | \FOREACH $l\colon z$ \FROM $x$ \DO \\ \quad \= \+ \kill |
586 | $y \gets y \cat (z \xor E_K(i))$; \\ |
587 | $i \gets i + 1$; \- \\ |
588 | \RETURN $y$; |
589 | \next |
590 | Algorithm $\Xid{D}{CTRS}^E_K(y)$: \+ \\ |
591 | \PARSE $y$ \AS $l\colon i, y$; \\ |
592 | $x \gets \emptystring$; \\ |
593 | \FOREACH $l\colon z$ \FROM $y$ \DO \\ \quad \= \+ \kill |
594 | $x \gets x \cat (z \xor E_K(i))$; \\ |
595 | $i \gets i + 1$; \- \\ |
596 | \RETURN $x$; |
597 | \end{program} |
598 | \end{slide} |
599 | |
600 | \begin{slide} |
34a3c16f |
601 | \head{Counter (CTR), \seq: diagram} |
602 | |
603 | \vfil |
604 | \[ \begin{graph} |
605 | []!{0; <1cm, 0cm>: <0cm, 1.5cm>::} |
606 | *+=(1, 0)+[F]{\mathstrut x_0}="x" :[dd] *{\xor}="xor" |
607 | :[dd] *+=(1, 0)+[F]{\mathstrut y_0} |
608 | "xor" [l] *+[F]{E}="e" [u] {c} :"e" [d] {K} :"e" :"xor" "x" [rrr] |
609 | *+=(1, 0)+[F]{\mathstrut x_1}="x" :[dd] *{\xor}="xor" |
610 | :[dd] *+=(1, 0)+[F]{\mathstrut y_1} |
611 | "xor" [l] *+[F]{E}="e" [u] {c+1} :"e" [d] {K} :"e" :"xor" "x" [rrr] |
612 | *+=(1, 0)+[F--]{\mathstrut x_i}="x" :@{-->}[dd] *{\xor}="xor" |
613 | :@{-->}[dd] *+=(1, 0)+[F--]{\mathstrut y_i} |
614 | "xor" [l] *+[F]{E}="e" [u] {c+i} :@{-->}"e" [d] {K} :@{-->}"e" |
615 | :@{-->}"xor" "x" [rrr] |
616 | *+=(1, 0)+[F]{\mathstrut x_n}="x" :[dd] *{\xor}="xor" |
617 | :[dd] *+=(1, 0)+[F]{\mathstrut y_n} |
618 | "xor" [l] *+[F]{E}="e" [u] {c+n} :"e" [d] {K} :"e" :"xor" "x" [rrr] |
619 | \end{graph} \] |
620 | \vfil |
621 | \end{slide} |
622 | |
623 | \begin{slide} |
53aa10b5 |
624 | \head{Counter (CTR), \seq: analysis of the stateful version} |
41761fdc |
625 | |
626 | We write $q' = q\mu/l$ for the total number of blocks queried by the |
627 | adversary, and we restrict our attention to the case $n \le 2^l$. |
628 | |
629 | Firstly, suppose that, rather than a block cipher, we use a completely |
630 | random function $R \in \Func{l}{l}$. Then $E(0) \cat E(1) \cat \cdots$ is |
631 | a string of uniformly distributed and independent bits. Hence |
632 | \[ \InSec{lor-cpa}(\Xid{\mathcal{E}}{CTRS}^{\Func{l}{l}}; t, q, \mu) = 0 \] |
633 | for arbitrary $t$, and for $q \mu/l \le 2^l$. |
634 | |
635 | A simple reduction shows that, for a pseudorandom function $F$, we have |
636 | \[ \InSec{ror-cpa}(\Xid{\mathcal{E}}{CTRS}^F; t, q, \mu) \le |
637 | \InSec{prf}(F; t, q'), \]% |
638 | and hence, for a pseudorandom permutation $E$, |
639 | \[ \InSec{ror-cpa}(\Xid{\mathcal{E}}{CTRS}^E; t, q, \mu) \le |
640 | \InSec{prp}(E; t, q') + \frac{q'(q' - 1)}{2^{l+1}}. \]% |
641 | \end{slide} |
642 | |
643 | \begin{exercise} |
644 | Fill in the gaps in the above proof. |
645 | \answer% |
646 | The reduction from the PRF distinguisher to the counter-with-PRF scheme |
647 | works as follows. Let $A$ attack $\Xid{\mathcal{E}}{CTRS}^F$ in the ROR |
648 | sense; consider adversary $B^{F(\cdot)}$: \{ $b \gets |
649 | A^{\Xid{E}{CTRS}^F(\cdot)}$; \RETURN $b$;~\}. If $F(\cdot)$ is an instance |
650 | of the PRF then $B$ encrypts messages chosen by $A$ faithfully; if |
651 | $F(\cdot)$ is a random function then the ciphertexts $B$ returns consists |
652 | of a counter followed by a random string, which is therefore distributed |
653 | identically to a ciphertext of a \emph{random} plaintext. Thus, $B$ |
654 | simulates the real-or-random game perfectly. The result for a PRP follows |
655 | because $\InSec{prf}(F; t, q) \le \InSec{prp}(F; t, q) + q(q - 1) |
656 | 2^{-L-1}$. |
657 | \end{exercise} |
658 | |
659 | \begin{slide} |
660 | \topic{randomized counter mode} |
53aa10b5 |
661 | \head{Counter (CTR), \seq: a randomized mode} |
41761fdc |
662 | |
663 | The randomized scheme $\Xid{\mathcal{E}}{CTR$\$$}^E = (\Xid{E}{CTR$\$$}^E, |
664 | \Xid{D}{CTR$\$$}^E))$ differs from the stateful scheme in the encryption |
665 | algorithm only. We simply choose the starting value for the counter at |
666 | random, rather than remembering it. |
667 | \begin{program} |
668 | Algorithm $\Xid{E}{CTR$\$$}^E_K(x)$: \+ \\ |
669 | $i \getsr \{0, 1\}^l$; \\ |
670 | $y \gets i$; \\ |
671 | \FOREACH $l\colon z$ \FROM $x$ \DO \\ \quad \= \+ \kill |
672 | $y \gets y \cat (z \xor E_K(i))$; \\ |
673 | $i \gets i + 1$; \- \\ |
674 | \RETURN $y$; |
675 | \next |
676 | Algorithm $\Xid{D}{CTR$\$$}^E_K(y)$: \+ \\ |
677 | \PARSE $y$ \AS $l\colon i, y$; \\ |
678 | $x \gets \emptystring$; \\ |
679 | \FOREACH $l\colon z$ \FROM $y$ \DO \\ \quad \= \+ \kill |
680 | $x \gets x \cat (z \xor E_K(i))$; \\ |
681 | $i \gets i + 1$; \- \\ |
682 | \RETURN $x$; |
683 | \end{program} |
684 | \end{slide} |
685 | |
686 | \begin{slide} |
53aa10b5 |
687 | \head{Counter (CTR), \seq: analysis of the randomized version} |
41761fdc |
688 | |
689 | The randomized mode remains secure so long as a counter is never repeated. |
690 | This occurs with probability no greater than |
691 | \[ \frac{q\mu(q - 1)}{2^{l+1}}. \] |
692 | Hence, we have, for a pseudorandom function $F$, |
693 | \[ \InSec{ror-cpa}(\Xid{\mathcal{E}}{CTR$\$$}^F; t, q, \mu) \le |
694 | \InSec{prf}(F; t, q') + \frac{q\mu(q - 1)}{2^{l+1}}, \]% |
695 | and, for a pseudorandom permutation $E$, |
696 | \[ \InSec{ror-cpa}(\Xid{\mathcal{E}}{CTR$\$$}^E; t, q, \mu) \le |
697 | \InSec{prp}(E; t, q') + \frac{q'(q' - 1 + l(q - 1))}{2^{l+1}}. \]% |
698 | \end{slide} |
699 | |
700 | \begin{proof}[Proof of the collision bound] |
701 | Suppose all of the queries are maximum length. Then the probability that |
702 | two randomly started counter sequences overlap is $\mu\cdot 2^{-l}$. |
703 | Hence, an upper bound on the collision probability is given by |
704 | \begin{eqnarray*}[rl] |
705 | \Pr[\text{no collision}] &\le \frac{\mu}{2^l}(1 + 2 + \cdots + q - 1) \\ |
706 | &= \frac{\mu}{2^l} \frac{q(q - 1)}{2} \\ |
707 | &= \frac{q\mu(q - 1)}{2^{l+1}} |
708 | \end{eqnarray*} |
709 | as required. |
710 | \end{proof} |
711 | |
712 | \begin{slide} |
713 | \topic{CBC} |
53aa10b5 |
714 | \resetseq |
715 | \head{Ciphertext Block Chaining (CBC), \seq: description} |
41761fdc |
716 | |
717 | We define the scheme $\Xid{\mathcal{E}}{CBC}^E = (\Xid{E}{CBC}^E, |
718 | \Xid{D}{CBC}^E))$ by setting $\keys\Xid{\mathcal{E}}{CBC}^E = \{0, 1\}^k$ |
719 | and |
720 | \begin{program} |
721 | Algorithm $\Xid{E}{CBC}^E_K(x)$: \+ \\ |
722 | $i \getsr \{0, 1\}^l$; \\ |
723 | $y \gets i$; \\ |
724 | \FOREACH $l\colon z$ \FROM $x$ \DO \\ \quad \= \+ \kill |
725 | $i \gets E_K(z \xor i)$; \\ |
726 | $y \gets y \cat i$; \- \\ |
727 | \RETURN $y$; |
728 | \next |
729 | Algorithm $\Xid{D}{CBC}^E_K(y)$: \+ \\ |
730 | \PARSE $y$ \AS $l\colon i, y$; \\ |
731 | $x \gets \emptystring$; \\ |
732 | \FOREACH $l\colon z$ \FROM $y$ \DO \\ \quad \= \+ \kill |
733 | $x \gets x \cat (i \xor E_K^{-1}(z))$; \\ |
734 | $i \gets z$; \- \\ |
735 | \RETURN $x$; |
736 | \end{program} |
737 | \end{slide} |
738 | |
739 | \begin{slide} |
34a3c16f |
740 | \head{Ciphertext Block Chaining (CBC), \seq: diagram} |
741 | |
742 | \vfil |
743 | \[ \begin{graph} |
744 | []!{0; <1cm, 0cm>: <0cm, 1.5cm>::} |
745 | *+=(1, 0)+[F]{\mathstrut x_0}="x" |
746 | :[d] *{\xor}="xor" |
747 | [ll] *+=(1, 0)+[F]{I} :"xor" |
748 | :[d] *+[F]{E}="e" :[dd] *+=(1, 0)+[F]{\mathstrut y_0}="i" |
749 | "e" [l] {K} :"e" "i" |
750 | [rrruuuu] *+=(1, 0)+[F]{\mathstrut x_1}="x" |
751 | :[d] *{\xor}="xor" |
752 | "i" :`r [ru] `u "xor" "xor" |
753 | :[d] *+[F]{E}="e" :[dd] *+=(1, 0)+[F]{\mathstrut y_1}="i" |
754 | "e" [l] {K} :"e" "i" |
755 | [rrruuuu] *+=(1, 0)+[F--]{\mathstrut x_i}="x" |
756 | :@{-->}[d] *{\xor}="xor" |
757 | "i" :@{-->}`r [ru] `u "xor" "xor" |
758 | :@{-->}[d] *+[F]{E}="e" :@{-->}[dd] *+=(1, 0)+[F--]{\mathstrut y_i}="i" |
759 | "e" [l] {K} :@{-->}"e" "i" |
760 | [rrruuuu] *+=(1, 0)+[F]{\mathstrut x_n}="x" |
761 | :[d] *{\xor}="xor" |
762 | "i" :@{-->}`r [ru] `u "xor" "xor" |
763 | :[d] *+[F]{E}="e" :[dd] *+=(1, 0)+[F]{\mathstrut y_n}="i" |
764 | "e" [l] {K} :"e" "i" |
765 | \end{graph} \] |
766 | \vfil |
767 | \end{slide} |
768 | |
769 | \begin{slide} |
53aa10b5 |
770 | \head{Ciphertext Block Chaining (CBC), \seq: analysis} |
41761fdc |
771 | |
772 | As before, we set $q' = q\mu/l$ as the number of blocks queried by an |
773 | adversary attacking the encryption scheme. |
774 | |
775 | As if by magic,\footnote{% |
776 | The proof of this result is omitted. The interested reader is directed |
777 | towards \cite{Bellare:2000:CST}.} % |
778 | we have the result |
779 | \[ \InSec{ror-cpa}(\Xid{\mathcal{E}}{CBC}^E; t, q, \mu) \le |
780 | \frac{q'(q' - 1)}{2^l}. \]% |
781 | \end{slide} |
782 | |
783 | \begin{slide} |
784 | \topic{requirement for random IVs in CBC mode} |
53aa10b5 |
785 | \head{Ciphertext Block Chaining (CBC), \seq: on randomness of IVs} |
41761fdc |
786 | |
787 | The initialization vector used in CBC encryption must be \emph{a priori} |
788 | unpredictable to the adversary. Suppose that $P(i)$, given an IV for a |
789 | ciphertext, can predict the IV which will be used with the next ciphertext |
790 | with probability $\epsilon$. Then we construct this adversary, attacking |
791 | $\Xid{\mathcal{E}}{CBC}$ in the ROR-CPA sense: |
792 | \begin{program} |
793 | Adversary $A^{E(\cdot)}$: \+ \\ |
794 | $y \gets E(0^l)$; \PARSE $y$ \AS $l\colon i, z$; \\ |
795 | $j \gets P(y)$; $y' \gets E(j)$; \PARSE $y'$ \AS $l\colon i', z'$; \\ |
796 | \IF $i' = j \land y = y'$ \THEN \RETURN $1$; \\ |
797 | \ELSE \RETURN $0$; |
798 | \end{program} |
799 | The adversary succeeds when it guesses the IV correctly, \emph{except} when |
800 | the random encryption oracle happens to choose the same plaintext as we |
801 | wanted to encrypt anyway. So, therefore, |
802 | \[ \Adv{ror-cpa}{\Xid{\mathcal{E}}{CBC}^E} \ge \epsilon - 2^{-l}. \] |
803 | \end{slide} |
804 | |
805 | \xcalways\subsection{Chosen-ciphertext security for symmetric encryption}\x |
806 | |
807 | \begin{exercise} |
808 | Show that CTR and CBC modes are not secure against adaptive |
809 | chosen-ciphertext attacks. |
810 | \answer% |
811 | We use the FTG-CCA2 notion. For CTR mode: \cookie{find}: \RETURN $(0, 1, |
812 | \bot)$; \cookie{guess}: $y' \gets D(y \xor 0^L1)$; \RETURN $y' \xor 1$; |
813 | For CBC mode: same find stage, $y' \gets D(y \xor 1)$; \RETURN $y' \xor 1$; |
814 | \end{exercise} |
815 | |
816 | \begin{slide} |
817 | \topic{integrity of ciphertexts} |
818 | \head{Integrity of ciphertexts \cite{Bellare:2000:AER}} |
819 | |
820 | Informally, we say that an encryption scheme $\mathcal{E} = (E, D)$ has |
821 | \emph{integrity of ciphertexts} (whose confusing short name is INT-CTXT) if |
822 | it's hard for an adversary equipped with an encryption oracle to come with |
823 | a new \emph{valid} ciphertext, i.e., one for which the decryption function |
824 | $D_K$ does not return the symbol $\bot$. |
825 | |
826 | We shall see later that integrity of ciphertexts \emph{and} |
827 | indistinguishability under chosen-plaintext attacks together imply |
828 | chosen-ciphertext security. This is intuitively clear, but it's worth |
829 | proving anyway. |
830 | \end{slide} |
831 | |
832 | \begin{slide} |
833 | \head{Integrity of ciphertexts (cont.)} |
834 | |
835 | Consider the following game played by an adversary $A$: |
836 | \begin{program} |
837 | Experiment $\Expt{int-ctxt}{\mathcal{E}}(A)$: \+ \\ |
838 | $K \getsr \keys\mathcal{E}$; $\Xid{y}{list} \gets \emptyset$; |
839 | $y \gets A^{\id{encrypt}(\cdot), D_K(\cdot)}$; \\ |
840 | \IF $y \notin \Xid{y}{list} \land D_K(y) \ne \bot$ |
841 | \THEN \RETURN $1$; \\ |
842 | \ELSE \RETURN $0$; |
843 | \next |
844 | Oracle $\id{encrypt}(x)$: \+ \\ |
845 | $y \gets E_K(x)$; \\ |
846 | $\Xid{y}{list} \gets \Xid{y}{list} \cup \{y\}$; \\ |
847 | \RETURN $y$; |
848 | \end{program} |
849 | We define $A$'s success probability in this game by |
850 | \[ \Succ{int-ctxt}{\mathcal{E}}(A) = |
851 | \Pr[\Expt{int-ctxt}{\mathcal{E}}(A) = 1] \]% |
852 | and write that |
853 | \[ \InSec{int-ctxt}(\mathcal{E}; t, q_E, q_D) = |
854 | \max_A \Succ{int-ctxt}{\mathcal{E}}(A), \]% |
855 | where the maximum is over all adversaries running in time $t$ and issuing |
856 | $q_E$ encryption and $q_D$ decryption queries. |
857 | \end{slide} |
858 | |
859 | \begin{slide} |
860 | \topic{INT-CTXT and LOR-CPA imply LOR-CCA} |
861 | \head{INT-CTXT and LOR-CPA together imply LOR-CCA} |
862 | |
863 | We now prove the claim made earlier. Suppose that the adversary $A$ |
864 | attacks $\mathcal{E}$ in the LOR-CCA sense. We consider these two |
865 | adversaries, attacking the chosen-plaintext security and ciphertext |
866 | integrity of $\mathcal{E}$ respectively. |
867 | \begin{program} |
868 | Adversary $B^{E(\cdot, \cdot)}$: \+ \\ |
869 | $b \gets A^{E(\cdot, \cdot), \Xid{D}{sim}(\cdot)}$; \\ |
870 | \RETURN $b$; \- \\[\smallskipamount] |
871 | Oracle $\Xid{D}{sim}(y)$; \+ \\ |
872 | \RETURN $\bot$; |
873 | \next |
874 | Adversary $C^{E(\cdot), D(\cdot)}$: \+ \\ |
875 | $b \getsr \{0, 1\}$; $y^* \gets \bot$; \\ |
876 | $b' \gets A^{E(\id{lr}_b(\cdot, \cdot)), \Xid{D}{sim}(\cdot)}$; \\ |
877 | \RETURN $y^*$; \- \\[\smallskipamount] |
878 | Function $\id{lr}_b(x_0, x_1)$: \+ \\ |
879 | \RETURN $x_b$; \- \\[\smallskipamount] |
880 | Oracle $\Xid{D}{sim}(y)$: \+ \\ |
881 | $x \gets D(y)$; \\ |
882 | \IF $x \ne \bot$ \THEN $y^* \gets y$; \\ |
883 | \RETURN $x$; |
884 | \end{program} |
885 | \end{slide} |
886 | |
887 | \begin{slide} |
888 | \head{INT-CTXT and LOR-CPA together imply LOR-CCA2 (cont.)} |
889 | |
890 | We analyse the advantage of $B$, attacking $\mathcal{E}$ in the LOR-CPA |
891 | sense. Obviously, $B$ is lying through its teeth in its simulation of |
892 | $A$'s decryption oracle. If in fact all of $A$'s decryption queries were |
893 | for invalid ciphertexts, $B$ can't notice. So let $V$ be the event that at |
894 | least one of $A$'s ciphertexts was valid. Then |
895 | \[ \Adv{lor-cpa}{\mathcal{E}}(A) \ge |
896 | \Adv{lor-cca}{\mathcal{E}}(A) - 2\Pr[V]. \]% |
897 | To bound $\Pr[V]$, we consider adversary $C$, which simply records any of |
898 | $A$'s decryption queries which returns a valid ciphertext. Since $A$ is |
899 | forbidden from passing any ciphertexts obtained from its encryption oracle |
900 | to its decryption oracle, $C$'s returned ciphertext $y^*$ is not one it |
901 | obtained from \emph{its} encryption oracle. So |
902 | \[ \Succ{int-ctxt}{\mathcal{E}}(A) = \Pr[V]. \] |
903 | Concluding, then, |
904 | \[ \InSec{lor-cca}(\mathcal{E}; t, q_E, q_D) \le |
905 | \InSec{lor-cpa}(\mathcal{E}; t, q_E) + |
906 | 2 \cdot \InSec{int-ctxt}(\mathcal{E}; t, q_E, q_D). \]% |
907 | \end{slide} |
908 | |
909 | \begin{slide} |
910 | \topic{strong MACs provide INT-CTXT} |
911 | \head{A strong MAC provides integrity of ciphertexts} |
912 | |
53aa10b5 |
913 | That's a very nice result, but how do we achieve INT-CTXT? Well, the |
41761fdc |
914 | game in the definition looks very much like the forgery games we played |
915 | when we were thinking about MACs. |
916 | |
917 | Suppose that $\mathcal{E} = (E, D)$ is an encryption scheme secure in the |
918 | LOR-CPA sense, and $\mathcal{M} = (T, V)$ is a strong MAC (in the SUF-CMA |
919 | sense). Then we can define $\Xid{\mathcal{E}}{auth}^{\mathcal{M}} = |
920 | (\Xid{E}{auth}^{\mathcal{E}, \mathcal{M}}, \Xid{D}{auth}^{\mathcal{E}, |
921 | \mathcal{M}})$ by |
922 | \[ \keys\Xid{\mathcal{E}}{auth}^{\mathcal{E}, \mathcal{M}} = |
923 | \keys\mathcal{E} \times \keys\mathcal{M} \]% |
924 | and |
925 | \begin{program} |
926 | Algorithm |
927 | $\Xid{E}{auth}^{\mathcal{E}, \mathcal{M}}_{K_E, K_T}(x)$: \+ \\ |
928 | $y \gets E_{K_E}(x)$; \\ |
929 | $\tau \gets T_{K_T}(y)$; \\ |
930 | \RETURN $\tau \cat y$; |
931 | \next |
932 | Algorithm |
933 | $\Xid{D}{auth}^{\mathcal{E}, \mathcal{M}}_{K_E, K_T}(y')$: \+ \\ |
934 | \PARSE $y'$ \AS $\tau, y$; \\ |
935 | \IF $V_{K_T}(y, \tau) = 0$ \THEN \RETURN $\bot$; \\ |
936 | \ELSE \RETURN $D_{K_E}(y)$; |
937 | \end{program} |
938 | \end{slide} |
939 | |
940 | \begin{slide} |
941 | \head{A strong MAC provides integrity of ciphertexts (cont.)} |
942 | |
943 | The security proof for $\Xid{\mathcal{E}}{auth}^{\mathcal{E}, \mathcal{M}}$ |
944 | is left as a trivial exercise. We end up with the result that |
945 | \[ \InSec{int-ctxt}(\Xid{\mathcal{E}}{auth}^{\mathcal{E}, \mathcal{M}}; |
946 | t, q_E, q_D) \le |
947 | \InSec{suf-cma}(\mathcal{M}; t, q_E, q_D) \]% |
948 | and hence |
949 | \begin{eqnarray*}[Ll] |
950 | \InSec{lor-cca}(\Xid{\mathcal{E}}{auth}^{\mathcal{E}, \mathcal{M}}; |
951 | t, q_E, q_D) \\ |
952 | & \le \InSec{lor-cpa}(\mathcal{E}; t, q_E) + |
953 | 2 \cdot \InSec{suf-cma}(\mathcal{M}; t, q_E, q_D). |
954 | \end{eqnarray*} |
955 | A MAC, therefore, can help us to attain a strong notion of secrecy, even if |
956 | no actual integrity appears to be required. This is an important lesson. |
957 | \end{slide} |
958 | |
959 | \begin{exercise} |
960 | Prove the above result. |
961 | \answer% |
962 | Let $A$ attack INT-CTXT. Construct adversary $B^{T(\cdot), V(\cdot)}$: \{ |
963 | $K \getsr \keys\mathcal{E}$; $(y, \tau) \gets A^{\id{encrypt}(\cdot), |
964 | \id{decrypt}(\cdot)}$; \RETURN $(y, \tau)$;~\} Oracle $\id{encrypt}(x)$: |
965 | \{ $y \gets E_K(x)$; $\tau \gets T(y)$; \RETURN $(y, \tau)$;~\} Oracle |
966 | $\id{decrypt}(y, \tau)$: \{ \IF $V(y, \tau) = 1$ \THEN \RETURN $D_K(y)$; |
967 | \ELSE \RETURN $\bot$;~\}. The simulation of the INT-CTXT game is perfect. |
968 | \end{exercise} |
969 | |
970 | \begin{slide} |
971 | \topic{mixing encryption and MACs} |
972 | \head{Notes on mixing encryption and MACs} |
973 | |
974 | To construct $\Xid{\mathcal{E}}{auth}^{\mathcal{E}, \mathcal{M}}$, we |
975 | applied a MAC to the \emph{ciphertext}. This isn't perhaps the most |
976 | intuitive way to combine an encryption scheme with a MAC. |
977 | |
978 | There are three constructions which look plausible. |
979 | \begin{description} |
980 | \item[Encrypt-then-MAC:] |
981 | % |
982 | $y \gets E_{K_E}(x)$; $\tau \gets T_{K_T}(y)$; \RETURN $\tau \cat y$; |
983 | \\ |
984 | Encrypt the plaintext, and MAC the ciphertext; used in IPsec and nCipher |
985 | Impath; we've proven its generic security, using the notion of integrity |
986 | of ciphertexts. |
987 | % |
988 | \item[MAC-then-encrypt:] |
989 | % |
990 | $\tau \gets T_{K_T}(x)$; $y \gets E_{K_E}(\tau \cat x)$; \RETURN $y$; |
991 | \\ |
992 | MAC the plaintext, and encrypt both the plaintext and tag; used in SSL |
993 | and TLS; not \emph{generically} secure against chosen-ciphertext attacks. |
994 | % |
995 | \item[Encrypt-and-MAC:] |
996 | % |
997 | $y \gets E_{K_E}(x)$; $\tau \gets T_{K_T}(x)$; \RETURN $\tau \cat y$; |
998 | \\ |
999 | Separately MAC and encrypt the plaintext; used in SSH; \emph{never} |
1000 | secure against chosen-ciphertext, not generically secure against |
1001 | chosen-plaintext! |
1002 | \end{description} |
1003 | \end{slide} |
1004 | |
1005 | \begin{proof} |
1006 | We begin with a few words on our approach, before we embark on the proof |
1007 | proper. |
1008 | |
53aa10b5 |
1009 | To demonstrate the generic insecurity of a scheme, we assume the existence |
41761fdc |
1010 | of an encryption scheme and MAC (since if they don't exist, the result is |
1011 | vacuously true) and construct modified schemes whose individual security |
1012 | relates tightly to the originals, but the combined scheme is weak. |
1013 | |
1014 | We demonstrate \emph{universal} insecurity by showing an attack which works |
1015 | given \emph{any} component encryption and MAC schemes. |
1016 | |
1017 | We prove security relationships using the LOR-CPA notion because this is |
1018 | strongest, and bounds for other notions can be derived readily from the |
1019 | left-or-right analysis. We prove insecurity using the FTG-CCA or FTG-CPA |
1020 | notions, because they are weakest and show the strength of our results |
1021 | best. |
1022 | |
1023 | We've dealt with the generic security of encrypt-then-MAC already. We turn |
1024 | our attention first first to the generic insecurity of the MAC-then-encrypt |
1025 | scheme. |
1026 | |
1027 | Let $\mathcal{E} = (E, D)$ be a symmetric encryption scheme, and let |
1028 | $\mathcal{M} = (T, V)$ be a MAC. We define the MAC-then-encrypt scheme |
1029 | $\Xid{\mathcal{E}}{MtE}^{\mathcal{E}, \mathcal{M}} = |
1030 | (\Xid{E}{MtE}^{\mathcal{E}, \mathcal{M}}, \Xid{D}{MtE}^{\mathcal{E}, |
1031 | \mathcal{M}})$ as follows: |
1032 | \[ \keys\Xid{\mathcal{E}}{MtE}^{\mathcal{E}, \mathcal{M}} = |
1033 | \keys\mathcal{E} \times \keys\mathcal{M} \]% |
1034 | and |
1035 | \begin{program} |
1036 | Algorithm |
1037 | $\Xid{E}{MtE}^{\mathcal{E}, \mathcal{M}}_{K_E, K_T}(x)$: \+ \\ |
1038 | $\tau \gets T_{K_T}(x)$; \\ |
1039 | $\RETURN E_{K_E}(\tau \cat x)$; |
1040 | \next |
1041 | Algorithm |
1042 | $\Xid{D}{MtE}^{\mathcal{E}, \mathcal{M}}_{K_E, K_T}(y)$: \+ \\ |
1043 | $x' \gets D_{K_E}(y)$; \\ |
1044 | \PARSE $x'$ \AS $\tau, x$; \\ |
1045 | \IF $V_{K_T}(x, \tau) = 0$ \THEN \RETURN $\bot$; \\ |
1046 | \ELSE \RETURN $x$; |
1047 | \end{program} |
1048 | We construct a new encryption scheme $\mathcal{E}' = (E', D')$ in terms of |
1049 | $\mathcal{E}$, such that the combined scheme |
1050 | $\Xid{\mathcal{E}}{MtE}^{\mathcal{E}', \mathcal{M}}$ is insecure in the |
1051 | FTG-CCA sense. Our modified encryption scheme has $\keys\mathcal{E}' = |
1052 | \keys\mathcal{E}$, and works as follows: |
1053 | \begin{program} |
1054 | Algorithm $E'_K(x)$: \+ \\ |
1055 | \RETURN $0 \cat E_K(x)$; |
1056 | \next |
1057 | Algorithm $D'_K(y')$: \+ \\ |
1058 | \PARSE $y'$ \AS $1\colon b, y$; \\ |
1059 | \RETURN $D_K(y)$; |
1060 | \end{program} |
1061 | That is, the encryption scheme prepends a single bit to the ciphertext, and |
1062 | doesn't check its value during decryption. Intuitively, this makes the |
1063 | scheme malleable: we can change the ciphertext by flipping the first bit, |
1064 | but the MAC tag remains valid because the plaintext is unaffected. |
1065 | |
1066 | Firstly, we prove that $\mathcal{E}'$ is LOR-CPA if $\mathcal{E}$ is. |
1067 | Suppose $A'$ attacks $\mathcal{E}'$ in the LOR-CPA sense: then |
1068 | \begin{program} |
1069 | Adversary $A^{E(\cdot, \cdot)}$: \+ \\ |
1070 | \RETURN $A'^{0 \cat E(\cdot, \cdot)}$; |
1071 | \end{program} |
1072 | has the same advantage. |
1073 | |
1074 | Secondly, we show that the combined MAC-then-encrypt scheme |
1075 | $\Xid{\mathcal{E}}{MtE}^{\mathcal{E}', \mathcal{M}}$ is insecure in the |
1076 | FTG-CCA sense. Consider this adversary: |
1077 | \begin{program} |
1078 | Adversary $B^{E(\cdot), D(\cdot)}(\cookie{find})$: \+ \\ |
1079 | \RETURN $(0, 1, \bot)$; |
1080 | \next |
1081 | Adversary $B^{E(\cdot), D(\cdot)}(\cookie{guess}, y', s)$: \+ \\ |
1082 | \PARSE $y'$ \AS $1\colon b, y$; \\ |
1083 | \RETURN $D(1 \cat y)$; |
1084 | \end{program} |
1085 | The ciphertext $1 \cat y$ was never returned by the encryption oracle |
1086 | (because it always returns the first bit zero); but the plaintext of $1 |
1087 | \cat y$ is the challenge plaintext. Hence, $B$ wins always, and |
1088 | \[ \InSec{ftg-cca}(\Xid{\mathcal{E}}{MtE}^{\mathcal{E}', \mathcal{M}}; |
1089 | t, 0, 1) = 1, \]% |
1090 | where $t$ is the running time of the adversary $B$ above. |
1091 | |
1092 | We now address the separate encrypt-and-MAC scheme, which we define |
1093 | formally. Let $\mathcal{E} = (E, D)$ be a symmetric encryption scheme, and |
1094 | let $\mathcal{M} = (T, V)$ be a MAC. Then the the encrypt-and-MAC scheme |
1095 | $\Xid{\mathcal{E}}{E\&M}^{\mathcal{E}, \mathcal{M}} = |
1096 | (\Xid{E}{E\&M}^{\mathcal{E}, \mathcal{M}}, \Xid{D}{E\&M}^{\mathcal{E}, |
1097 | \mathcal{M}})$ is defined by: |
1098 | \[ \keys\Xid{\mathcal{E}}{E\&M}^{\mathcal{E}, \mathcal{M}} = |
1099 | \keys\mathcal{E} \times \keys\mathcal{M} \]% |
1100 | and |
1101 | \begin{program} |
1102 | Algorithm |
1103 | $\Xid{E}{E\&M}^{\mathcal{E}, \mathcal{M}}_{K_E, K_T}(x)$: \+ \\ |
1104 | $y \gets E_{K_E}(x)$; \\ |
1105 | $\tau \gets T_{K_T}(x)$; \\ |
1106 | $\RETURN \tau \cat y$; |
1107 | \next |
1108 | Algorithm |
1109 | $\Xid{D}{E\&M}^{\mathcal{E}, \mathcal{M}}_{K_E, K_T}(y')$: \+ \\ |
1110 | \PARSE $y'$ \AS $\tau, y$; \\ |
1111 | $x \gets D_{K_E}(y)$; \\ |
1112 | \IF $V_{K_T}(x, \tau) = 0$ \THEN \RETURN $\bot$; \\ |
1113 | \ELSE \RETURN $x$; |
1114 | \end{program} |
1115 | |
1116 | We first show that this scheme is \emph{universally} insecure against |
1117 | chosen-ciphertext attack. Let $\mathcal{E}$ and $\mathcal{M}$ be an |
1118 | arbitrary symmetric encryption scheme and MAC, respectively. The attack |
1119 | works because the MACs can be detached and used in chosen-ciphertext |
1120 | queries to test for equality of messages. |
1121 | \begin{program} |
1122 | Adversary $B^{E(\cdot), D(\cdot)}(\cookie{find})$: \+ \\ |
1123 | \RETURN $(0, 1, \bot)$; |
1124 | \next |
1125 | Adversary $B^{E(\cdot), D(\cdot)}$(\cookie{guess}, y', s): \+ \\ |
1126 | $y_1' \gets E(1)$; \\ |
1127 | \PARSE $y'$ \AS $\tau, y$; \\ |
1128 | \PARSE $y_1'$ \AS $\tau_1, y_1$; \\ |
1129 | \IF $\tau = \tau_1 \lor D(\tau \cat y_1) \ne \bot$ |
1130 | \THEN \RETURN $1$; \\ |
1131 | \ELSE \RETURN $0$; |
1132 | \end{program} |
1133 | After receiving the challenge ciphertext, the adversary requests an |
1134 | additional encryption of the plaintext $1$. If the tags are equal on the |
1135 | two ciphertexts then we announce that the hidden bit is $1$. Otherwise, we |
1136 | attempt a decryption of the new ciphertext, using the tag from the |
1137 | challenge. If it decrypts successfully, we announce that the bit is $1$; |
1138 | otherwise we claim it is zero. |
1139 | |
1140 | Certainly, this strategy is always correct when the hidden bit is indeed |
1141 | $1$. However, there is a possibility that the MACs are equal or verify |
1142 | correctly even when the hidden bit is $0$. To bound this probability, we |
1143 | construct the following simple adversary against the MAC: |
1144 | \begin{program} |
1145 | Adversary $B'^{T(\cdot), V(\cdot)}$: \+ \\ |
1146 | $\tau \gets T(1)$; \\ |
1147 | \RETURN $(0, \tau)$; |
1148 | \end{program} |
1149 | We see readily that |
1150 | \[ \InSec{ftg-cca}(\Xid{\mathcal{E}}{E\&M}^{\mathcal{E}, \mathcal{M}}; |
1151 | t, 1, 1) \ge |
1152 | 1 - \InSec{suf-cma}(\mathcal{M}; t', 1, 0), \]% |
1153 | where $t$ and $t'$ are the running times of adversaries $B$ and $B'$ |
1154 | respectively. |
1155 | |
1156 | Finally, we show that the encrypt-and-MAC scheme is generically insecure |
1157 | against chosen-plaintext attacks only. There are two strategies we could |
1158 | use. Since both offer useful insights into the properties of MACs, we |
1159 | present both here. |
1160 | \begin{itemize} |
1161 | |
1162 | \item \emph{Deterministic MACs.} In the proof of the universal weakness of |
1163 | the encrypt-and-MAC scheme, we used the check on the MAC to decide on the |
1164 | equality of two plaintexts given the ciphertexts. If the MAC is |
1165 | deterministic (e.g., a PRF) then we don't need a decryption query. |
1166 | |
1167 | Let $\mathcal{E} = (E, D)$ be a symmetric cipher, and let $\mathcal{M} = |
1168 | (T, V)$ be a deterministic MAC, e.g., a PRF, or HMAC. Then consider this |
1169 | adversary: |
1170 | \begin{program} |
1171 | Adversary $B^{E(\cdot)}(\cookie{find})$: \+ \\ |
1172 | \RETURN $(0, 1, \bot)$; |
1173 | \next |
1174 | Adversary $B^{E(\cdot)}(\cookie{guess}, y', s)$: \+ \\ |
1175 | $y_1' \gets E(1)$; \\ |
1176 | \PARSE $y'$ \AS $\tau, y$; \\ |
1177 | \PARSE $y_1'$ \AS $\tau_1, y_1$; \\ |
1178 | \IF $\tau = \tau_1$ \THEN \RETURN $1$; \\ |
1179 | \ELSE \RETURN $0$; |
1180 | \end{program} |
1181 | Since the MAC is deterministic, the tag attached to a ciphertext $1$ is |
1182 | always the same. We bound the probability that $T_K(0) = T_K(1)$ using |
1183 | the adversary $B'$ above, and conclude that |
1184 | \[ \InSec{ftg-cpa}(\Xid{\mathcal{E}}{E\&M}^{\mathcal{E}, \mathcal{M}}; |
1185 | t, 1) \ge |
1186 | 1 - \InSec{suf-cma}(\mathcal{M}; t', 1, 0), \]% |
1187 | where $t$ and $t'$ are the running times of adversaries $B$ and $B'$ |
1188 | respectively. |
1189 | |
1190 | \item \emph{Leaky MACs.} A MAC doesn't have to conceal information about |
1191 | messages. Suppose $\mathcal{M} = (T, V)$ is a secure MAC. We define the |
1192 | leaky MAC $\mathcal{M}' = (T', V')$ by stating that $\keys\mathcal{M}' = |
1193 | \keys\mathcal{M}''$ and |
1194 | \begin{program} |
1195 | Algorithm $T'_K(x)$: \+ \\ |
1196 | \PARSE $x$ \AS $1\colon x_0, z$; \\ |
1197 | \RETURN $x_0 \cat T_K(x)$; |
1198 | \next |
1199 | Algorithm $V'_K(x, \tau')$: \+ \\ |
1200 | \PARSE $\tau'$ \AS $1\colon \tau_0, \tau$; \\ |
1201 | \PARSE $x$ \AS $1\colon x_0, z$; \\ |
1202 | \IF $x_0 \ne \tau_0$ \THEN \RETURN $0$; \\ |
1203 | \ELSE \RETURN $V_K(x, \tau)$; |
1204 | \end{program} |
1205 | We must first prove that $\mathcal{M}'$ remains secure. To do this, |
1206 | consider an adversary $A'$ attacking $\mathcal{M}'$. We construct $A$ |
1207 | attacking $\mathcal{M}$ in the obvious way: |
1208 | \begin{program} |
1209 | Algorithm $A^{T(\cdot), V(\cdot)}$: \\ |
1210 | $(x', \tau') \gets |
1211 | A'^{\Xid{T'}{sim}(\cdot), \Xid{V'}{sim}(\cdot)}$; \\ |
1212 | \PARSE $\tau'$ \AS $1\colon \tau_0, \tau$; \\ |
1213 | \RETURN $(x, \tau)$; |
1214 | \next |
1215 | Oracle $\Xid{T'}{sim}(x)$: \+ \\ |
1216 | \PARSE $x$ \AS $1\colon x_0, z'$; \\ |
1217 | \RETURN $x_0 \cat T(x)$; \- \\[\smallskipamount] |
1218 | Oracle $\Xid{V'}{sim}(x, \tau')$: \+ \\ |
1219 | \PARSE $\tau'$ \AS $1\colon \tau_0, \tau$; \\ |
1220 | \PARSE $x$ \AS $1\colon x_0, z$; \\ |
1221 | \IF $x_0 \ne \tau_0$ \THEN \RETURN $0$; \\ |
1222 | \ELSE \RETURN $V(x, \tau)$; |
1223 | \end{program} |
1224 | Here, $A$ simply simulates the environment expected by $A'$. It is clear |
53aa10b5 |
1225 | that $A$ succeeds whenever $A'$ returns a valid tag for a \emph{new} |
41761fdc |
1226 | message. However, suppose that $A'$ returns a new tag $\tau'$ for some |
1227 | old message $x$, for which the tag $\tau$ was returned by the tagging |
1228 | oracle. Let $x_0$, $\tau_0$ and $\tau'_0$ be the first bits of $x$, |
1229 | $\tau$ and $\tau'$ respectively, and let $\tau^*$ be the remaining bits |
1230 | of $\tau'$. If the pair $(x, \tau')$ is to be a valid |
1231 | $\mathcal{M}'$-forgery, we must have $x_0 = \tau_0 = \tau'_0$. Hence, |
1232 | $\tau$ and $\tau'$ must differ in at least one other bit, and $(x, |
1233 | \tau^*)$ is a valid $\mathcal{M}$-forgery. We conclude that |
1234 | \[ \InSec{suf-cma}(\mathcal{M}'; t, q_T, q_V) \le |
1235 | \InSec{suf-cma}(\mathcal{M}; t, q_T, q_V) \]% |
1236 | as required. |
1237 | |
1238 | Now we show that the combined encrypt-and-MAC scheme is weak in the |
1239 | FTG-CPA sense. Consider this adversary attacking the scheme: |
1240 | \begin{program} |
1241 | Adversary $B^{E(\cdot), D(\cdot)}(\cookie{find})$: \+ \\ |
1242 | \RETURN $(0, 1, \bot)$; |
1243 | \next |
1244 | Adversary $B^{E(\cdot), D(\cdot)}$(\cookie{guess}, y', s): \+ \\ |
1245 | \PARSE $y'$ \AS $\tau, y$; \\ |
1246 | \PARSE $\tau$ \AS $1\colon b, \tau^*$; \\ |
1247 | \RETURN $b$; |
1248 | \end{program} |
1249 | The leaky MAC simply tells us the right answer. So |
1250 | \[ \InSec{ftg-cpa}(\Xid{\mathcal{E}}{E\&M}^{\mathcal{E}, \mathcal{M}'}; |
1251 | t, 0) = 1, \]% |
1252 | where $t$ is the running time of adversary $B$ above. |
1253 | |
1254 | \end{itemize} |
1255 | |
1256 | This concludes the proof. |
1257 | \end{proof} |
1258 | |
1259 | %% TO DO: Include stuff about integrity-aware encryption modes some day. |
1260 | |
1261 | \endinput |
1262 | |
1263 | %%% Local Variables: |
1264 | %%% mode: latex |
1265 | %%% TeX-master: "ips" |
1266 | %%% End: |