\section{aversive\_\-10-03-12/modules/crypto/aes/aes.h File Reference}
\label{aes_8h}\index{aversive\_\-10-03-12/modules/crypto/aes/aes.h@{aversive\_\-10-03-12/modules/crypto/aes/aes.h}}
{\tt \#include $<$aversive.h$>$}\par
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct {\bf aes\_\-key\_\-st}
\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf AES\_\-ENCRYPT}~1
\item 
\#define {\bf AES\_\-DECRYPT}~0
\item 
\#define {\bf AES\_\-MAXNR}~14
\item 
\#define {\bf AES\_\-BLOCK\_\-SIZE}~16
\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef struct {\bf aes\_\-key\_\-st} {\bf AES\_\-KEY}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
const char $\ast$ {\bf AES\_\-options} (void)
\item 
int {\bf AES\_\-set\_\-encrypt\_\-key} (const unsigned char $\ast$userKey, const int bits, {\bf AES\_\-KEY} $\ast$key)
\item 
int {\bf AES\_\-set\_\-decrypt\_\-key} (const unsigned char $\ast$userKey, const int bits, {\bf AES\_\-KEY} $\ast$key)
\item 
void {\bf AES\_\-encrypt} (const unsigned char $\ast$in, unsigned char $\ast$out, const {\bf AES\_\-KEY} $\ast$key)
\item 
void {\bf AES\_\-decrypt} (const unsigned char $\ast$in, unsigned char $\ast$out, const {\bf AES\_\-KEY} $\ast$key)
\item 
void {\bf AES\_\-ecb\_\-encrypt} (const unsigned char $\ast$in, unsigned char $\ast$out, const {\bf AES\_\-KEY} $\ast$key, const int enc)
\item 
void {\bf AES\_\-cbc\_\-encrypt} (const unsigned char $\ast$in, unsigned char $\ast$out, const unsigned long length, const {\bf AES\_\-KEY} $\ast$key, unsigned char $\ast$ivec, const int enc)
\item 
void {\bf AES\_\-cfb128\_\-encrypt} (const unsigned char $\ast$in, unsigned char $\ast$out, const unsigned long length, const {\bf AES\_\-KEY} $\ast$key, unsigned char $\ast$ivec, int $\ast$num, const int enc)
\item 
void {\bf AES\_\-ofb128\_\-encrypt} (const unsigned char $\ast$in, unsigned char $\ast$out, const unsigned long length, const {\bf AES\_\-KEY} $\ast$key, unsigned char $\ast$ivec, int $\ast$num)
\item 
void {\bf AES\_\-ctr128\_\-encrypt} (const unsigned char $\ast$in, unsigned char $\ast$out, const unsigned long length, const {\bf AES\_\-KEY} $\ast$key, unsigned char counter[AES\_\-BLOCK\_\-SIZE], unsigned char ecount\_\-buf[AES\_\-BLOCK\_\-SIZE], unsigned int $\ast$num)
\end{CompactItemize}


\subsection{Define Documentation}
\index{aes.h@{aes.h}!AES\_\-BLOCK\_\-SIZE@{AES\_\-BLOCK\_\-SIZE}}
\index{AES\_\-BLOCK\_\-SIZE@{AES\_\-BLOCK\_\-SIZE}!aes.h@{aes.h}}
\subsubsection[AES\_\-BLOCK\_\-SIZE]{\setlength{\rightskip}{0pt plus 5cm}\#define AES\_\-BLOCK\_\-SIZE~16}\label{aes_8h_f19ab913a847ad1e91c5291215116de1}




Definition at line 67 of file aes.h.\index{aes.h@{aes.h}!AES\_\-DECRYPT@{AES\_\-DECRYPT}}
\index{AES\_\-DECRYPT@{AES\_\-DECRYPT}!aes.h@{aes.h}}
\subsubsection[AES\_\-DECRYPT]{\setlength{\rightskip}{0pt plus 5cm}\#define AES\_\-DECRYPT~0}\label{aes_8h_8a3cf36dc3c8860519f33907bad182c9}




Definition at line 62 of file aes.h.\index{aes.h@{aes.h}!AES\_\-ENCRYPT@{AES\_\-ENCRYPT}}
\index{AES\_\-ENCRYPT@{AES\_\-ENCRYPT}!aes.h@{aes.h}}
\subsubsection[AES\_\-ENCRYPT]{\setlength{\rightskip}{0pt plus 5cm}\#define AES\_\-ENCRYPT~1}\label{aes_8h_91e721bca5c6db6402fc3a4781d69b10}




Definition at line 61 of file aes.h.\index{aes.h@{aes.h}!AES\_\-MAXNR@{AES\_\-MAXNR}}
\index{AES\_\-MAXNR@{AES\_\-MAXNR}!aes.h@{aes.h}}
\subsubsection[AES\_\-MAXNR]{\setlength{\rightskip}{0pt plus 5cm}\#define AES\_\-MAXNR~14}\label{aes_8h_b517fa1010f3c588859797f1b87c4bcd}




Definition at line 66 of file aes.h.

\subsection{Typedef Documentation}
\index{aes.h@{aes.h}!AES\_\-KEY@{AES\_\-KEY}}
\index{AES\_\-KEY@{AES\_\-KEY}!aes.h@{aes.h}}
\subsubsection[AES\_\-KEY]{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf aes\_\-key\_\-st} {\bf AES\_\-KEY}}\label{aes_8h_8f7795796ab08087e20c6d603bf25a8c}




Definition at line 79 of file aes.h.

\subsection{Function Documentation}
\index{aes.h@{aes.h}!AES\_\-cbc\_\-encrypt@{AES\_\-cbc\_\-encrypt}}
\index{AES\_\-cbc\_\-encrypt@{AES\_\-cbc\_\-encrypt}!aes.h@{aes.h}}
\subsubsection[AES\_\-cbc\_\-encrypt]{\setlength{\rightskip}{0pt plus 5cm}void AES\_\-cbc\_\-encrypt (const unsigned char $\ast$ {\em in}, \/  unsigned char $\ast$ {\em out}, \/  const unsigned long {\em length}, \/  const {\bf AES\_\-KEY} $\ast$ {\em key}, \/  unsigned char $\ast$ {\em ivec}, \/  const int {\em enc})}\label{aes_8h_05603b674fd472e403d3a188a4e97fff}


\index{aes.h@{aes.h}!AES\_\-cfb128\_\-encrypt@{AES\_\-cfb128\_\-encrypt}}
\index{AES\_\-cfb128\_\-encrypt@{AES\_\-cfb128\_\-encrypt}!aes.h@{aes.h}}
\subsubsection[AES\_\-cfb128\_\-encrypt]{\setlength{\rightskip}{0pt plus 5cm}void AES\_\-cfb128\_\-encrypt (const unsigned char $\ast$ {\em in}, \/  unsigned char $\ast$ {\em out}, \/  const unsigned long {\em length}, \/  const {\bf AES\_\-KEY} $\ast$ {\em key}, \/  unsigned char $\ast$ {\em ivec}, \/  int $\ast$ {\em num}, \/  const int {\em enc})}\label{aes_8h_722eca5511348a95b9e9f37216cc61ba}


\index{aes.h@{aes.h}!AES\_\-ctr128\_\-encrypt@{AES\_\-ctr128\_\-encrypt}}
\index{AES\_\-ctr128\_\-encrypt@{AES\_\-ctr128\_\-encrypt}!aes.h@{aes.h}}
\subsubsection[AES\_\-ctr128\_\-encrypt]{\setlength{\rightskip}{0pt plus 5cm}void AES\_\-ctr128\_\-encrypt (const unsigned char $\ast$ {\em in}, \/  unsigned char $\ast$ {\em out}, \/  const unsigned long {\em length}, \/  const {\bf AES\_\-KEY} $\ast$ {\em key}, \/  unsigned char {\em counter}[AES\_\-BLOCK\_\-SIZE], \/  unsigned char {\em ecount\_\-buf}[AES\_\-BLOCK\_\-SIZE], \/  unsigned int $\ast$ {\em num})}\label{aes_8h_dbbd9e5c397bb64ec705419629c204b4}




Definition at line 105 of file aes\_\-ctr.c.\index{aes.h@{aes.h}!AES\_\-decrypt@{AES\_\-decrypt}}
\index{AES\_\-decrypt@{AES\_\-decrypt}!aes.h@{aes.h}}
\subsubsection[AES\_\-decrypt]{\setlength{\rightskip}{0pt plus 5cm}void AES\_\-decrypt (const unsigned char $\ast$ {\em in}, \/  unsigned char $\ast$ {\em out}, \/  const {\bf AES\_\-KEY} $\ast$ {\em key})}\label{aes_8h_d545fd3f8c468db40a9e1a0e73ba20fc}




Definition at line 677 of file aes\_\-core.c.

References GETU32, PUTU32, aes\_\-key\_\-st::rd\_\-key, ROR\_\-U32\_\-1, ROR\_\-U32\_\-2, ROR\_\-U32\_\-3, and aes\_\-key\_\-st::rounds.\index{aes.h@{aes.h}!AES\_\-ecb\_\-encrypt@{AES\_\-ecb\_\-encrypt}}
\index{AES\_\-ecb\_\-encrypt@{AES\_\-ecb\_\-encrypt}!aes.h@{aes.h}}
\subsubsection[AES\_\-ecb\_\-encrypt]{\setlength{\rightskip}{0pt plus 5cm}void AES\_\-ecb\_\-encrypt (const unsigned char $\ast$ {\em in}, \/  unsigned char $\ast$ {\em out}, \/  const {\bf AES\_\-KEY} $\ast$ {\em key}, \/  const int {\em enc})}\label{aes_8h_9b95c679d720e1c6c0c02b19bd0c46e6}


\index{aes.h@{aes.h}!AES\_\-encrypt@{AES\_\-encrypt}}
\index{AES\_\-encrypt@{AES\_\-encrypt}!aes.h@{aes.h}}
\subsubsection[AES\_\-encrypt]{\setlength{\rightskip}{0pt plus 5cm}void AES\_\-encrypt (const unsigned char $\ast$ {\em in}, \/  unsigned char $\ast$ {\em out}, \/  const {\bf AES\_\-KEY} $\ast$ {\em key})}\label{aes_8h_5e9cae0f27ffa404595a3c9f7ea7eb56}




Definition at line 560 of file aes\_\-core.c.

References GETU32, PUTU32, aes\_\-key\_\-st::rd\_\-key, ROR\_\-U32\_\-1, ROR\_\-U32\_\-2, ROR\_\-U32\_\-3, and aes\_\-key\_\-st::rounds.

Referenced by AES\_\-ctr128\_\-encrypt().\index{aes.h@{aes.h}!AES\_\-ofb128\_\-encrypt@{AES\_\-ofb128\_\-encrypt}}
\index{AES\_\-ofb128\_\-encrypt@{AES\_\-ofb128\_\-encrypt}!aes.h@{aes.h}}
\subsubsection[AES\_\-ofb128\_\-encrypt]{\setlength{\rightskip}{0pt plus 5cm}void AES\_\-ofb128\_\-encrypt (const unsigned char $\ast$ {\em in}, \/  unsigned char $\ast$ {\em out}, \/  const unsigned long {\em length}, \/  const {\bf AES\_\-KEY} $\ast$ {\em key}, \/  unsigned char $\ast$ {\em ivec}, \/  int $\ast$ {\em num})}\label{aes_8h_a6347740b72d668aeb2d4ed176e85332}


\index{aes.h@{aes.h}!AES\_\-options@{AES\_\-options}}
\index{AES\_\-options@{AES\_\-options}!aes.h@{aes.h}}
\subsubsection[AES\_\-options]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ AES\_\-options (void)}\label{aes_8h_c6c76ba23ba8a1e1376ca3526ce67923}


\index{aes.h@{aes.h}!AES\_\-set\_\-decrypt\_\-key@{AES\_\-set\_\-decrypt\_\-key}}
\index{AES\_\-set\_\-decrypt\_\-key@{AES\_\-set\_\-decrypt\_\-key}!aes.h@{aes.h}}
\subsubsection[AES\_\-set\_\-decrypt\_\-key]{\setlength{\rightskip}{0pt plus 5cm}int AES\_\-set\_\-decrypt\_\-key (const unsigned char $\ast$ {\em userKey}, \/  const int {\em bits}, \/  {\bf AES\_\-KEY} $\ast$ {\em key})}\label{aes_8h_2091bfbf02d00a2f4ce67085d1a0d0ac}


Expand the cipher key into the decryption key schedule. 

Definition at line 508 of file aes\_\-core.c.

References AES\_\-set\_\-encrypt\_\-key(), aes\_\-key\_\-st::rd\_\-key, ROR\_\-U32\_\-1, ROR\_\-U32\_\-2, ROR\_\-U32\_\-3, and aes\_\-key\_\-st::rounds.\index{aes.h@{aes.h}!AES\_\-set\_\-encrypt\_\-key@{AES\_\-set\_\-encrypt\_\-key}}
\index{AES\_\-set\_\-encrypt\_\-key@{AES\_\-set\_\-encrypt\_\-key}!aes.h@{aes.h}}
\subsubsection[AES\_\-set\_\-encrypt\_\-key]{\setlength{\rightskip}{0pt plus 5cm}int AES\_\-set\_\-encrypt\_\-key (const unsigned char $\ast$ {\em userKey}, \/  const int {\em bits}, \/  {\bf AES\_\-KEY} $\ast$ {\em key})}\label{aes_8h_f2a2a79bf29fae1cc93b4aa43c2b833c}


Expand the cipher key into the encryption key schedule. 

Definition at line 407 of file aes\_\-core.c.

References GETU32, aes\_\-key\_\-st::rd\_\-key, and aes\_\-key\_\-st::rounds.

Referenced by AES\_\-set\_\-decrypt\_\-key().