[
[
['9','add','hl'],
['15','add','hl'],
['20','remove','slide-up'],
['2','add','slide-down']
],
[
['200','add','hl'],
['200','remove','slide-left'],
['28','add','hl'],
['28','remove','hidden'],
['32','add','hl'],
['32','remove','hidden'],
['4','add','hidden'],
['9','remove','hl'],
['9','add','hidden'],
['15','remove','hl'],
['15','add','hidden']
],
[
['200','remove','hl'],
['28','remove','hl'],
['32','remove','hl'],
['6','add','hl'],
['187','add','hl'],
['184','add','hl'],
['37','remove','slide-up'],
['20','add','slide-down']
],
[
['188','add','hl'],
['188','remove','slide-left'],
['185','add','hl'],
['185','remove','slide-left'],
['189-slide','remove','slide-left'],
['6','remove','hl'],
['6','add','hidden'],
['187','remove','hl'],
['187','add','slide-right'],
['184','remove','hl'],
['184','add','slide-right']
],
[
['188','remove','hl'],
['185','remove','hl']
],
[
['189-flip','add','flipped'],
['37','add','slide-down']
],
[
['188','add','hl'],
['185','add','hl']
],
[
['91','add','hl'],
['91','remove','hidden'],
['191','add','hl'],
['191','remove','slide-right'],
['98','add','hl'],
['98','remove','hidden'],
['190','add','hl'],
['190','remove','slide-right'],
['188','remove','hl'],
['188','add','slide-left'],
['185','remove','hl'],
['185','add','slide-left'],
['189-slide','add','slide-left']
],
[
['91','remove','hl'],
['191','remove','hl'],
['98','remove','hl'],
['190','remove','hl'],
['17','add','hl'],
['103','remove','slide-up']
],
[
['17','remove','hl'],
['17','add','hidden']
],
[
['5','add','hl'],
['7','add','hl'],
['193','add','hl'],
['120','remove','slide-up'],
['103','add','slide-down']
],
[
['194','add','hl'],
['194','remove','slide-left'],
['5','remove','hl'],
['5','add','hidden'],
['7','remove','hl'],
['7','add','hidden'],
['193','remove','hl'],
['193','add','slide-right']
],
[
['194','remove','hl'],
['91','add','hl'],
['191','add','hl'],
['135','remove','slide-up'],
['120','add','slide-down']
],
[
['195','add','hl'],
['195','remove','slide-left'],
['91','remove','hl'],
['91','add','hidden'],
['191','remove','hl'],
['191','add','slide-right']
],
[
['195','remove','hl'],
['199','add','hl'],
['196','add','hl'],
['149','remove','slide-up'],
['135','add','slide-down']
],
[
['9','add','hl'],
['9','remove','hidden'],
['197','add','hl'],
['197','remove','slide-left'],
['199','remove','hl'],
['199','add','slide-right'],
['196','remove','hl'],
['196','add','slide-right']
],
[
['9','remove','hl'],
['197','remove','hl'],
['98','add','hl'],
['190','add','hl'],
['164','remove','slide-up'],
['149','add','slide-down']
],
[
['166','remove','hidden'],
['5','add','hl'],
['5','remove','hidden'],
['6','add','hl'],
['6','remove','hidden'],
['7','add','hl'],
['7','remove','hidden'],
['179','add','hl'],
['179','remove','hidden'],
['201','add','hl'],
['201','remove','slide-left'],
['181','add','hl'],
['181','remove','hidden'],
['98','remove','hl'],
['98','add','hidden'],
['190','remove','hl'],
['190','add','slide-right']
],
[
['5','remove','hl'],
['6','remove','hl'],
['7','remove','hl'],
['179','remove','hl'],
['201','remove','hl'],
['181','remove','hl']
]
]
The starting point is $\lib{cca-real}$.
We can add a cache to remember the plaintexts of ciphertexts generated in $\ccaenc$.
Apply the MAC property of the PRF, in a three-hop maneuver:
\FORMATTINGHACK{\needspace{5\baselineskip}\noindent}We now argue that the three if-conditions in $\ccadec$ are exhaustive. Why? Suppose the second and third if-statements are not taken, then we must have $\prftable[\ctxt] = T$. But the library assigns to $\prftable[\ctxt] := T$ only in $\ccaenc$, where it also assigns to $\mathcal{D}[\ctxt\|T]$! So the first if-statement would have been taken this case. Knowing that the last line of $\ccadec$ is unreachable, we can remove it:\FORMATTINGHACK{\pagebreak}
Now that $\key_e$ is used only to call $\Sigma.\Enc$, we can apply CPA security. The three-hop maneuver is omitted.
It is only with negligible birthday probability that $\ctxt$ repeats in the first line of $\ccaenc$. Thus the if-statement on the next line is always taken (except with negligible probability), and its body can be made unconditional. This can be shown in a standard sequence of steps (involving either a bad event or an appeal to \lemmaref{comp.lem.birthday-lib}), which are omitted here.
Suppose $\ccaenc$ generates a ciphertext $\ctxt \| T$, and later $\ccadec$ is called with a ciphertext of the form $\ctxt \| T'$. Then $\ccadec$ will return $\myerr$ if $T \ne T'$ \FORMATTINGHACK{\pagebreak}and otherwise return $\mathcal{D}[\ctxt\|T]$. In particular, $\ccadec$ never needs to consult $\prftable[\ctxt]$. Therefore, $\ccaenc$ does not need to assign $\prftable[\ctxt]$.
Finally, we can perform several of the previous changes, this time in reverse, and obtain $\lib{cca-rand}$.
$\lib{cca-real}$
$\lib{cca-rand}$
$\key_e \gets \Sigma.\K$
$\key_m \gets \bits^\secpar$
$\ctxt $
${}:= \Sigma.\Enc(\key_e, \ptxt)$
${}\gets \Sigma.\C(|\ptxt|)$
if $\prftable[\ctxt]$ undefined: $\prftable[\ctxt] \gets \bits^\secpar$
$T $
${}:= {}$
$F(\key_m, \ctxt)$
$\macreveal(\ctxt)$
$\prftable[\ctxt]$
$\prftable[C] \gets \bits^\secpar$
${}\gets \bits^\secpar$
$\mathcal{D}[\ctxt\|T] := \ptxt$
return $\ctxt \| T$
if $\mathcal{D}[\ctxt\|T]$ defined: return $\mathcal{D}[\ctxt\|T]$
if $\prftable[\ctxt]$ undefined: return $\myerr$
if
$F(\key_m, \ctxt) \ne T$: return $\myerr$
not $\macguess(\ctxt, T)$: return $\myerr$
$\prftable[\ctxt] \ne T$: return $\myerr$
$F(\key_m,\ctxt) \ne T$: return $\myerr$
return $\Dec(\key_e, \ctxt)$
return $\Sigma.\Dec(\key_e, \ctxt)$
$\link$
$\lib{mac-real}$
$\key \gets \bits^\secpar$
return $Y == F(\key,X)$
return $F(\key,X)$
$\lib{mac-ideal}$
if $\prftable[X]$ undefined: return $\myfalse$
return $Y == \prftable[X]$
if $\prftable[X]$ undefined: $\prftable[X] \gets \bits^\secpar$
return $\prftable[X]$