Skip to content

Commit

Permalink
add suf-mac figure
Browse files Browse the repository at this point in the history
  • Loading branch information
YuZhang committed Oct 5, 2021
1 parent 7d8d25d commit 1491dc2
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 5 deletions.
2 changes: 1 addition & 1 deletion misc/tikztest/tikz-test.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\begin{frame}\frametitle{Tikz Test}
\begin{figure}
\begin{center}
\input{../../tikz/feistel-prp}
\input{../../tikz/suf-mac}
\end{center}
\end{figure}
\end{frame}
Expand Down
6 changes: 3 additions & 3 deletions notes-Chinese/6 消息认证码与抗碰撞哈希函数.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@

35. 信息论上MAC的构造

- 设想如果根据第一次消息和标签能够唯一确定密钥,那么敌手一定可以成功伪造;反之,如果不能唯一确定密钥,并且密钥可能的范围充分大,那么敌手就难以成功伪造。为了实现一次$1/2^{|t|}$-安全的MAC,我们需要一个新的数学对象,使得第一次查询与敌手伪造标签这两个事件之间是充分独立的
- 设想如果根据第一次消息和标签能够唯一确定密钥,那么敌手一定可以成功伪造;反之,如果不能唯一确定密钥,并且密钥可能的范围充分大,那么敌手就难以成功伪造。从另一个角度说,我们需要令第一次查询获得了一个对消息和标签与敌手伪造另一个新消息的标签这两个事件之间是充分独立的。为了实现一次$1/2^{|t|}$-安全的MAC,需要一个新的数学对象,不同输入会产生不同的输出,输入间任何差异都会导致输出之间是完全独立的。将函数的这种性质称为:“成对独立的,**pairwise-independent**” 或者 “成对不可预测,**pairwise-unpredictable**
- 一个函数 $h$: $\mathcal{K} \times \mathcal{M} \to \mathcal{T}$ 是一个强全域函数(**Strongly Universal Function (SUF)**),如果对于所有不同的 $m, m' \in \mathcal{M}$ 以及所有 $t, t' \in \mathcal{T}$, 以下成立: $ \Pr [h_k(m) = t \land h_k(m') = t'] = 1 / |\mathcal{T}|^2 $,其中概率来自均匀选择的 $k \in \mathcal{K}$.
- SUF中不同输入会产生不同的输出,输入间任何差异都会导致输出之间是完全独立的,因此也称为“对独立的,pairwise-independent”;
- SUF是具有上面性质的函数,下一页证明
- 信息论安全MAC构造:
- 令 $h$: $\mathcal{K} \times \mathcal{M} \to \mathcal{T}$ 为一个SUF.
- $\mathsf{Gen}$: $k \gets \{0,1\}^n$ u.a.r.
Expand All @@ -280,7 +280,7 @@

- 任意 $\ell$次 $2^{-n}$-安全 MAC 需要密钥长度至少为 $(\ell +1) \cdot n$.
- 定理:令 $\Pi$ 为一次 $2^{-n}$-安全 MAC,其中所有密钥长度相同。那么,密钥必须具有$2n$长度。
- 证明:直觉上,每对消息和标签成立需要$2^n$个密钥,才能保证 $2^{-n}$-安全。一共2对,需要$2^{2n}$。令 $\mathcal{K}(t) \overset{\mathsf{def}}{=} \{ k | \mathsf{Vrfy}_k(m, t) = 1\}$,即所有能产生指定消息和标签的密钥集合。对于任意 $t$, $|\mathcal{K}(t)| \leq 2^{-n} \cdot |\mathcal{K}|$。 否则, $(m, t)$ 是一个有效标签的概率至少为 $|\mathcal{K}(t)|/|\mathcal{K}|> 2^{-n}$,这与安全要求矛盾。 $\mathcal{A}$有无限算力可以根据从第一次查询中得到对应的密钥集合$\mathcal{K}(t)$,从中选择一个密钥$k$,并输出一个新消息的有效标签的概率是至少 $ \sum_{t} \Pr [\mathsf{Mac}_k(m) = t] \cdot \frac{1}{|\mathcal{K}(t)|} \geq \sum_{t} \Pr [\mathsf{Mac}_k(m) = t] \cdot \frac{2^n}{|\mathcal{K}|} = \frac{2^n}{|\mathcal{K}|} $ 。由于概率至多 $2^{-n}$, $|\mathcal{K}| \geq 2^{2n}$。由于所有密钥具有相同长度,每个密钥的长度至少是 $2n$。
- 证明:直觉上,每对消息和标签成立需要$2^n$个密钥,才能保证 $2^{-n}$-安全。一共2对,需要$2^{2n}$。令 $\mathcal{K}(t) \overset{\mathsf{def}}{=} \{ k | \mathsf{Vrfy}_k(m, t) = 1\}$,即所有能产生指定消息和标签的密钥集合。对于任意 $t$, $|\mathcal{K}(t)| \leq 2^{-n} \cdot |\mathcal{K}|$。 否则,敌手$\mathcal{A}$从这个密钥集合中随机挑选一个密钥得到 $(m, t)$ 是一个有效标签的概率至少为 $|\mathcal{K}(t)|/|\mathcal{K}|> 2^{-n}$,这与安全要求矛盾。 $\mathcal{A}$有无限算力可以根据从第一次查询中得到对应的密钥集合$\mathcal{K}(t)$,从中选择一个密钥$k$,并输出一个新消息的有效标签的概率是至少 $ \sum_{t} \Pr [\mathsf{Mac}_k(m) = t] \cdot \frac{1}{|\mathcal{K}(t)|} \geq \sum_{t} \Pr [\mathsf{Mac}_k(m) = t] \cdot \frac{2^n}{|\mathcal{K}|} = \frac{2^n}{|\mathcal{K}|} $ 。由于概率至多 $2^{-n}$, $|\mathcal{K}| \geq 2^{2n}$。由于所有密钥具有相同长度,每个密钥的长度至少是 $2n$。

39. 总结

Expand Down
Binary file modified pdf/6mac-crhf.pdf
Binary file not shown.
15 changes: 14 additions & 1 deletion source/6mac-crhf.tex
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,20 @@ \section{Information-Theoretic MACs}
\]
\end{definition}
\end{frame}

\begin{frame}\frametitle{Understanding Information-Theoretic MACs}
An adversary will forge the tag in the following steps.
\begin{enumerate}
\item Obtain a tag $t'$ from a MAC query for a fixed message $m'$
\item Obtain $\mathcal{K}(t') \overset{\mathsf{def}}{=} \{ k | \mathsf{Vrfy}_k(m', t') = 1\}$ by using his unlimited computing power
\item Output $(m, t)$ using a key $k^*$ from $\mathcal{K}(t')$
\end{enumerate}
So $\mathcal{K}(t')$ must be large enough.
\begin{figure}
\begin{center}
\input{tikz/suf-mac}
\end{center}
\end{figure}
\end{frame}
\begin{frame}\frametitle{Construction of Information-Theoretic MACs}
\begin{definition}
A function $h$: $\mathcal{K} \times \mathcal{M} \to \mathcal{T}$ is a \textbf{Strongly Universal Function (SUF)} if for all distinct $m, m' \in \mathcal{M}$ and all $t, t' \in \mathcal{T}$, it holds that:
Expand Down
60 changes: 60 additions & 0 deletions tikz/suf-mac.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
\begin{tikzpicture}[uk/.style={inner sep=1pt, minimum width=18pt, circle, fill=red!40},kk/.style={inner sep=1pt, minimum width=18pt, fill=blue!40, circle},
tk/.style={inner sep=1pt, minimum width=18pt, draw, fill=yellow!30, circle}]
\node (X) at (-3cm,0) [ellipse,minimum width=1.5cm,minimum height=4cm,draw] {};
\node (x) [above of=X,node distance=2.3cm] {$M$};
\node (Y) [right of=X,ellipse,minimum width=1.5cm,minimum height=4cm,node distance=6cm,draw] {};
\node (y) [above of=Y,node distance=2.3cm] {$T$};

\node (K) at (0,0) [minimum width=2.5cm,minimum height=4cm,draw] {};
\node (TK) at (0,0.3cm) [ellipse,minimum width=1.5cm,minimum height=3cm,draw,fill=yellow!10] {};
\node at (0,0.9cm) {$\mathcal{K}(t')$};

\node (k) [above of=K,node distance=2.3cm] {$K$};


\node (x1) at ($(X)+(0,1cm)$) [uk] {$m'$};
\node (y1) at ($(Y)+(0,1cm)$) [uk] {$t'$};
\node (k) at ($(K)+(0,0)$) [tk] {$k$};
\node (fk) at ($(K)+(0,-0.7cm)$) [tk] {$k^*$};

\draw[-latex, red] (x1) -- (k);
\draw[-latex, red] (k) -- (y1);
\draw[-latex, red, ultra thick] (x1) -- (TK.140);
\draw[-latex, red, ultra thick] (TK.40) -- (y1);

\node (x2) at ($(X)+(0,-1cm)$) [kk] {$m$};
\node (y2) at ($(Y)+(0,-1cm)$) [kk] {$t$};
%\node (k) at ($(K)+(0,-1cm)$) [kk] {$k$};
\draw[-latex, blue] (x2) -- (fk);
\draw[-latex, blue] (fk) -- (y2);



%\foreach \i in {1, 2, 3} {
%\node (X\i) at (\i*4cm,0) [ellipse,minimum width=1cm,minimum height=2cm,draw] {};
%\node (x) [above of=X\i,node distance=1.2cm] {$X$};
%\node (Y\i) [right of=X\i,ellipse,minimum width=1cm,minimum height=2cm,node distance=1.5cm,draw] {};
%\node (y) [above of=Y\i,node distance=1.2cm] {$Y$};
%}
%\node (cr) at ($(X1)+(0.75cm,-1.5cm)$) [] {\footnotesize Collision};
%\node (cr) at ($(X1)+(0.75cm,-1.8cm)$) [] {\footnotesize Resistance};
%\node (x1) at ($(X1)+(0,0.3cm)$) [uk] {\tiny ?};
%\node (x2) at ($(X1)+(0,-0.3cm)$) [uk] {\tiny ?};
%\node (y1) at ($(Y1)$) [uk] {\tiny ?};
%\draw[-latex] (x1) -- (y1);
%\draw[-latex] (x2) -- (y1);
%\node (2pr) at ($(X2)+(0.75cm,-1.5cm)$) [] {\footnotesize 2nd Pre-image};
%\node (2pr) at ($(X2)+(0.75cm,-1.8cm)$) [] {\footnotesize Resistance};
%\node (x1) at ($(X2)+(0,0.3cm)$) [kk] {\tiny x};
%\node (x2) at ($(X2)+(0,-0.3cm)$) [uk] {\tiny ?};
%\node (y1) at ($(Y2)$) [kk] {\tiny y};
%\draw[-latex] (x1) -- (y1);
%\draw[-latex] (x2) -- (y1);
%\node (pr) at ($(X3)+(0.75cm,-1.5cm)$) [] {\footnotesize Pre-image};
%\node (pr) at ($(X3)+(0.75cm,-1.8cm)$) [] {\footnotesize Resistance};
%%\node (x1) at ($(X3)+(0,0.3cm)$) [kk] {\tiny x};
%\node (x2) at ($(X3)+(0,-0.3cm)$) [uk] {\tiny ?};
%\node (y1) at ($(Y3)$) [kk] {\tiny y};
%%\draw[-latex] (x1) -- (y1);
%\draw[-latex] (x2) -- (y1);
\end{tikzpicture}

0 comments on commit 1491dc2

Please sign in to comment.