Line 5... |
Line 5... |
%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%
|
% Document variables
|
% Document variables
|
%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%
|
\docDate{ \today }
|
\docDate{ \today }
|
\docID{Present cipher (32 bit input)}
|
\docID{Present cipher (32 bit input)}
|
\docRevision{0.1}
|
\docRevision{0.2}
|
\docStatus{Draft}
|
\docStatus{Draft}
|
\docTitle{\mbox{Present Cipher (32 bit input)}}
|
\docTitle{\mbox{Present Cipher (32 bit input)}}
|
\authorName{\mbox{Krzysztof Gajewski} \\ and opencores.org}
|
\authorName{\mbox{Krzysztof Gajewski} \\ and opencores.org}
|
\authorURL{www.opencores.org}
|
\authorURL{www.opencores.org}
|
\authorAddress{\mbox{}}
|
\authorAddress{\mbox{}}
|
\authorEmail{gajos@opencores.org}
|
\authorEmail{gajos@opencores.org}
|
|
|
\revisionList{
|
\revisionList{
|
0.1 & all & 2014/09/05 & First draft & K. Gajewski \\
|
0.1 & all & 2014/09/05 & First draft & K. Gajewski \\
|
|
0.2 & all & 2014/09/16 & Some small corrections with the text, typos, etc. & K. Gajewski \\
|
}
|
}
|
|
|
\begin{document}
|
\begin{document}
|
|
|
\maketitle
|
\maketitle
|
Line 36... |
Line 37... |
|
|
Present is \textgravedbl ultra-lightweight\textacutedbl \space block cipher developed by A. Bogdanov et al. and proposed in 2007 \cite{PRESENT}. It uses 64 bit data block and 80 bit or 128 bit key.
|
Present is \textgravedbl ultra-lightweight\textacutedbl \space block cipher developed by A. Bogdanov et al. and proposed in 2007 \cite{PRESENT}. It uses 64 bit data block and 80 bit or 128 bit key.
|
This cipher consists of 32 rounds, during which:
|
This cipher consists of 32 rounds, during which:
|
\begin{itemize}
|
\begin{itemize}
|
\item round key is added to plaintext
|
\item round key is added to plaintext
|
\item plaintext goues through sBoxes (substitution boxes)
|
\item plaintext goes through sBoxes (substitution boxes)
|
\item plaintext after sBoxes goes through pLayer (permutation layer)
|
\item plaintext after sBoxes goes through pLayer (permutation layer)
|
\item round key is updated
|
\item round key is updated
|
\end{itemize}
|
\end{itemize}
|
After that, ciphertext feeds out the output. Briefly algorithm was shown in Fig. \ref{pAlgorithm}
|
After that, ciphertext feeds out the output. Briefly algorithm was shown in Fig. \ref{pAlgorithm}.
|
\begin{figure}[!ht]%
|
\begin{figure}[!ht]%
|
\begin{center}
|
\begin{center}
|
\includegraphics[width=0.66\textwidth]{img/presentAlgorithm.png}
|
\includegraphics[width=0.66\textwidth]{img/presentAlgorithm.png}
|
\caption{%
|
\caption{%
|
Briefly block scheme of the PRESENT block cipher
|
Briefly block scheme of the PRESENT block cipher
|
}%
|
}%
|
\label{pAlgorithm}
|
\label{pAlgorithm}
|
\end{center}
|
\end{center}
|
\end{figure}
|
\end{figure}
|
In this project Present block cipher works with 80 bit key. Target was Xilinx\textsuperscript{\textregistered} Spartan 3E XC3S500E \cite{Spartan} on Spartan 3E Starter Board \cite{Digilent} made by Digilent\textsuperscript{\textregistered}. In comparison with "plain" Present cipher projecy, this core was modified to take 32 bit word at input (plus control word). Output is also 32 bit.
|
In this project Present block cipher works with 80 bit key. Target was Xilinx\textsuperscript{\textregistered} Spartan 3E XC3S500E \cite{Spartan} on Spartan 3E Starter Board \cite{Digilent} made by Digilent\textsuperscript{\textregistered}. In comparison with "plain" Present cipher project, this core was modified to take 32 bit word at input (plus control word). Output is also 32 bit.
|
|
|
\textbf{NOTE:}
|
\textbf{NOTE:}
|
|
|
This is rather "historical" project and is not recommended for future use.
|
This is rather "historical" project and is not recommended for future use.
|
|
|
\newpage
|
\newpage
|
|
|
\section{Interface}
|
\section{Interface}
|
|
|
Top level component of present was shown in Fig. \ref{penc}. All inputs and outputs are synchronous except \texttt{reset} signal and sampled at rising edge of the clock. Type for all signals is \texttt{STD\_LOGIC} or \texttt{STD\_LOGIC\_VECTOR}.
|
Top level component of the Present component with 32 bit input was shown in Fig. \ref{penc}. All inputs and outputs are synchronous except \texttt{reset} signal and sampled at rising edge of the clock. Type for all signals is \texttt{STD\_LOGIC} or \texttt{STD\_LOGIC\_VECTOR}.
|
\begin{figure}[!ht]%
|
\begin{figure}[!ht]%
|
\begin{center}
|
\begin{center}
|
\includegraphics[width=0.5\textwidth]{img/PresentEnc.png}
|
\includegraphics[width=0.5\textwidth]{img/PresentEnc.png}
|
\caption{%
|
\caption{%
|
Top level component of Present component
|
Top level of the Present component with 32 bit input
|
}%
|
}%
|
\label{penc}
|
\label{penc}
|
\end{center}
|
\end{center}
|
\end{figure}
|
\end{figure}
|
|
|
\begin{tabularx}{\textwidth}{|p{30mm}|p{11mm}|p{11mm}|X|}
|
\begin{tabularx}{\textwidth}{|p{30mm}|p{11mm}|p{11mm}|X|}
|
\hline \bf{Signal name} & \bf{Width} & \bf{In/Out} & \bf{Description}\\
|
\hline \bf{Signal name} & \bf{Width} & \bf{In/Out} & \bf{Description}\\
|
\hline \texttt{input} & 32 & in & input data - both key and plaintext. \\
|
\hline \texttt{input} & 32 & in & input data - both key and plaintext. \\
|
\hline \texttt{ctrl} & 4 & in & control bus for sending commands to the core. \\
|
\hline \texttt{ctrl} & 4 & in & control bus for sending commands to the core. \\
|
\hline \texttt{clk} & 1 & in & clock signal for the component\\
|
\hline \texttt{clk} & 1 & in & clock signal for the component\\
|
\hline \texttt{reset} & 1 & in & \emph{Asynchronous} reset signal. \\
|
\hline \texttt{reset} & 1 & in & \emph{asynchronous} reset signal. \\
|
\hline \texttt{output} & 32 & out & output data - ciphertext. \\
|
\hline \texttt{output} & 32 & out & output data - ciphertext. \\
|
\hline \texttt{ready} & 1 & out & signal informing about end of encoding process. \newline "0" - wait until end of data encoding. \newline "1" - end of the encoding process, output data available. \\
|
\hline \texttt{ready} & 1 & out & signal informing about end of encoding process. \newline "0" - wait until end of data encoding. \newline "1" - end of the encoding process, output data available. \\
|
\hline
|
\hline
|
\end{tabularx}
|
\end{tabularx}
|
\captionof{table}{Input/Output signals of Present component}
|
\captionof{table}{Input/Output signals of the Present component with 32 bit input}
|
|
|
\newpage
|
\newpage
|
|
|
\section{State machine workflow}
|
\section{State machine workflow}
|
|
|
Overall internal structure of Present component is similar to the structure shown in \cite{PRESENT}. To conform 64 bit plaintext, 80 bit key and 32 bit output data, multiplexer-like blocks was added to fit data. Additionally, control logic was added in the state machine. It was shown in Fig. \ref{presentSM}.
|
Overall internal structure of the Present component with 32 bit input is similar to the structure shown in \cite{PRESENT}. To conform 64 bit plaintext, 80 bit key and 32 bit output data, multiplexer-like blocks was added to fit data. Additionally, control logic was added in the state machine. It was shown in Fig. \ref{presentSM}.
|
|
|
\begin{figure}[!ht]%
|
\begin{figure}[!ht]%
|
\begin{center}
|
\begin{center}
|
\includegraphics[width=0.5\textwidth]{img/SM.jpg}
|
\includegraphics[width=0.5\textwidth]{img/SM.jpg}
|
\caption{%
|
\caption{%
|
Line 99... |
Line 100... |
}%
|
}%
|
\label{presentSM}
|
\label{presentSM}
|
\end{center}
|
\end{center}
|
\end{figure}
|
\end{figure}
|
|
|
State machine consist of nine states \texttt{NOP}, \texttt{RDK1}, \texttt{RDK2}, \texttt{RDK3}, \texttt{RDT1}, \texttt{RDT2}, \texttt{COD}, \texttt{CTO1}, \texttt{CTO2}. \texttt{NOP} is default state after resetting the core. This state is active as long as control bus (\texttt{ctrl}) don't have \texttt{crdk1} command at the input.
|
State machine consist of nine states \texttt{NOP}, \texttt{RDK1}, \texttt{RDK2}, \texttt{RDK3}, \texttt{RDT1}, \texttt{RDT2}, \texttt{COD}, \texttt{CTO1}, \texttt{CTO2}. \texttt{NOP} is the default state after resetting the core. This state is active as long as control bus (\texttt{ctrl}) don't have \texttt{crdk1} command at the input.
|
|
|
\texttt{RDKx} states are responsible for reading the key from the input. They are changing when suitable command appears at the \texttt{ctrl} input (\ref{presentSM}). When another commands appear, the state is changing to \texttt{NOP} state. When command are left constant, given state is not changing.
|
\texttt{RDKx} states are responsible for reading the key from the input. They are changing when suitable command appears at the \texttt{ctrl} input (\ref{presentSM}). When another commands appear, the state is changing to the \texttt{NOP} state. When command are left constant, given state is not changing.
|
|
|
\texttt{RDTx} states are responsible for reading the plaintext from the input. They are changing when suitable command appears at the \texttt{ctrl} input (\ref{presentSM}). When another commands appear, the state is changing to \texttt{NOP} state. When command are left constant, given state is not changing.
|
\texttt{RDTx} states are responsible for reading the plaintext from the input. They are changing when suitable command appears at the \texttt{ctrl} input (\ref{presentSM}). When another commands appear, the state is changing to \texttt{NOP} state. When command are left constant, given state is not changing.
|
|
|
During \texttt{COD} state encoding process start. If encoding process ends (after 32 clock cycles, \texttt{info = "00"} signal from the counter), state machine automaticly goes to \texttt{CTO1} state. When commands another than \texttt{ccod} appear, the state is changing to \texttt{NOP} state. When command are left constant encoding process is working.
|
During the \texttt{COD} state encoding process start. If encoding process ends (after 32 clock cycles, \texttt{info = "00"} signal from the counter), state machine automaticly goes to the \texttt{CTO1} state. When commands another than \texttt{ccod} appear, the state is changing to the \texttt{NOP} state. When command are left constant encoding process is working.
|
|
|
\texttt{CTOx} states are responsible for sending the ciphertext to the output. They are changing when suitable command appears at the \texttt{ctrl} input (\ref{presentSM}). When another commands appear, the state is changing to \texttt{NOP} state. When command are left constant, given state is not changing.
|
\texttt{CTOx} states are responsible for sending the ciphertext to the output. They are changing when suitable command appears at the \texttt{ctrl} input (\ref{presentSM}). When another commands appear, the state is changing to the \texttt{NOP} state. When command are left constant, given state is not changing.
|
|
|
\newpage
|
\newpage
|
|
|
\section{FPGA implementations}
|
\section{FPGA implementations}
|
|
|
The component has only been verified on a Xilinx\textsuperscript{\textregistered} Spartan 3E XC3S500E FPGA in FG320 package and synthesized with Xilinx ISE 14.2. Appropriate setup files was prepared with use of ISE Project Navigator, but Makefile scripts was also written. Suitable files was stored in \texttt{./32BitIO/syn/XC3ES500/} directory. Implementation in FPGA device \textbf{was not} in this project (due to rather historical issues and nonconventional build of these core). Makefile was tested in Windows 8 with use of Cygwin for 64-bit Windows.
|
The component has only been verified on a Xilinx\textsuperscript{\textregistered} Spartan 3E XC3S500E FPGA in FG320 package and synthesized with Xilinx ISE 14.2. Appropriate setup files was prepared with the use of ISE Project Navigator, but Makefile scripts was also written. Suitable files was stored in \texttt{./32BitIO/syn/XC3ES500/} directory. Implementation in FPGA device \textbf{was not done} in this project (due to rather historical issues and nonconventional build of these core). Makefile was tested in Windows 8 with the use of Cygwin for 64-bit Windows.
|
|
|
Synthesis results was given in Fig. \ref{SynResults}
|
Synthesis results was given in Fig. \ref{SynResults}
|
|
|
\begin{tabularx}{\textwidth}{|p{45mm}|p{30mm}|p{30mm}|X|}
|
\begin{tabularx}{\textwidth}{|p{45mm}|p{30mm}|p{30mm}|X|}
|
\hline \multicolumn{4}{|c|}{Xilinx \textregistered Spartan 3E XC3S500E FPGA in FG320 package} \\
|
\hline \multicolumn{4}{|c|}{Xilinx \textregistered Spartan 3E XC3S500E FPGA in FG320 package} \\
|
Line 126... |
Line 127... |
\hline Number of Slice Flip Flops & 262 & 9312 & 2\% \\
|
\hline Number of Slice Flip Flops & 262 & 9312 & 2\% \\
|
\hline Number of 4 input LUTs & 460 & 9312 & 4\% \\
|
\hline Number of 4 input LUTs & 460 & 9312 & 4\% \\
|
\hline Number of bonded IOBs & 71 & 232 & 30\% \\
|
\hline Number of bonded IOBs & 71 & 232 & 30\% \\
|
\hline Number of GCLKs & 1 & 24 & 4\%\\
|
\hline Number of GCLKs & 1 & 24 & 4\%\\
|
\hline Minimum period & 4.250 ns & - & - \\
|
\hline Minimum period & 4.250 ns & - & - \\
|
\hline Maximum Frequency & 235.311 MHz & - & - \\
|
\hline Maximum Frequency & 235 MHz & - & - \\
|
\hline
|
\hline
|
\end{tabularx}
|
\end{tabularx}
|
\label{SynResults}
|
\label{SynResults}
|
\captionof{table}{Synthesis results for Spartan 3E XC3S500E}
|
\captionof{table}{Synthesis results for Spartan 3E XC3S500E}
|
|
|
Line 146... |
Line 147... |
|
|
\newpage
|
\newpage
|
|
|
\section{Simulation}
|
\section{Simulation}
|
|
|
Self-checking test bench were provided to the components used for Present encoder. In case of whole Present encoder this test bench was not self-checking. This is due to historical character of this project. They are stored in \texttt{./32BitIO/bench/vhdl} directory. Suitable configuration files and Makefile used for running test bench was stored in
|
Self-checking test bench were provided to the components used for Present encoder. In case of whole Present with 32 bit input encoder this test bench was not self-checking. This is due to historical character of this project. They are stored in \texttt{./32BitIO/bench/vhdl} directory. Suitable configuration files and Makefile used for running test bench was stored in
|
\texttt{./32BitIO/sim/rtl\_sim/bin} directory. Appropriate test vectors was taken from \cite{PRESENT}.
|
\texttt{./32BitIO/sim/rtl\_sim/bin} directory. Appropriate test vectors was taken from \cite{PRESENT}.
|
|
|
Makefile was prepared to make "manual run" of tests. If You want to perform it without gui, remove \texttt{-gui} option in Makefaile.
|
Makefile was prepared to make "manual run" of tests. If You want to perform it without gui, remove \texttt{-gui} option in Makefaile.
|
|
|
\newpage
|
\newpage
|