\hypertarget{aes_8h}{\section{include/beecrypt/aes.h File Reference} \label{aes_8h}\index{include/beecrypt/aes.\-h@{include/beecrypt/aes.\-h}} } A\-E\-S block cipher, as specified by N\-I\-S\-T F\-I\-P\-S 197. {\ttfamily \#include \char`\"{}beecrypt/beecrypt.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}beecrypt/aesopt.\-h\char`\"{}}\\* Include dependency graph for aes.\-h\-: \nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=350pt]{aes_8h__incl} \end{center} \end{figure} This graph shows which files directly or indirectly include this file\-: \nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=208pt]{aes_8h__dep__incl} \end{center} \end{figure} \subsection*{Data Structures} \begin{DoxyCompactItemize} \item struct \hyperlink{structaesParam}{aes\-Param} \begin{DoxyCompactList}\small\item\em Holds all the parameters necessary for the A\-E\-S cipher. \end{DoxyCompactList}\end{DoxyCompactItemize} \subsection*{Functions} \begin{DoxyCompactItemize} \item int \hyperlink{aes_8h_a643aa89c715a711cc441a5a4a7397ea6}{aes\-Setup} (\hyperlink{structaesParam}{aes\-Param} $\ast$ap, const \hyperlink{api_8h_ab8ef12fab634c171394422d0ee8baf94}{byte} $\ast$key, size\-\_\-t keybits, \hyperlink{group__BC__m_gace10d4c0b0409d35c6a703d6445fc558}{cipher\-Operation} op) \begin{DoxyCompactList}\small\item\em This function performs the cipher's key expansion. \end{DoxyCompactList}\item int \hyperlink{aes_8h_a778e5ab1749733a37bbca97a43838305}{aes\-Set\-I\-V} (\hyperlink{structaesParam}{aes\-Param} $\ast$ap, const \hyperlink{api_8h_ab8ef12fab634c171394422d0ee8baf94}{byte} $\ast$iv) \begin{DoxyCompactList}\small\item\em This function sets the Initialization Vector. \end{DoxyCompactList}\item int \hyperlink{aes_8h_abaadaaf3f01f1fde6237ccc08e3677e5}{aes\-Set\-C\-T\-R} (\hyperlink{structaesParam}{aes\-Param} $\ast$ap, const \hyperlink{api_8h_ab8ef12fab634c171394422d0ee8baf94}{byte} $\ast$nivz, size\-\_\-t counter) \begin{DoxyCompactList}\small\item\em This function sets the C\-T\-R mode counter. \end{DoxyCompactList}\item int \hyperlink{aes_8h_a7a169238993aa7999831c40ae78d941a}{aes\-Encrypt} (\hyperlink{structaesParam}{aes\-Param} $\ast$ap, uint32\-\_\-t $\ast$dst, const uint32\-\_\-t $\ast$src) \begin{DoxyCompactList}\small\item\em This function performs the raw A\-E\-S encryption; it encrypts one block of 128 bits. \end{DoxyCompactList}\item int \hyperlink{aes_8h_a35fce1a4e2f1df8de178ebc667bcedbf}{aes\-Decrypt} (\hyperlink{structaesParam}{aes\-Param} $\ast$ap, uint32\-\_\-t $\ast$dst, const uint32\-\_\-t $\ast$src) \begin{DoxyCompactList}\small\item\em This function performs the raw A\-E\-S decryption; it decrypts one block of 128 bits. \end{DoxyCompactList}\item uint32\-\_\-t $\ast$ \hyperlink{aes_8h_ae0b5b285473012afa45a9044048a1f1a}{aes\-Feedback} (\hyperlink{structaesParam}{aes\-Param} $\ast$ap) \end{DoxyCompactItemize} \subsection*{Variables} \begin{DoxyCompactItemize} \item const \hyperlink{structblockCipher}{block\-Cipher} \hyperlink{aes_8h_aa60b0eb68ff417f08ef26ac0eacf021f}{aes} \begin{DoxyCompactList}\small\item\em Holds the full A\-P\-I description of the A\-E\-S algorithm. \end{DoxyCompactList}\end{DoxyCompactItemize} \subsection{Detailed Description} A\-E\-S block cipher, as specified by N\-I\-S\-T F\-I\-P\-S 197. \begin{DoxyAuthor}{Author} Bob Deblier \href{mailto:bob.deblier@telenet.be}{\tt bob.\-deblier@telenet.\-be} \end{DoxyAuthor} \subsection{Function Documentation} \hypertarget{aes_8h_a35fce1a4e2f1df8de178ebc667bcedbf}{\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}aes\-Decrypt ( \begin{DoxyParamCaption} \item[{{\bf aes\-Param} $\ast$}]{ap, } \item[{uint32\-\_\-t $\ast$}]{dst, } \item[{const uint32\-\_\-t $\ast$}]{src} \end{DoxyParamCaption} )}}\label{aes_8h_a35fce1a4e2f1df8de178ebc667bcedbf} This function performs the raw A\-E\-S decryption; it decrypts one block of 128 bits. \begin{DoxyParams}{Parameters} {\em ap} & The cipher's parameter block. \\ \hline {\em dst} & The cleartext; should be aligned on 32-\/bit boundary. \\ \hline {\em src} & The ciphertext; should be aligned on 32-\/bit boundary. \\ \hline \end{DoxyParams} \begin{DoxyRetVals}{Return values} {\em 0} & on success. \\ \hline \end{DoxyRetVals} \hypertarget{aes_8h_a7a169238993aa7999831c40ae78d941a}{\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}aes\-Encrypt ( \begin{DoxyParamCaption} \item[{{\bf aes\-Param} $\ast$}]{ap, } \item[{uint32\-\_\-t $\ast$}]{dst, } \item[{const uint32\-\_\-t $\ast$}]{src} \end{DoxyParamCaption} )}}\label{aes_8h_a7a169238993aa7999831c40ae78d941a} This function performs the raw A\-E\-S encryption; it encrypts one block of 128 bits. \begin{DoxyParams}{Parameters} {\em ap} & The cipher's parameter block. \\ \hline {\em dst} & The ciphertext; should be aligned on 32-\/bit boundary. \\ \hline {\em src} & The cleartext; should be aligned on 32-\/bit boundary. \\ \hline \end{DoxyParams} \begin{DoxyRetVals}{Return values} {\em 0} & on success. \\ \hline \end{DoxyRetVals} \hypertarget{aes_8h_ae0b5b285473012afa45a9044048a1f1a}{\index{aes.\-h@{aes.\-h}!aes\-Feedback@{aes\-Feedback}} \index{aes\-Feedback@{aes\-Feedback}!aes.h@{aes.\-h}} \subsubsection[{aes\-Feedback}]{\setlength{\rightskip}{0pt plus 5cm}uint32\-\_\-t$\ast$ aes\-Feedback ( \begin{DoxyParamCaption} \item[{{\bf aes\-Param} $\ast$}]{ap} \end{DoxyParamCaption} )}}\label{aes_8h_ae0b5b285473012afa45a9044048a1f1a} \hypertarget{aes_8h_abaadaaf3f01f1fde6237ccc08e3677e5}{\index{aes.\-h@{aes.\-h}!aes\-Set\-C\-T\-R@{aes\-Set\-C\-T\-R}} \index{aes\-Set\-C\-T\-R@{aes\-Set\-C\-T\-R}!aes.h@{aes.\-h}} \subsubsection[{aes\-Set\-C\-T\-R}]{\setlength{\rightskip}{0pt plus 5cm}int aes\-Set\-C\-T\-R ( \begin{DoxyParamCaption} \item[{{\bf aes\-Param} $\ast$}]{ap, } \item[{const {\bf byte} $\ast$}]{nivz, } \item[{size\-\_\-t}]{counter} \end{DoxyParamCaption} )}}\label{aes_8h_abaadaaf3f01f1fde6237ccc08e3677e5} This function sets the C\-T\-R mode counter. \begin{DoxyNote}{Note} This function is only useful in C\-T\-R modes. \end{DoxyNote} \begin{DoxyParams}{Parameters} {\em ap} & The cipher's parameter block. \\ \hline {\em nivz} & The concatenation of Nonce, I\-V, and padding Zeroes. \\ \hline {\em counter} & The counter. \\ \hline \end{DoxyParams} \begin{DoxyRetVals}{Return values} {\em 0} & on success. \\ \hline \end{DoxyRetVals} \hypertarget{aes_8h_a778e5ab1749733a37bbca97a43838305}{\index{aes.\-h@{aes.\-h}!aes\-Set\-I\-V@{aes\-Set\-I\-V}} \index{aes\-Set\-I\-V@{aes\-Set\-I\-V}!aes.h@{aes.\-h}} \subsubsection[{aes\-Set\-I\-V}]{\setlength{\rightskip}{0pt plus 5cm}int aes\-Set\-I\-V ( \begin{DoxyParamCaption} \item[{{\bf aes\-Param} $\ast$}]{ap, } \item[{const {\bf byte} $\ast$}]{iv} \end{DoxyParamCaption} )}}\label{aes_8h_a778e5ab1749733a37bbca97a43838305} This function sets the Initialization Vector. \begin{DoxyNote}{Note} This function is only useful in block chaining or feedback modes. \end{DoxyNote} \begin{DoxyParams}{Parameters} {\em ap} & The cipher's parameter block. \\ \hline {\em iv} & The initialization vector; may be null. \\ \hline \end{DoxyParams} \begin{DoxyRetVals}{Return values} {\em 0} & on success. \\ \hline \end{DoxyRetVals} \hypertarget{aes_8h_a643aa89c715a711cc441a5a4a7397ea6}{\index{aes.\-h@{aes.\-h}!aes\-Setup@{aes\-Setup}} \index{aes\-Setup@{aes\-Setup}!aes.h@{aes.\-h}} \subsubsection[{aes\-Setup}]{\setlength{\rightskip}{0pt plus 5cm}int aes\-Setup ( \begin{DoxyParamCaption} \item[{{\bf aes\-Param} $\ast$}]{ap, } \item[{const {\bf byte} $\ast$}]{key, } \item[{size\-\_\-t}]{keybits, } \item[{{\bf cipher\-Operation}}]{op} \end{DoxyParamCaption} )}}\label{aes_8h_a643aa89c715a711cc441a5a4a7397ea6} This function performs the cipher's key expansion. \begin{DoxyParams}{Parameters} {\em ap} & The cipher's parameter block. \\ \hline {\em key} & The key value. \\ \hline {\em keybits} & The number of bits in the key; legal values are\-: 128, 192 and 256. \\ \hline {\em op} & E\-N\-C\-R\-Y\-P\-T or D\-E\-C\-R\-Y\-P\-T. \\ \hline \end{DoxyParams} \begin{DoxyRetVals}{Return values} {\em 0} & on success. \\ \hline {\em -\/1} & on failure. \\ \hline \end{DoxyRetVals} \subsection{Variable Documentation} \hypertarget{aes_8h_aa60b0eb68ff417f08ef26ac0eacf021f}{\index{aes.\-h@{aes.\-h}!aes@{aes}} \index{aes@{aes}!aes.h@{aes.\-h}} \subsubsection[{aes}]{\setlength{\rightskip}{0pt plus 5cm}aes}}\label{aes_8h_aa60b0eb68ff417f08ef26ac0eacf021f} Holds the full A\-P\-I description of the A\-E\-S algorithm.