\section{aversive\_\-10-03-12/modules/crypto/aes/aes\_\-core.c File Reference}
\label{aes__core_8c}\index{aversive\_\-10-03-12/modules/crypto/aes/aes\_\-core.c@{aversive\_\-10-03-12/modules/crypto/aes/aes\_\-core.c}}
{\tt \#include $<$assert.h$>$}\par
{\tt \#include $<$aversive.h$>$}\par
{\tt \#include \char`\"{}aes\_\-locl.h\char`\"{}}\par
{\tt \#include \char`\"{}aes.h\char`\"{}}\par
{\tt \#include $<$aversive/pgmspace.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf USE\_\-PGMMEM}
\item 
\#define {\bf ROR\_\-U32\_\-1}({\bf a})~( ((({\bf a})\&0xff)$<$$<$24) $^\wedge$ ((((a)$>$$>$8)\&0xff)$<$$<$0)  $^\wedge$ ((((a)$>$$>$16)\&0xff)$<$$<$8) $^\wedge$ (((a)$>$$>$24)$<$$<$16) )
\item 
\#define {\bf ROR\_\-U32\_\-2}({\bf a})~( ((({\bf a})\&0xff)$<$$<$16) $^\wedge$ ((((a)$>$$>$8)\&0xff)$<$$<$24) $^\wedge$ ((((a)$>$$>$16)\&0xff)$<$$<$0) $^\wedge$ (((a)$>$$>$24)$<$$<$8)  )
\item 
\#define {\bf ROR\_\-U32\_\-3}({\bf a})~( ((({\bf a})\&0xff)$<$$<$8)  $^\wedge$ ((((a)$>$$>$8)\&0xff)$<$$<$16) $^\wedge$ ((((a)$>$$>$16)\&0xff)$<$$<$24)$^\wedge$ (((a)$>$$>$24)$<$$<$0)  )
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\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)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
prog\_\-uint32\_\-t {\bf Te0\_\-} [256]
\item 
prog\_\-uint8\_\-t {\bf Te4\_\-} [256]
\item 
prog\_\-uint32\_\-t {\bf Td0\_\-} [256]
\item 
prog\_\-uint8\_\-t {\bf Td4\_\-} [256]
\end{CompactItemize}


\subsection{Define Documentation}
\index{aes\_\-core.c@{aes\_\-core.c}!ROR\_\-U32\_\-1@{ROR\_\-U32\_\-1}}
\index{ROR\_\-U32\_\-1@{ROR\_\-U32\_\-1}!aes_core.c@{aes\_\-core.c}}
\subsubsection[ROR\_\-U32\_\-1]{\setlength{\rightskip}{0pt plus 5cm}\#define ROR\_\-U32\_\-1({\bf a})~( ((({\bf a})\&0xff)$<$$<$24) $^\wedge$ ((((a)$>$$>$8)\&0xff)$<$$<$0)  $^\wedge$ ((((a)$>$$>$16)\&0xff)$<$$<$8) $^\wedge$ (((a)$>$$>$24)$<$$<$16) )}\label{aes__core_8c_5c6775d39ef16c17589d94def55dae2c}




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

Referenced by AES\_\-decrypt(), AES\_\-encrypt(), and AES\_\-set\_\-decrypt\_\-key().\index{aes\_\-core.c@{aes\_\-core.c}!ROR\_\-U32\_\-2@{ROR\_\-U32\_\-2}}
\index{ROR\_\-U32\_\-2@{ROR\_\-U32\_\-2}!aes_core.c@{aes\_\-core.c}}
\subsubsection[ROR\_\-U32\_\-2]{\setlength{\rightskip}{0pt plus 5cm}\#define ROR\_\-U32\_\-2({\bf a})~( ((({\bf a})\&0xff)$<$$<$16) $^\wedge$ ((((a)$>$$>$8)\&0xff)$<$$<$24) $^\wedge$ ((((a)$>$$>$16)\&0xff)$<$$<$0) $^\wedge$ (((a)$>$$>$24)$<$$<$8)  )}\label{aes__core_8c_7e6f5ebe6681d67b3735b1d37d1cffdd}




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

Referenced by AES\_\-decrypt(), AES\_\-encrypt(), and AES\_\-set\_\-decrypt\_\-key().\index{aes\_\-core.c@{aes\_\-core.c}!ROR\_\-U32\_\-3@{ROR\_\-U32\_\-3}}
\index{ROR\_\-U32\_\-3@{ROR\_\-U32\_\-3}!aes_core.c@{aes\_\-core.c}}
\subsubsection[ROR\_\-U32\_\-3]{\setlength{\rightskip}{0pt plus 5cm}\#define ROR\_\-U32\_\-3({\bf a})~( ((({\bf a})\&0xff)$<$$<$8)  $^\wedge$ ((((a)$>$$>$8)\&0xff)$<$$<$16) $^\wedge$ ((((a)$>$$>$16)\&0xff)$<$$<$24)$^\wedge$ (((a)$>$$>$24)$<$$<$0)  )}\label{aes__core_8c_d5fe953f4c6c40a999e476e8b95b26d9}




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

Referenced by AES\_\-decrypt(), AES\_\-encrypt(), and AES\_\-set\_\-decrypt\_\-key().\index{aes\_\-core.c@{aes\_\-core.c}!USE\_\-PGMMEM@{USE\_\-PGMMEM}}
\index{USE\_\-PGMMEM@{USE\_\-PGMMEM}!aes_core.c@{aes\_\-core.c}}
\subsubsection[USE\_\-PGMMEM]{\setlength{\rightskip}{0pt plus 5cm}\#define USE\_\-PGMMEM}\label{aes__core_8c_c4222cc003716b461adc58b4d49ac9a2}




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

\subsection{Function Documentation}
\index{aes\_\-core.c@{aes\_\-core.c}!AES\_\-decrypt@{AES\_\-decrypt}}
\index{AES\_\-decrypt@{AES\_\-decrypt}!aes_core.c@{aes\_\-core.c}}
\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__core_8c_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\_\-core.c@{aes\_\-core.c}!AES\_\-encrypt@{AES\_\-encrypt}}
\index{AES\_\-encrypt@{AES\_\-encrypt}!aes_core.c@{aes\_\-core.c}}
\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__core_8c_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\_\-core.c@{aes\_\-core.c}!AES\_\-set\_\-decrypt\_\-key@{AES\_\-set\_\-decrypt\_\-key}}
\index{AES\_\-set\_\-decrypt\_\-key@{AES\_\-set\_\-decrypt\_\-key}!aes_core.c@{aes\_\-core.c}}
\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__core_8c_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\_\-core.c@{aes\_\-core.c}!AES\_\-set\_\-encrypt\_\-key@{AES\_\-set\_\-encrypt\_\-key}}
\index{AES\_\-set\_\-encrypt\_\-key@{AES\_\-set\_\-encrypt\_\-key}!aes_core.c@{aes\_\-core.c}}
\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__core_8c_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().

\subsection{Variable Documentation}
\index{aes\_\-core.c@{aes\_\-core.c}!Td0\_\-@{Td0\_\-}}
\index{Td0\_\-@{Td0\_\-}!aes_core.c@{aes\_\-core.c}}
\subsubsection[Td0\_\-]{\setlength{\rightskip}{0pt plus 5cm}prog\_\-uint32\_\-t {\bf Td0\_\-}[256]}\label{aes__core_8c_7c657a2a8e60300ab480475f760a95b3}




Definition at line 237 of file aes\_\-core.c.\index{aes\_\-core.c@{aes\_\-core.c}!Td4\_\-@{Td4\_\-}}
\index{Td4\_\-@{Td4\_\-}!aes_core.c@{aes\_\-core.c}}
\subsubsection[Td4\_\-]{\setlength{\rightskip}{0pt plus 5cm}prog\_\-uint8\_\-t {\bf Td4\_\-}[256]}\label{aes__core_8c_fcab1fe398602638e5b4aa57f73b18af}




Definition at line 318 of file aes\_\-core.c.\index{aes\_\-core.c@{aes\_\-core.c}!Te0\_\-@{Te0\_\-}}
\index{Te0\_\-@{Te0\_\-}!aes_core.c@{aes\_\-core.c}}
\subsubsection[Te0\_\-]{\setlength{\rightskip}{0pt plus 5cm}prog\_\-uint32\_\-t {\bf Te0\_\-}[256]}\label{aes__core_8c_4375af26491c7c975b70a72336a25ffa}




Definition at line 73 of file aes\_\-core.c.\index{aes\_\-core.c@{aes\_\-core.c}!Te4\_\-@{Te4\_\-}}
\index{Te4\_\-@{Te4\_\-}!aes_core.c@{aes\_\-core.c}}
\subsubsection[Te4\_\-]{\setlength{\rightskip}{0pt plus 5cm}prog\_\-uint8\_\-t {\bf Te4\_\-}[256]}\label{aes__core_8c_01a96af271fd4f699d1dcefeaf7a5415}




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