1 |
5 |
fanatid |
\documentclass[a4paper,12pt]{article}
|
2 |
|
|
\usepackage[utf8]{inputenc}
|
3 |
|
|
|
4 |
|
|
\usepackage{titlesec}
|
5 |
|
|
\usepackage{tabularx}
|
6 |
|
|
\usepackage{lastpage}
|
7 |
|
|
\usepackage{tocloft}
|
8 |
|
|
\usepackage[us]{datetime}
|
9 |
|
|
|
10 |
|
|
\usepackage{hyperref}
|
11 |
|
|
\hypersetup{colorlinks=true,linkcolor=black,urlcolor=blue}
|
12 |
|
|
|
13 |
|
|
\usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2cm]{geometry}
|
14 |
|
|
|
15 |
|
|
\usepackage{fancyhdr}
|
16 |
|
|
\pagestyle{fancy}
|
17 |
|
|
\lhead{GOST 28147-89 Core, rev. \currentRevision}
|
18 |
|
|
\rhead{\releaseDate}
|
19 |
|
|
\cfoot{\thepage\ of \pageref{LastPage}}
|
20 |
|
|
|
21 |
|
|
\renewcommand{\headrulewidth}{0.4pt}
|
22 |
|
|
\renewcommand{\footrulewidth}{0.4pt}
|
23 |
|
|
|
24 |
|
|
\renewcommand\cftsecdotsep{\cftdotsep}
|
25 |
|
|
|
26 |
|
|
\newcommand{\currentRevision}{0.2}
|
27 |
|
|
\newcommand{\releaseDate}{March 31, 2014}
|
28 |
|
|
|
29 |
|
|
\begin{document}
|
30 |
|
|
|
31 |
|
|
% Title
|
32 |
|
|
\begin{titlepage}
|
33 |
|
|
\begin{flushright}
|
34 |
|
|
|
35 |
|
|
\vspace*{4cm}
|
36 |
|
|
\Huge
|
37 |
|
|
\textbf{GOST 28147-89}\\IP Core
|
38 |
|
|
|
39 |
|
|
\vspace{4cm}
|
40 |
|
|
\large
|
41 |
|
|
Author: Kirill Fomichev\\
|
42 |
|
|
\textsl{fanatid@ya.ru}
|
43 |
|
|
|
44 |
|
|
\vspace{4cm}
|
45 |
|
|
\textbf{Revision \currentRevision\\\releaseDate}
|
46 |
|
|
|
47 |
|
|
\end{flushright}
|
48 |
|
|
\end{titlepage}
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
% Revision history
|
52 |
|
|
\begin{flushright}
|
53 |
|
|
\Large
|
54 |
|
|
\textbf{Revision History}
|
55 |
|
|
\normalsize
|
56 |
|
|
\end{flushright}
|
57 |
|
|
|
58 |
|
|
\begin{flushleft}
|
59 |
|
|
{\renewcommand{\arraystretch}{1.5}
|
60 |
|
|
\begin{tabularx}{\textwidth}{|l|l|l|X|}
|
61 |
|
|
\hline
|
62 |
|
|
\textbf{Rev.} & \textbf{Date} & \textbf{Author} & \textbf{Description}\\
|
63 |
|
|
\hline
|
64 |
|
|
0.1 & March 10, 2014 & Kirill Fomichev & Initial Release\\
|
65 |
|
|
\hline
|
66 |
|
|
0.2 & March 31, 2014 & Kirill Fomichev & Add bidirectional ECB and CFB modules\\
|
67 |
|
|
\hline
|
68 |
|
|
\end{tabularx}}
|
69 |
|
|
\end{flushleft}
|
70 |
|
|
|
71 |
|
|
% Contents
|
72 |
|
|
\newpage
|
73 |
|
|
\tableofcontents
|
74 |
|
|
|
75 |
|
|
% Introduction
|
76 |
|
|
\newpage
|
77 |
|
|
\section{Introduction}
|
78 |
|
|
|
79 |
|
|
\subsection{About GOST 28147-89}
|
80 |
|
|
\paragraph{}
|
81 |
|
|
The \textsl{GOST block cipher}, defined in standard \textsl{GOST 28147-89},
|
82 |
|
|
is a Soviet and Russian government standard symmetric key block cipher.
|
83 |
|
|
Developed in the 1970s, the standard has been marked "Top Secret" and
|
84 |
|
|
the downgraded to "Secret" in 1990. Shortly after the dissolution of the USSR,
|
85 |
|
|
it was declassified and it was released to the public in 1994.
|
86 |
|
|
|
87 |
|
|
\paragraph{}
|
88 |
|
|
GOST have a 64-bit block size and a key length of 256 bits.
|
89 |
|
|
It's S-Boxes can be secret, and they contain about 354($log_2(16!^8)$) bits of
|
90 |
|
|
secret information, so the effective key size can be increased to 610 bits;
|
91 |
|
|
however, a chosen-key attack can recover the contents of the S-Boxes
|
92 |
|
|
in approximately $2^{32}$ encryptions.
|
93 |
|
|
|
94 |
|
|
\subsection{This roject}
|
95 |
|
|
\paragraph{}
|
96 |
|
|
This project has implements \textsl{GOST block cipher} in three modes:
|
97 |
|
|
electronic codebook (ECB), cipher feedback (CFB) and message authentication code (MAC).
|
98 |
|
|
\paragraph{}
|
99 |
|
|
All files licensed under \textsl{BSD license}.
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
% Interface
|
103 |
|
|
\newpage
|
104 |
|
|
\section{Interface}
|
105 |
|
|
|
106 |
|
|
\paragraph{}
|
107 |
|
|
ECB mode\\
|
108 |
|
|
{\renewcommand{\arraystretch}{1.2}
|
109 |
|
|
\begin{tabularx}{\textwidth}{l|l l X}
|
110 |
|
|
\hline
|
111 |
|
|
Signal name & Width & In/Out & Description\\
|
112 |
|
|
\hline
|
113 |
|
|
\textsl{clk} & 1 & In & Clock\\
|
114 |
|
|
\textsl{reset} & 1 & In & Terminate current encryption/decryption process \\
|
115 |
|
|
\textsl{mode} & 1 & In & Decryption when mode equal 1, otherwise encryption\\
|
116 |
|
|
\textsl{load\_data} & 1 & In & Start of encryption/decryption \\
|
117 |
|
|
\textsl{sbox} & 512 & In & S-Box \\
|
118 |
|
|
\textsl{key} & 256 & In & Key \\
|
119 |
|
|
\textsl{in} & 64 & In & Plain text/Cipher text \\
|
120 |
|
|
\textsl{out} & 64 & Out & Cipher text/Plain text. Results available after 34 clock cycles. \\
|
121 |
|
|
\textsl{busy} & 1 & Out & Status flag, triggered to zero after finished encryption/decryption \\
|
122 |
|
|
\hline
|
123 |
|
|
\end{tabularx}}
|
124 |
|
|
|
125 |
|
|
\paragraph{}
|
126 |
|
|
ECB mode with pipeline\\
|
127 |
|
|
{\renewcommand{\arraystretch}{1.2}
|
128 |
|
|
\begin{tabularx}{\textwidth}{l|l l X}
|
129 |
|
|
\hline
|
130 |
|
|
Signal name & Width & In/Out & Description\\
|
131 |
|
|
\hline
|
132 |
|
|
\textsl{clk} & 1 & In & Clock\\
|
133 |
|
|
\textsl{sbox} & 512 & In & S-Box \\
|
134 |
|
|
\textsl{key} & 256 & In & Key \\
|
135 |
|
|
\textsl{in} & 64 & In & Plain text/Cipher text \\
|
136 |
|
|
\textsl{out} & 64 & Out & Cipher text/Plain text. Results available after 32 clock cycles. \\
|
137 |
|
|
\hline
|
138 |
|
|
\end{tabularx}}
|
139 |
|
|
|
140 |
|
|
\paragraph{}
|
141 |
|
|
CFB mode\\
|
142 |
|
|
{\renewcommand{\arraystretch}{1.2}
|
143 |
|
|
\begin{tabularx}{\textwidth}{l|l l X}
|
144 |
|
|
\hline
|
145 |
|
|
Signal name & Width & In/Out & Description\\
|
146 |
|
|
\hline
|
147 |
|
|
\textsl{clk} & 1 & In & Clock\\
|
148 |
|
|
\textsl{reset} & 1 & In & Terminate current encryption/decryption process and load gamma from \textsl{in} \\
|
149 |
|
|
\textsl{mode} & 1 & In & Decryption when mode equal 1, otherwise encryption\\
|
150 |
|
|
\textsl{load\_data} & 1 & In & Start of encryption/decryption \\
|
151 |
|
|
\textsl{sbox} & 512 & In & S-Box \\
|
152 |
|
|
\textsl{key} & 256 & In & Key \\
|
153 |
|
|
\textsl{in} & 64 & In & Gamma/Plain text/Cipher text \\
|
154 |
|
|
\textsl{out} & 64 & Out & Cipher text/Plain text. Results available after 35 clock cycles. \\
|
155 |
|
|
\textsl{busy} & 1 & Out & Status flag, triggered to zero after finished encryption/decryption \\
|
156 |
|
|
\hline
|
157 |
|
|
\end{tabularx}}
|
158 |
|
|
|
159 |
|
|
\paragraph{}
|
160 |
|
|
MAC mode\\
|
161 |
|
|
{\renewcommand{\arraystretch}{1.2}
|
162 |
|
|
\begin{tabularx}{\textwidth}{l|l l X}
|
163 |
|
|
\hline
|
164 |
|
|
Signal name & Width & In/Out & Description\\
|
165 |
|
|
\hline
|
166 |
|
|
\textsl{clk} & 1 & In & Clock\\
|
167 |
|
|
\textsl{reset} & 1 & In & Drop current mac \\
|
168 |
|
|
\textsl{load\_data} & 1 & In & Start calculate mac \\
|
169 |
|
|
\textsl{sbox} & 512 & In & S-Box \\
|
170 |
|
|
\textsl{key} & 256 & In & Key \\
|
171 |
|
|
\textsl{in} & 64 & In & Plain text \\
|
172 |
|
|
\textsl{out} & 32 & Out & MAC, available after 18 clock cycles. \\
|
173 |
|
|
\textsl{busy} & 1 & Out & Status flag, triggered to zero after finished processing\\
|
174 |
|
|
\hline
|
175 |
|
|
\end{tabularx}}
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
% Testbench
|
179 |
|
|
\newpage
|
180 |
|
|
\section{Testbench}
|
181 |
|
|
|
182 |
|
|
\paragraph{}
|
183 |
|
|
Makefile run simulation using
|
184 |
|
|
\href{http://iverilog.icarus.com/}{Icarus Verilog}
|
185 |
|
|
in testbench folder. You can see simulation results in
|
186 |
|
|
\href{http://gtkwave.sourceforge.net/}{GTKWave}.
|
187 |
|
|
|
188 |
|
|
\begin{flushleft}
|
189 |
|
|
{\renewcommand{\arraystretch}{1.5}
|
190 |
|
|
\begin{tabularx}{\textwidth}{l|X}
|
191 |
|
|
\hline
|
192 |
|
|
\textsl{File name} & \textsl{The module being tested}\\
|
193 |
|
|
\hline
|
194 |
|
|
gost89\_ecb\_tb.v & ECB encryption and decryption\\
|
195 |
|
|
\hline
|
196 |
|
|
gost89\_pipelined\_ecb\_tb.v & Pipelined ECB encryption and decryption\\
|
197 |
|
|
\hline
|
198 |
|
|
gost89\_cfb\_tb.v & CFB encryption and decryption\\
|
199 |
|
|
\hline
|
200 |
|
|
gost89\_mac\_tb.v & MAC mode\\
|
201 |
|
|
\hline
|
202 |
|
|
\end{tabularx}}
|
203 |
|
|
\end{flushleft}
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
% References
|
207 |
|
|
\newpage
|
208 |
|
|
\section{References}
|
209 |
|
|
|
210 |
|
|
\begin{enumerate}
|
211 |
|
|
\item GOST block cipher,\\
|
212 |
|
|
\url{http://en.wikipedia.org/wiki/GOST_(block_cipher)}
|
213 |
|
|
|
214 |
|
|
\item RFC 4357: Additional Cryptographic Algorithms for Use with GOST\\
|
215 |
|
|
\url{http://tools.ietf.org/html/rfc4357}
|
216 |
|
|
|
217 |
|
|
\item RFC 5830: GOST 28147-89 encryption, decryption and MAC algorithms\\
|
218 |
|
|
\url{http://tools.ietf.org/html/rfc5830}
|
219 |
|
|
|
220 |
|
|
\item Schneier, Bruce (1996). Applied cryptography: protocols, algorithms, and source code in C
|
221 |
|
|
\end{enumerate}
|
222 |
|
|
|
223 |
|
|
\end{document}
|