1 |
2 |
arif_endro |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2 |
|
|
% $Id: mini_aes.tex,v 1.1.1.1 2005-12-06 02:48:28 arif_endro Exp $
|
3 |
|
|
%
|
4 |
|
|
% Title : Mini AES 128
|
5 |
|
|
%
|
6 |
|
|
% Author : "Arif E. Nugroho" <arif_endro@yahoo.com>
|
7 |
|
|
%
|
8 |
|
|
% Description : Master Documentation File.
|
9 |
|
|
%
|
10 |
|
|
% Copyright (C) 2005 Arif E. Nugroho <arif_endro@yahoo.com>
|
11 |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
12 |
|
|
|
13 |
|
|
\documentclass[a4paper,12pt]{report}
|
14 |
|
|
\usepackage[english]{babel}
|
15 |
|
|
\usepackage[dvips,english,none,light,portrait]{draftcopy}
|
16 |
|
|
\usepackage{fancyvrb} % enable custom verbatim env.
|
17 |
|
|
\usepackage{float} % enable floating images
|
18 |
|
|
\usepackage{graphicx} % enable graphics in this document
|
19 |
|
|
\usepackage{titlesec} % enable customization title
|
20 |
|
|
\usepackage{fancyhdr} % enable customization header e.g. page number
|
21 |
|
|
\usepackage{setspace} % Custom line spacing
|
22 |
|
|
\usepackage{palatino}
|
23 |
|
|
%\usepackage{times} % Default font for report
|
24 |
|
|
\usepackage{indentfirst} % to make identation after sectioning
|
25 |
|
|
\usepackage[pdftitle={Mini AES 128},
|
26 |
|
|
pdfauthor={Copyright (C) 2005 Arif E. Nugroho},
|
27 |
|
|
pdfsubject={Mini AES 128},
|
28 |
|
|
pdfkeywords={AES},
|
29 |
|
|
colorlinks=false, bookmarksnumbered=false, ps2pdf,
|
30 |
|
|
pdfpagemode=none
|
31 |
|
|
]{hyperref}
|
32 |
|
|
|
33 |
|
|
\setlength{\topmargin} {0cm}
|
34 |
|
|
\setlength{\headheight} {1cm}
|
35 |
|
|
\setlength{\textheight} {21cm}
|
36 |
|
|
\setlength{\textwidth} {16cm}
|
37 |
|
|
\setlength{\oddsidemargin} {0cm}
|
38 |
|
|
\setlength{\evensidemargin}{0cm}
|
39 |
|
|
\setlength{\columnsep} {0.125in}
|
40 |
|
|
\setlength{\columnseprule} {0.5pt}
|
41 |
|
|
\setlength{\footskip} {1cm}
|
42 |
|
|
\renewcommand{\headrulewidth}{0.4pt}
|
43 |
|
|
\renewcommand{\footrulewidth}{0.4pt}
|
44 |
|
|
|
45 |
|
|
\setlength{\parindent}{1cm} % set paragraph indentation 1cm almost
|
46 |
|
|
% equal to 5 character
|
47 |
|
|
|
48 |
|
|
\lhead{\scriptsize{\textsf{\rightmark}}}
|
49 |
|
|
\rhead{\thepage}
|
50 |
|
|
\chead{}
|
51 |
|
|
\lfoot{}
|
52 |
|
|
\rfoot{}
|
53 |
|
|
\cfoot{Arif E. Nugroho\\www.opencores.org}
|
54 |
|
|
|
55 |
|
|
\titlelabel{\thetitle.\quad}
|
56 |
|
|
|
57 |
|
|
% Chapter heading layout
|
58 |
|
|
\titleformat{\chapter}[display]
|
59 |
|
|
{\normalfont\Large\filcenter\bfseries}
|
60 |
|
|
{ \vspace{1pc} \LARGE\thechapter}
|
61 |
|
|
{1pc} { \vspace{1pc} \Huge}
|
62 |
|
|
|
63 |
|
|
\onehalfspacing
|
64 |
|
|
|
65 |
|
|
\makeatletter
|
66 |
|
|
|
67 |
|
|
% numbering in equation by chapter
|
68 |
|
|
\renewcommand\theequation{\arabic{chapter}-\arabic{equation}}
|
69 |
|
|
\@addtoreset{equation}{chapter}
|
70 |
|
|
|
71 |
|
|
% numbering in figure by section
|
72 |
|
|
\renewcommand\thefigure{\arabic{chapter}-\arabic{figure}}
|
73 |
|
|
\@addtoreset{figure}{chapter}
|
74 |
|
|
|
75 |
|
|
% numbering in table by section
|
76 |
|
|
\renewcommand\thetable{\arabic{chapter}-\arabic{table}}
|
77 |
|
|
\@addtoreset{table}{chapter}
|
78 |
|
|
|
79 |
|
|
\makeatother
|
80 |
|
|
|
81 |
|
|
\title{\\Large\textbf{Mini AES 128}\\}
|
82 |
|
|
\author{Arif E. Nugroho\\
|
83 |
|
|
Department of Electrical Engineering\\
|
84 |
|
|
Institut Teknologi Bandung, Indonesia\\
|
85 |
|
|
e-mail: arif\_endro@yahoo.com}
|
86 |
|
|
\date{}
|
87 |
|
|
|
88 |
|
|
\begin{document}
|
89 |
|
|
|
90 |
|
|
\begin{titlepage}
|
91 |
|
|
\tt
|
92 |
|
|
\thispagestyle{empty}
|
93 |
|
|
\center
|
94 |
|
|
{\Large\textbf{Mini AES 128\\}}
|
95 |
|
|
\vspace{2.0cm}
|
96 |
|
|
|
97 |
|
|
%\begin{figure}[H]
|
98 |
|
|
%\center
|
99 |
|
|
%\includegraphics[width=4.0cm,height=4.0cm]{oc_logo.eps}
|
100 |
|
|
%\end{figure}
|
101 |
|
|
|
102 |
|
|
\vspace{4.5cm}
|
103 |
|
|
\normalsize
|
104 |
|
|
\textbf{Arif E. Nugroho}\\
|
105 |
|
|
$\overline{\textbf{arif\_endro@opencores.org}}$\\
|
106 |
|
|
\vspace{1.50cm}
|
107 |
|
|
%Progress: 60\%
|
108 |
|
|
\vspace{2.00cm}
|
109 |
|
|
\begin{figure}[H]
|
110 |
|
|
\center
|
111 |
|
|
\includegraphics[width=3.0cm,height=3.0cm]{oc_logo.eps}
|
112 |
|
|
\end{figure}
|
113 |
|
|
|
114 |
|
|
\vspace{1.50cm}
|
115 |
|
|
\textbf{
|
116 |
|
|
\begin{tabular}{p{4.0cm}p{10cm}}
|
117 |
|
|
& VLSI Research Group\\
|
118 |
|
|
& LabTek VIII Institut Teknologi Bandung\\
|
119 |
|
|
& Jl.~Ganesha 10 Bandung 40141\\
|
120 |
|
|
& West Java, Indonesia\\
|
121 |
|
|
\end{tabular}
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
\end{titlepage}
|
125 |
|
|
|
126 |
|
|
\pagenumbering{roman}
|
127 |
|
|
|
128 |
|
|
\tableofcontents
|
129 |
|
|
%\listoffigures
|
130 |
|
|
|
131 |
|
|
\pagestyle{fancy}
|
132 |
|
|
\chapter{AES 128}
|
133 |
|
|
|
134 |
|
|
\pagenumbering{arabic}
|
135 |
|
|
\vspace{2cm}
|
136 |
|
|
|
137 |
|
|
\section{Introduction}
|
138 |
|
|
|
139 |
|
|
The National Institute of Standards and Technology (NIST) choose the
|
140 |
|
|
Rijndael algorithm as the new Advanced Encryption Standard (AES) in
|
141 |
|
|
2001. Rijndael algorithm is a symmetric block cipher that can process
|
142 |
|
|
data block of 128 bits, using cipher keys with length of 128, 192, and
|
143 |
|
|
256 bits. The algorithm can be used on different key length and may be
|
144 |
|
|
referred to as "AES-128", "AES-192", and "AES-256". This crypto core is
|
145 |
|
|
a hardware implementation of Rijndael algorithm that process 128 bit
|
146 |
|
|
block of data using 128 bit key or ussually called as AES-128.
|
147 |
|
|
|
148 |
|
|
\section{Circuit Architecture}
|
149 |
|
|
|
150 |
|
|
The architecture of this implementation is based on the paper described
|
151 |
|
|
by P. Chodowiec \cite{chodowiec}, the schematic diagram of circuit
|
152 |
|
|
implementation is as follows:
|
153 |
|
|
|
154 |
|
|
\begin{figure}[H]
|
155 |
|
|
\center
|
156 |
|
|
\includegraphics[width=15cm,height=10cm]{circuit_schematic.eps}
|
157 |
|
|
\caption{Circuit schematic}
|
158 |
|
|
\label{circuit_schematic}
|
159 |
|
|
\end{figure}
|
160 |
|
|
|
161 |
|
|
\section{Simulation}
|
162 |
|
|
|
163 |
|
|
Simulation is done by ModelSim 6.0 SE, the simulation is performed to
|
164 |
|
|
verify the correctness of design. The encryption and decrption units has
|
165 |
|
|
been verified using Electronic Codebook (ECB) method and passed 128 test
|
166 |
|
|
vector verification phase of Tables Known Answer Test (KAT).
|
167 |
|
|
|
168 |
|
|
\section{Synthesize}
|
169 |
|
|
|
170 |
|
|
This design has been synthesized using ISE Xilinx 6.3i, here is the
|
171 |
|
|
summary of the area utilization in FPGA Xilinx:
|
172 |
|
|
|
173 |
|
|
\begin{table}[H]
|
174 |
|
|
\center
|
175 |
|
|
\includegraphics[width=8cm,height=2.5cm]{area.eps}
|
176 |
|
|
\caption{Area utilizations summary}
|
177 |
|
|
\label{area}
|
178 |
|
|
\end{table}
|
179 |
|
|
|
180 |
|
|
The maximum clock frequency is 50.155 MHz (Minimum period 19.938ns)
|
181 |
|
|
|
182 |
|
|
\section{Circuit Explanation}
|
183 |
|
|
|
184 |
|
|
\begin{figure}[H]
|
185 |
|
|
\center
|
186 |
|
|
\includegraphics[width=5cm,height=4cm]{aes128block.eps}
|
187 |
|
|
\caption{AES 128 Input - Output Pin}
|
188 |
|
|
\label{aes128block}
|
189 |
|
|
\end{figure}
|
190 |
|
|
|
191 |
|
|
The AES 128 is composed from four subcircuit, these subcircuit are :
|
192 |
|
|
\begin{itemize}
|
193 |
|
|
\item ShiftRow
|
194 |
|
|
\item SubByte
|
195 |
|
|
\item MixColumn
|
196 |
|
|
\item KeyScheduler
|
197 |
|
|
\end{itemize}
|
198 |
|
|
%These subcircuit is the main component that build AES 128.
|
199 |
|
|
|
200 |
|
|
\subsection{ShiftRow}
|
201 |
|
|
|
202 |
|
|
ShiftRow transformation is performed by arranging the sequence of input
|
203 |
|
|
data to be processed, these transformation is performed this way:
|
204 |
|
|
|
205 |
|
|
\begin{displaymath}
|
206 |
|
|
\left\{
|
207 |
|
|
\begin{array}{lcl}
|
208 |
|
|
input & & output \\
|
209 |
|
|
0,5,a,f & => & 0,1,2,3\\
|
210 |
|
|
4,9,e,3 & => & 4,5,6,7\\
|
211 |
|
|
8,d,2,7 & => & 8,9,a,b\\
|
212 |
|
|
c,1,6,b & => & c,d,e,f\\
|
213 |
|
|
\end{array}
|
214 |
|
|
\right\}
|
215 |
|
|
\end{displaymath}
|
216 |
|
|
|
217 |
|
|
the InvShiftRow transformations operations is performed using the
|
218 |
|
|
following sequence of input data:
|
219 |
|
|
|
220 |
|
|
\begin{displaymath}
|
221 |
|
|
\left\{
|
222 |
|
|
\begin{array}{lcl}
|
223 |
|
|
input & & output \\
|
224 |
|
|
0,d,a,7 & => & 0,1,2,3\\
|
225 |
|
|
4,1,e,b & => & 4,5,6,7\\
|
226 |
|
|
8,5,2,f & => & 8,9,a,b\\
|
227 |
|
|
c,9,6,3 & => & c,d,e,f\\
|
228 |
|
|
\end{array}
|
229 |
|
|
\right\}
|
230 |
|
|
\end{displaymath}
|
231 |
|
|
|
232 |
|
|
\subsection{SubByte}
|
233 |
|
|
|
234 |
|
|
SubByte transformation is implemented using dedicated block RAM, SubByte
|
235 |
|
|
transformation occupy 4 Kb Block RAM in 512x8 configurations.
|
236 |
|
|
|
237 |
|
|
\subsection{MixColumn}
|
238 |
|
|
|
239 |
|
|
The MixColumn is implemented using matrix calculation of following equation:
|
240 |
|
|
|
241 |
|
|
\begin{equation}
|
242 |
|
|
c(x) =~'03'~x^3 +~'01'~x^2 +~'01'~x +~'02'.
|
243 |
|
|
\end{equation}
|
244 |
|
|
|
245 |
|
|
matrix form of above equation is:
|
246 |
|
|
|
247 |
|
|
\begin{displaymath}
|
248 |
|
|
\left[ \begin{array}{c} b_0\\ b_1\\ b_2\\ b_3\\ \end{array} \right]
|
249 |
|
|
=
|
250 |
|
|
\left[ \begin{array}{c} 02~03~01~01\\ 01~02~03~01\\ 01~01~02~03\\ 03~01~01~02\\ \end{array} \right]
|
251 |
|
|
\left[ \begin{array}{c} a_0\\ a_1\\ a_2\\ a_3\\ \end{array} \right]
|
252 |
|
|
\end{displaymath}
|
253 |
|
|
|
254 |
|
|
The InvMixColumn operations is performed using following equation:
|
255 |
|
|
|
256 |
|
|
\begin{equation}
|
257 |
|
|
d(x) =~'0b'~x^3 +~'0d'~x^2 +~'09'~x +~'0e'.
|
258 |
|
|
\end{equation}
|
259 |
|
|
|
260 |
|
|
in matrix representation is:
|
261 |
|
|
|
262 |
|
|
\begin{displaymath}
|
263 |
|
|
\left[ \begin{array}{c} d_0\\ d_1\\ d_2\\ d_3\\ \end{array} \right]
|
264 |
|
|
=
|
265 |
|
|
\left[ \begin{array}{c} 0e~0b~0d~09\\ 09~0e~0b~0d\\ 0d~09~0e~0b\\ 0b~0d~09~0e\\ \end{array} \right]
|
266 |
|
|
\left[ \begin{array}{c} c_0\\ c_1\\ c_2\\ c_3\\ \end{array} \right]
|
267 |
|
|
\end{displaymath}
|
268 |
|
|
|
269 |
|
|
The InvMixColumn can be implemented using resource sharing, by following
|
270 |
|
|
equation:
|
271 |
|
|
|
272 |
|
|
\begin{equation}
|
273 |
|
|
c(x) \otimes d(x) =~'01'
|
274 |
|
|
\end{equation}
|
275 |
|
|
|
276 |
|
|
then if we multiply both side with $d^2(x)$ then it become:
|
277 |
|
|
|
278 |
|
|
\begin{equation}
|
279 |
|
|
c(x) \otimes d^2(x) = d(x)
|
280 |
|
|
\end{equation}
|
281 |
|
|
|
282 |
|
|
above equation state that we can get the InvMixColumn using
|
283 |
|
|
multiplication of MixColumn operations and $d^2(x)$:
|
284 |
|
|
|
285 |
|
|
\begin{equation}
|
286 |
|
|
d^2(x) =~'04'~x^2 +~'05'.
|
287 |
|
|
\end{equation}
|
288 |
|
|
|
289 |
|
|
and matrix representation of above equation is:
|
290 |
|
|
|
291 |
|
|
\begin{displaymath}
|
292 |
|
|
\left[ \begin{array}{c} e_0\\ e_1\\ e_2\\ e_3\\ \end{array} \right]
|
293 |
|
|
=
|
294 |
|
|
\left[ \begin{array}{c} 05~00~04~00\\ 00~05~00~04\\ 04~00~05~00\\ 00~04~00~05\\ \end{array} \right]
|
295 |
|
|
\left[ \begin{array}{c} c_0\\ c_1\\ c_2\\ c_3\\ \end{array} \right]
|
296 |
|
|
\end{displaymath}
|
297 |
|
|
|
298 |
|
|
\subsection{KeyScheduler}
|
299 |
|
|
|
300 |
|
|
The KeyScheduler is implemented using the following schematic diagram:
|
301 |
|
|
|
302 |
|
|
\begin{figure}[H]
|
303 |
|
|
\center
|
304 |
|
|
\includegraphics[width=9cm,height=6cm]{key_scheduler.eps}
|
305 |
|
|
\caption{KeyScheduler Schematics}
|
306 |
|
|
\label{key_scheduler}
|
307 |
|
|
\end{figure}
|
308 |
|
|
|
309 |
|
|
\section{TODO}
|
310 |
|
|
|
311 |
|
|
\begin{itemize}
|
312 |
|
|
%\item Finish decryption circuit.
|
313 |
|
|
\item Optimize Key Scheduler storage allocations implementations.
|
314 |
|
|
\item Optimize folded register implementation.
|
315 |
|
|
\item Implement TriState Buffer for switching SubBytes utilization.
|
316 |
|
|
\item Update documentation.
|
317 |
|
|
\item CleanUp code.
|
318 |
|
|
\end{itemize}
|
319 |
|
|
|
320 |
|
|
\begin{thebibliography}{1}
|
321 |
|
|
|
322 |
|
|
\bibitem{chodowiec}
|
323 |
|
|
Pawel Chodowiec and Kris Gaj, \textbf{Very Compact FPGA Implementation
|
324 |
|
|
of the AES Algorithm}, CHES 2003, LNCS 2779, pp. 319-333
|
325 |
|
|
|
326 |
|
|
\bibitem{fips197}
|
327 |
|
|
Federal Information Processing Standards Publication 197,
|
328 |
|
|
\textbf{Advanced Encryption Standard (AES)}, National Institute of
|
329 |
|
|
Standards and Technology, 2001.
|
330 |
|
|
|
331 |
|
|
\bibitem{rijndael}
|
332 |
|
|
Daemen J. and Rijmen V., \textbf{AES Proposal: The Rijndael Block Cipher},\\
|
333 |
|
|
\href{http://www.esat.kuleuven.ac.be/~rijmen/rijndael/Rijndael.pdf}{http://www.esat.kuleuven.ac.be/\~~rijmen/rijndael/Rijndael.pdf}
|
334 |
|
|
|
335 |
|
|
%\bibitem{wada}
|
336 |
|
|
%Tom Wada, \textbf{2-D Product Code Iterative Decoder},\\
|
337 |
|
|
%\href{http://www.ie.u-ryukyu.ac.jp/\~\ wada/design06/spec\_e.html}
|
338 |
|
|
% {http://www.ie.u-ryukyu.ac.jp/\~\ wada/design06/spec\_e.html}\\
|
339 |
|
|
% October 1$^{st}$, 2005
|
340 |
|
|
|
341 |
|
|
\end{thebibliography}
|
342 |
|
|
|
343 |
|
|
\appendix
|
344 |
|
|
|
345 |
|
|
\chapter{Informations}
|
346 |
|
|
|
347 |
|
|
\section{Tools}
|
348 |
|
|
|
349 |
|
|
\begin{itemize}
|
350 |
|
|
\item \textbf{ModelSim 6.0} The Simulator
|
351 |
|
|
\item \textbf{Xilinx 6.3i} The Synthesizer
|
352 |
|
|
\item \textbf{VIM} (Vi IMproved) / \textbf{Emacs} The Editor
|
353 |
|
|
\item \textbf{\LaTeX}~~The Typesetter
|
354 |
|
|
\item \textbf{OpenOffice.org 2.0} The Drawer
|
355 |
|
|
\end{itemize}
|
356 |
|
|
|
357 |
|
|
\vspace{1cm}
|
358 |
|
|
\begin{tabbing}
|
359 |
|
|
\textbf{Version: 1.0}
|
360 |
|
|
\end{tabbing}
|
361 |
|
|
|
362 |
|
|
\end{document}
|