diff options
author | Karl Berry <karl@freefriends.org> | 2018-11-11 21:55:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-11-11 21:55:56 +0000 |
commit | c323e97ada4b9c09aee417afa1db2efe4ce12e99 (patch) | |
tree | e9a1e690ad071a63e0799dc28c56e8ea972b3562 /Master/texmf-dist/doc/latex | |
parent | a797deba5707684edfdc10e6c0ffe8edcc5a9664 (diff) |
cryptocode (11nov18)
git-svn-id: svn://tug.org/texlive/trunk@49131 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex')
-rw-r--r-- | Master/texmf-dist/doc/latex/cryptocode/README | 12 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/cryptocode/cryptocode.pdf | bin | 901298 -> 981559 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/cryptocode/cryptocode.tex | 371 |
3 files changed, 335 insertions, 48 deletions
diff --git a/Master/texmf-dist/doc/latex/cryptocode/README b/Master/texmf-dist/doc/latex/cryptocode/README index 13be19840bc..4d95ad33dc3 100644 --- a/Master/texmf-dist/doc/latex/cryptocode/README +++ b/Master/texmf-dist/doc/latex/cryptocode/README @@ -1,8 +1,10 @@ -The cryptocode bundle provides commands and commands for easily typesetting -pseudocode and simple protocols as well as environments for visualizing -game-based proofs and black-box reductions as often used within the cryptographic -community. +The cryptocode package provides a set of macros to ease the typesetting of +pseudocode, algorithms and protocols. In addition it comes with a wide range +of tools to typeset cryptographic papers (hence the name). +This includes simple predefined commands for concepts such as +a security parameter or advantage terms but also flexible and powerful +environments to layout game-based proofs or black-box reductions. The cryptocode bundle is licensed under the LaTeX Project Public License - -- Arno Mittelbach <mail@arno-mittelbach.de> 22 Apr 2015
\ No newline at end of file + -- Arno Mittelbach <mail@arno-mittelbach.de> 11 Nov 2018
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/cryptocode/cryptocode.pdf b/Master/texmf-dist/doc/latex/cryptocode/cryptocode.pdf Binary files differindex 20eba7122cb..e2817d214a6 100644 --- a/Master/texmf-dist/doc/latex/cryptocode/cryptocode.pdf +++ b/Master/texmf-dist/doc/latex/cryptocode/cryptocode.pdf diff --git a/Master/texmf-dist/doc/latex/cryptocode/cryptocode.tex b/Master/texmf-dist/doc/latex/cryptocode/cryptocode.tex index fbbb292109f..3abe7f40b43 100644 --- a/Master/texmf-dist/doc/latex/cryptocode/cryptocode.tex +++ b/Master/texmf-dist/doc/latex/cryptocode/cryptocode.tex @@ -1,4 +1,4 @@ - %% Copyright 2015 Arno Mittelbach +%% Copyright 2018 Arno Mittelbach % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -45,7 +45,6 @@ \usepackage{url} - \usetikzlibrary{shapes.callouts} \usepackage{listings} @@ -107,10 +106,11 @@ \begin{abstract} \thispagestyle{empty} -The cryptocode package is targeted at cryptographers typesetting their results in \LaTeX. -It provides various predefined commands for different topics in cryptography. -In particular it provides an easy interface to write pseudocode, protocols, game based proofs -and draw black-box reductions. +The cryptocode package provides a set of macros to ease the typesetting of +pseudocode, algorithms and protocols (such as the one below). In addition it comes with a wide range of tools to typeset cryptographic papers (hence the name). +This includes simple predefined commands for concepts such as +a security parameter $\secparam$ or advantage terms $\advantage{prf}{\adv,\prf} = \negl$ but also flexible and powerful +environments to layout game-based proofs or black-box reductions. \vspace{2em} \begin{center} @@ -139,10 +139,12 @@ x \sample \ZZ_q \< \< \\ \newpage \pagenumbering{arabic} + + \chapter{Cryptocode by Example} -Cryptocode is a \LaTeX package to ease the writing of cryptographic papers. It provides mechanisms -for writing pseudocode, protocols, game-based proofs and black-box reductions. In addition it comes +The cryptocode package provides a set of commands to ease the typesetting of +pseudocode, protocols, game-based proofs and black-box reductions. In addition it comes with a large number of predefined commands. In this chapter we present the various features of cryptocode by giving small examples. But first, let's load the package @@ -422,7 +424,8 @@ Cryptocode makes heavy use of TIKZ (\url{https://www.ctan.org/pkg/pgf}) for this quite some control over how things should look like. Additionally, as you can specify node names (for example the outer box in the next example is called \enquote{A}) you can easily extend the pictures by using plain TIKZ commands. -\begin{bbrenv}{A} + +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Reduction] \pseudocode{ \text{Do something} \\ @@ -689,13 +692,17 @@ For denoting entropy and min-entropy use \begin{lstlisting} \entropy{X} \minentropy{X} +\condentropy{X}{Y=5} \condminentropy{X}{Y=5} +\condavgminentropy(X}{Y=5} \end{lstlisting} This yields \begin{align*} & \entropy{X} \\ & \minentropy{X} \\ -& \condminentropy{X}{Y=5} +& \condentropy{X}{Y=5} \\ +& \condminentropy{X}{Y=5} \\ +& \condavgminentropy{X}{Y=5} \end{align*} \section{Sets} @@ -766,7 +773,11 @@ The \enquote{logic} option provides the following list of commands: \begin{tabular}{l l l} \textbf{Command} & \textbf{Description} & \textbf{Result} \\\hline \lstinline$\AND$ & Logical AND & $\AND$ \\ +\lstinline$\NAND$ & Logical NAND & $\NAND$ \\ \lstinline$\OR$ & Logical OR & $\OR$ \\ +\lstinline$\NOR$ & Logical NOR & $\NOR$ \\ +\lstinline$\XOR$ & Logical XOR & $\XOR$ \\ +\lstinline$\XNOR$ & Logical XNOR & $\XNOR$ \\ \lstinline$\NOT$ & not & $\NOT$ \\ \lstinline$\xor$ & exclusive or & $\xor$ \\ \lstinline$\false$ & false & $\false$ \\ @@ -788,6 +799,7 @@ The \enquote{ff} option provides the following list of commands: \lstinline$\kgen$ & Key generation & $\kgen$ \\ \lstinline$\pgen$ & Parameter generation & $\pgen$ \\ \lstinline$\eval$ & Evaluation & $\eval$ \\ +\lstinline$\invert$ & Inversion & $\invert$ \\ \lstinline$\il$ & Input length & $\il$ \\ \lstinline$\ol$ & Output length & $\ol$ \\ \lstinline$\kl$ & Key length & $\kl$ \\ @@ -965,7 +977,7 @@ In this chapter we discuss how to write pseudocode with the cryptocode library. \section{Basics} \index{\textbackslash pseudocode} -The cryptocode package provides the command \emph{pseudocode} in order to write simple cryptostyle algorithms. +The cryptocode package provides the command \emph{pseudocode} for typesetting algorithms. Consider the following definition of an IND-CPA game \begin{center} \fbox{% @@ -1026,6 +1038,9 @@ Code \index{yshift} \index{bodylinesep} \index{headlinesep} +\index{jot} +\index{beginline} +\index{endline} Besides the mandatory argument the \lstinline{\pseudocode} command can take an optional argument which consists of a list of key=value pairs separated by commas (,). @@ -1070,6 +1085,18 @@ If set to \enquote{auto} it will try to detect spacing according to keywords suc \item[codesize] Allows to specify the fontsize for the pseudocode. Set to \lstinline$\scriptsize$ for a smaller size. +\item[colspace] +Allows to insert spacing between columns. In particular this allows to also overlap columns by inserting negative space. + +\item[jot] +Allows to specify extra space between each line. Use \lstinline$jot=1mm$. + +\item[beginline] +Allows to specify a macro that is placed at the beginning of each line. + +\item[endline] +Allows to specify a macro that is placed at the end of each line. + \item[xshift] Allows horizontal shifting \item[yshift] @@ -1083,6 +1110,10 @@ Specifies the distance between body and the line. Defines the space between columns. \item[addtolength] Is added to the automatically computed width of the pseudocode (which does not take colsep into account). + +\item[valign] +Controls the vertical alignment of the pseudocode. Pseudocode is wrapped in a minipage environment and valign value is passed as orientation for the minipage. By default valign is set to \enquote{t}. + \item[nodraft] Forces syntax highlighting also in draft mode. \end{description} @@ -1129,7 +1160,7 @@ which is generated as \pcreturn b = b' } \end{lstlisting} -You can define customized pseudocode commands with either take one optional argument and two mandatory arguments (as the procedure command) +You can define customized pseudocode commands which either take one optional argument and two mandatory arguments (as the procedure command) or one optional and one mandatory argument (as the pseudocode command). The following \begin{lstlisting} \createprocedurecommand{mypseudocode}{}{}{linenumbering} @@ -1296,6 +1327,8 @@ This is \\ \section{Syntax Highlighting} \label{sec:syntaxhighlight} +\index{\textbackslash pcabort} +\index{\textbackslash pcfail} \index{\textbackslash pccontinue} \index{\textbackslash pccomment} \index{\textbackslash pcdo} @@ -1328,10 +1361,12 @@ examples the package defines the following set of constants: \begin{center} \begin{tabular}{lll} \textbf{name} & \textbf{usage} & \textbf{outcome} \\ + pcabort & \lstinline$\pcabort$ & \pcabort\\ pccontinue & \lstinline$\pccontinue$ & \pccontinue \\ pccomment & \lstinline$\pccomment{comment}$ & \pccomment{comment} \\ pcdo & \lstinline$\pcdo$ & \pcdo \\ pcdone & \lstinline$\pcdone$ & \pcdone \\ + pcfail & \lstinline$\pcfail$ & \pcfail \\ pcfalse & \lstinline$\pcfalse$ & \pcfalse \\ pcif & \lstinline$\pcif$ & \pcif \\ pcfi & \lstinline$\pcfi$ & \pcfi \\ @@ -1348,8 +1383,8 @@ examples the package defines the following set of constants: pcnull & \lstinline$\pcnull$ & \pcnull \\ pcparse & \lstinline$\pcparse$ & \pcparse \\ pcrepeat & \lstinline$\pcrepeat{10}$ & \pcrepeat{10} \\ + pcreturn & \lstinline$\pcreturn$ & \pcreturn \\ pcuntil & \lstinline$\pcuntil$ & \pcuntil \\ - pcreturn & \lstinline$\pcreturn$ & \pcreturn \\ pcthen & \lstinline$\pcthen$ & \pcthen \\ pctrue & \lstinline$\pctrue$ & \pctrue \\ pcwhile & \lstinline$\pcwhile$ & \pcwhile \\ @@ -1861,7 +1896,7 @@ Horizontal and vertical stacking can be combined \section{Divisions and Linebreaks} \index{linebreaks} \index{\textbackslash hline} -Within the pseudocode command you generate linebreaks as $\\$. In order to specify the linewidth you can add an optional argument +Within the pseudocode command you generate linebreaks as \lstinline$\\$. In order to specify the linewidth you can add an optional argument \begin{lstlisting} \\[height] \end{lstlisting} @@ -1892,6 +1927,53 @@ Furthermore, you can add, for example a horizontal line by using the second opti \pcln \pcreturn b = b' } \end{lstlisting} +\section{Matrices and Math Environments within pseudocode} + +In order to work its magic, cryptocode (in particular within the \lstinline{\pseudocode} command) mingles with a few low level commands such as +\lstinline{\\} or \lstinline{\halign}. The effect of this is, that when you use certain math environments, for example, to create matrices, within pseudocode +the result may be unexpected. Consider the following example + +\begin{lstlisting} +\pseudocode{ +\text{compute } P = \begin{pmatrix} + A \\ B + C +\end{pmatrix} +} +\end{lstlisting} + +which, somewhat unexpectedly, yields + +\begin{center} +\fbox{ +\pseudocode{ +\text{compute } P = \begin{pmatrix} + A \\ B + C +\end{pmatrix} +} +} +\end{center} + +That is, the alignment is somewhat off. In order, to allow for the \emph{pmatrix} environment to properly work without interference from \lstinline{\pseudocode} +you can wrap it into a \emph{pcmbox} environment (where pcmbox is short for pseudocode math box). This ensures that the low-level changes introduced by \lstinline{\pseudocode} are not active. + +\begin{lstlisting} +\pseudocode{ +\text{compute } P = \begin{pcmbox}\begin{pmatrix} + A \\ B + C +\end{pmatrix}\end{pcmbox} +} +\end{lstlisting} + +\begin{center} +\fbox{ +\pseudocode{ +\text{compute } P = \begin{pcmbox}\begin{pmatrix} + A \\ B + C +\end{pmatrix}\end{pcmbox} +} +} +\end{center} + \section{Fancy Code with Overlays} @@ -2771,6 +2853,56 @@ to add the gamehop in the middle. \end{gameproof} \end{lstlisting} +\subsection{Styling game procedures} +It may come in handy to define default style arguments for the underlying pseudocode +command used by \lstinline$\gameprocedure$. For this you can +define the default arguments by calling \lstinline{\setgameproceduredefaultstyle} to +for example: + +\begin{lstlisting} +\setgameproceduredefaultstyle{beginline=\vphantom{\bin^\prg_\prg} +\end{lstlisting} + +The default is to not set any options. + +\section{Game Descriptions} +Cryptocode also comes with an environment to provide textual descriptions of games such as + + + \begin{gamedescription}[name=MyGame,nr=2] +\describegame + This is the third game. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis condimentum velit et orci volutpat, sed ultrices lorem lobortis. Nam vehicula, justo eu varius interdum, felis mi consectetur dolor, ac posuere nulla lacus varius diam. Etiam dapibus blandit leo, et porttitor augue lacinia auctor. + +\describegame[inhint=reduction target] + This is the second game. The arrow at the side indicates the reduction target. + \end{gamedescription} + + The above example is generated as + +\begin{lstlisting} +\begin{gamedescription}[name=MyGame,nr=2] +\describegame +This is the third game. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis condimentum velit et orci volutpat, sed ultrices lorem lobortis. Nam vehicula, justo eu varius interdum, felis mi consectetur dolor, ac posuere nulla lacus varius diam. Etiam dapibus blandit leo, et porttitor augue lacinia auctor. + +\describegame[inhint=reduction target] +This is the second game. The arrow at the side indicates the reduction target. +\end{gamedescription} +\end{lstlisting} + +The \emph{gamedescription} environment takes an optional argument to specify name and counter (defaults to Game and 0). The command +\lstinline$\describegame$ starts a new game description and can allows you to provide a reduction hint using the option parameter \emph{inhint}. + +\begin{center} +\begin{tabular}{ll} +\textbf{Parameter} & \textbf{Description} \\ +\lstinline$inhint$ & Displays an ingoing arrow to denote the reduction target for this game hop.\\ +\lstinline$length$ & Allows to control the length of the arrow. \\ +\lstinline$nodestyle$ & Allows to control the style of the node. \\ +\lstinline$hint$ & Instead of having an ingoing arrow, this adds an outgoing arrow. \\ +\end{tabular} +\end{center} + + \chapter{Black-box Reductions} \label{chap:bbr} \index{bbrenv} @@ -2793,7 +2925,8 @@ That is, a \enquote{bbrenv} (where bbr is short for black-box reduction) environ \enquote{bbrbox} environment and some additional commands. The following is a simple example drawing one (black)box with some code and input output: -\begin{bbrenv}{A} + +\begin{bbrenv}[1cm]{A}[1cm] \begin{bbrbox}[name=Box Name] \pseudocode{ \text{step 1} \\ @@ -2805,9 +2938,10 @@ The following is a simple example drawing one (black)box with some code and inpu \bbrinput{input} \bbroutput{output} \end{bbrenv} + This box is generated as \begin{lstlisting} -\begin{bbrenv}{A} +\begin{bbrenv}[1cm]{A}[1cm] \begin{bbrbox}[name=Box Name] \pseudocode{ \text{step 1} \\ @@ -2822,14 +2956,17 @@ This box is generated as \end{lstlisting} The commands \lstinline$bbrinput$ and \lstinline$bbroutput$ allow to specify input and output for the latest -''bbrenv´´ environment. The single argument to the bbrenv environment needs to specify a unique identifier +\enquote{bbrenv} environment. The optional parameters for the \lstinline$bbrenv$ environment allow to specify leading and trailing space (this +may become necessary when using inputs and outputs). +The single argument to the bbrenv environment needs to specify a unique identifier (unique for the current reduction). This id is used as an internal TIKZ node name (\url{https://www.ctan.org/pkg/pgf}). \begin{lstlisting} -\begin{bbrenv}{UNIQUE IDENTIFIER} +\begin{bbrenv}[vspace before]{UNIQUE IDENTIFIER}[vspace after] \end{lstlisting} As we are drawing a TIKZ image, note that we can easily later customize the image using the labels that we have specified on the way. -\begin{bbrenv}{A} + +\begin{bbrenv}[1cm]{A}[1cm] \begin{bbrbox}[name=Box Name] \pseudocode{ \text{step 1} \\ @@ -2874,16 +3011,19 @@ to specify the label. The following options are available \index{namepos} \index{namestyle} +\index{abovesep} \index{minheight} \index{xshift} \index{yshift} \begin{center} \begin{tabular}{ll} \textbf{Option} & \textbf{Description} \\ \hline -name & Specifies the box' label \\ -namepos & Specifies the position (left, center, right, top left, top center, top right) \\ +name & Specifies the box's label \\ +namepos & Specifies the position (left, center, right, top left, top center, top right, middle) \\ namestyle & Specifies the style of the name \\ +abovesep & Space above box (defaults to \lstinline$\baselineskip$) \\ minheight & The minimal height \\ +addheight & Additional height at the end of the box \\ xshift & Allows horizontal positioning \\ yshift & Allows horizontal positioning \\ style & allows to customize the node @@ -2895,7 +3035,7 @@ style & allows to customize the node Boxes can be nested. For this simply insert a bbrenv (together with a single bbrbox) environment into an existing bbrbox. -\begin{bbrenv}{A} +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Box Name] \pseudocode{ \text{step 1} \\ @@ -2908,14 +3048,14 @@ existing bbrbox. \begin{bbrbox}[name=Inner Box] \pseudocode{ \text{inner step 1} \\ - \text{inner step 2} \\ + \text{inner step 2} } \end{bbrbox} \end{bbrenv} \pseudocode{ \text{step 4} \\ - \text{step 5} \\ + \text{step 5} } \end{bbrbox} \bbrinput{input} @@ -2936,14 +3076,14 @@ existing bbrbox. \begin{bbrbox}[name=Inner Box] \pseudocode{ \text{inner step 1} \\ - \text{inner step 2} \\ + \text{inner step 2} } \end{bbrbox} \end{bbrenv} \pseudocode{ \text{step 4} \\ - \text{step 5} \\ + \text{step 5} } \end{bbrbox} \bbrinput{input} @@ -2979,7 +3119,7 @@ If your label contains a \enquote{,} (comma), then group the label in $\{\}$ (cu Following is a complete example. Notice that cryptocode takes care of the vertical positioning. -\begin{bbrenv}{A} +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Box Name] \pseudocode{ \text{step 1} \\ @@ -2992,7 +3132,7 @@ Following is a complete example. Notice that cryptocode takes care of the vertic \begin{bbrbox}[name=Inner Box] \pseudocode{ \text{inner step 1} \\ - \text{inner step 2} \\ + \text{inner step 2} } \end{bbrbox} @@ -3007,7 +3147,7 @@ Following is a complete example. Notice that cryptocode takes care of the vertic \pseudocode{ \text{step 4} \\ - \text{step 5} \\ + \text{step 5} } \end{bbrbox} \bbrinput{input} @@ -3028,7 +3168,7 @@ Following is a complete example. Notice that cryptocode takes care of the vertic \begin{bbrbox}[name=Inner Box] \pseudocode{ \text{inner step 1} \\ - \text{inner step 2} \\ + \text{inner step 2} } \end{bbrbox} @@ -3043,7 +3183,7 @@ Following is a complete example. Notice that cryptocode takes care of the vertic \pseudocode{ \text{step 4} \\ - \text{step 5} \\ + \text{step 5} } \end{bbrbox} \bbrinput{input} @@ -3053,7 +3193,7 @@ Following is a complete example. Notice that cryptocode takes care of the vertic \subsection{Options} Besides specifying labels for top, side and bottom you can further specify how cryptocode renders the message. -Remember that tnderneath the reduction commands is a TIKZ image (\url{https://www.ctan.org/pkg/pgf/}). +Remember that underneath the reduction commands is a TIKZ image (\url{https://www.ctan.org/pkg/pgf/}). For each label position (top, side, bottom) a node is generated. You can provide additional properties for this node using the options: \begin{itemize} @@ -3069,11 +3209,10 @@ You can additionally provide custom names for the nodes for later reference usin \item bottomname \end{itemize} The \enquote{osidename} allows you to provide a name for the \enquote{other side}. - -Via the option \enquote{length} you can specifiy the length of the arrow. +Via the option \enquote{length} you can specify the length of the arrow. -\begin{bbrenv}{A} +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Box Name] \pseudocode{ \text{step 1} \\ @@ -3143,7 +3282,8 @@ Via the option \enquote{length} you can specifiy the length of the arrow. \index{\textbackslash bbrqryspace} If the spacing between messages is not sufficient you can use the \lstinline$bbrmsgspace$ and \lstinline$bbrqryspace$ commands to add additional space. -\begin{bbrenv}{A} + +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Reduction] \pseudocode{ \text{Do something} @@ -3205,7 +3345,7 @@ If the spacing between messages is not sufficient you can use the \lstinline$bbr Often an adversary may send poly many queries to an oracle, or a reduction sends many queries to an adversary. Consider the following setting -\begin{bbrenv}{A} +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Reduction] \pseudocode{ \text{Do something} @@ -3260,7 +3400,7 @@ can now use the \lstinline$bbrloop$ command to visualize that these two messages The \lstinline$bbrloop$ command takes two node names and a config which allows you to specify if the label is to be shown on the left, center or right. Here is the result. -\begin{bbrenv}{A} +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Reduction] \pseudocode{ \text{Do something} @@ -3320,7 +3460,8 @@ and \lstinline$\bbrqrytxt$ commands. \bbrmsgtxt[options]{Text} \bbrqrytxt[options]{Text} \end{lstlisting} -\begin{bbrenv}{A} + +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Reduction] \pseudocode{ \text{Do something} @@ -3400,7 +3541,7 @@ Each box can have one or more oracles which are drawn on the right hand side of is created similarly to a \emph{bbrenv} environment using the \emph{bbroracle} environment. Oracles go behind the single \emph{bbrbox} environment within an \emph{bbrenv} enviornment. -\begin{bbrenv}{A} +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Reduction] \pseudocode{ \text{Do something} @@ -3472,7 +3613,7 @@ Here options allow you to specify where the label goes (top, bottom). In additio \lstinline$\bbroracleqryspace$ to generate extra space between oracle messages. Note that oracle messages need to be added after the closing \lstinline$\end{bbroracle}$ command. -\begin{bbrenv}{A} +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Reduction] \pseudocode{ \text{Do something} @@ -3545,7 +3686,7 @@ behave identically to oracles with the exception that they are to the left of th is created similarly to a \emph{bbrenv} environment using the \emph{bbrchallenger} environment. Challengers go behind the single \emph{bbrbox} environment within an \emph{bbrenv} enviornment. -\begin{bbrenv}{A} +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Adversary,minheight=2cm] \pseudocode{ \text{Do something} @@ -3597,7 +3738,8 @@ Here options allow you to specify where the label goes (top, bottom). In additio \lstinline$\bbrchallengerqryspace$ to generate extra space between oracle messages. Note that challenger messages need to be added after the closing \lstinline$\end{bbrchallenger}$ command. -\begin{bbrenv}{A} +\vspace{2em} +\begin{bbrenv}[1cm]{A}[0.5cm] \begin{bbrbox}[name=Adversary,minheight=2cm] \pseudocode{ \text{Do something} @@ -3639,6 +3781,149 @@ that challenger messages need to be added after the closing \lstinline$\end{bbrc \end{bbrenv} \end{lstlisting} +\section{Examples} +A reduction for full domain hash. + + +\begin{bbrenv}{Red} + + \begin{bbrbox}[name=\textsc{Reduction }$\bdv$] + + \pseudocode{ + j \sample [q] + } + + \vspace{2ex} + \emph{/* begin simulation */} + + \begin{bbrenv}{Adv} + \begin{bbrbox}[name=$\adv$,minheight=7.5cm,style={fill=black},namestyle={color=white},xshift=3cm,yshift=0.75cm] + \end{bbrbox} + + \bbrinput{$\fk$} + \bbroutput{$\sigma$} + + \bbrmsgfrom{top=$m_1$} + \bbrmsgto{bottom=$\$$,beforeskip=-0.5\baselineskip,afterskip=-0.5\baselineskip} + + \bbrmsgvdots + + \bbrmsgfrom{top=$m_{j-1}$} + \bbrmsgto{bottom=$\$$,beforeskip=-0.5\baselineskip,afterskip=-0.5\baselineskip} + + \bbrmsgfrom{top=$m_j$} + \bbrmsgto{bottom=$y$,beforeskip=-0.5\baselineskip,afterskip=-0.5\baselineskip} + + \bbrmsgfrom{top=$m_{j+1}$} + \bbrmsgto{bottom=$\$$,beforeskip=-0.5\baselineskip,afterskip=-0.5\baselineskip} + + \bbrmsgvdots + + \bbrmsgfrom{top=$m_q$} + \bbrmsgto{bottom=$\$$,beforeskip=-0.5\baselineskip,afterskip=-0.5\baselineskip} + + \begin{bbroracle}{Sign} + \begin{bbrbox}[name=Sign,namepos=center,style={draw},minheight=1cm] + \end{bbrbox} + \end{bbroracle} + + \bbroracleqryto{top=$m$} + \bbroracleqryfrom{top=$\sigma$} + + \end{bbrenv} + + + \pcdraw{ + \node[left=2cm of Adv.north west] (startsim) {}; + \node[left=2cm of Adv.south west] (endsim) {}; + \draw[->,thick] (startsim) -- (endsim); + \node[rotate=90, left=2.75cm of Adv.west,anchor=center] () {\textsc{Simulation of Random Oracle}}; + } + + \vspace{-3ex} + \emph{/* end simulation */} + + \pseudocode{ + y \gets \sigma + } + + \end{bbrbox} + \bbrqryfrom{beforeskip=0.25cm,top={$(\fk, y)$},side={\dbox{\pseudocode{ + \fk \sample \fash.\kgen(\secparam) \\ x \sample \bin^{\fash.\il(\secpar)} \\ y \gets \fash.\eval(\fk, x)} + }}} + \bbrqryto{beforeskip=10.75cm,side=\pseudocode{y \in \fash^{-1}(\fk, x)}} +\end{bbrenv} + +\begin{lstlisting} +\begin{bbrenv}{Red} + + \begin{bbrbox}[name=\textsc{Reduction }$\bdv$] + + \pseudocode{ + j \sample [q] + } + + \vspace{2ex} + \emph{/* begin simulation */} + + \begin{bbrenv}{Adv} + \begin{bbrbox}[name=$\adv$,minheight=7.5cm,style={fill=black},namestyle={color=white},xshift=3cm,yshift=0.75cm] + \end{bbrbox} + + \bbrinput{$\fk$} + \bbroutput{$\sigma$} + + \bbrmsgfrom{top=$m_1$} + \bbrmsgto{bottom=$\$$,beforeskip=-0.5\baselineskip,afterskip=-0.5\baselineskip} + + \bbrmsgvdots + + \bbrmsgfrom{top=$m_{j-1}$} + \bbrmsgto{bottom=$\$$,beforeskip=-0.5\baselineskip,afterskip=-0.5\baselineskip} + + \bbrmsgfrom{top=$m_j$} + \bbrmsgto{bottom=$y$,beforeskip=-0.5\baselineskip,afterskip=-0.5\baselineskip} + + \bbrmsgfrom{top=$m_{j+1}$} + \bbrmsgto{bottom=$\$$,beforeskip=-0.5\baselineskip,afterskip=-0.5\baselineskip} + + \bbrmsgvdots + + \bbrmsgfrom{top=$m_q$} + \bbrmsgto{bottom=$\$$,beforeskip=-0.5\baselineskip,afterskip=-0.5\baselineskip} + + \begin{bbroracle}{Sign} + \begin{bbrbox}[name=Sign,namepos=center,style={draw},minheight=1cm] + \end{bbrbox} + \end{bbroracle} + + \bbroracleqryto{top=$m$} + \bbroracleqryfrom{top=$\sigma$} + + \end{bbrenv} + + + \pcdraw{ + \node[left=2cm of Adv.north west] (startsim) {}; + \node[left=2cm of Adv.south west] (endsim) {}; + \draw[->,thick] (startsim) -- (endsim); + \node[rotate=90, left=2.75cm of Adv.west,anchor=center] () {\textsc{Simulation of Random Oracle}}; + } + + \vspace{-3ex} + \emph{/* end simulation */} + + \pseudocode{ + y \gets \sigma + } + + \end{bbrbox} + \bbrqryfrom{beforeskip=0.25cm,top={$(\fk, y)$},side={\dbox{\pseudocode{ + \fk \sample \fash.\kgen(\secparam) \\ x \sample \bin^{\fash.\il(\secpar)} \\ y \gets \fash.\eval(\fk, x)} + }}} + \bbrqryto{beforeskip=10.75cm,side=\pseudocode{y \in \fash^{-1}(\fk, x)}} +\end{bbrenv} +\end{lstlisting} \chapter{Known Issues} |