\doxysection{src/gsm/milenage/aes\+\_\+wrap.h File Reference}
\label{aes__wrap_8h}\index{src/gsm/milenage/aes\_wrap.h@{src/gsm/milenage/aes\_wrap.h}}


AES-\/based functions.  


\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ aes\+\_\+wrap} (const \textbf{ u8} $\ast$kek, int \textbf{ n}, const \textbf{ u8} $\ast$plain, \textbf{ u8} $\ast$cipher)
\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ aes\+\_\+unwrap} (const \textbf{ u8} $\ast$kek, int \textbf{ n}, const \textbf{ u8} $\ast$cipher, \textbf{ u8} $\ast$plain)
\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ omac1\+\_\+aes\+\_\+128\+\_\+vector} (const \textbf{ u8} $\ast$key, size\+\_\+t num\+\_\+elem, const \textbf{ u8} $\ast$addr[$\,$], const size\+\_\+t $\ast$\textbf{ len}, \textbf{ u8} $\ast$mac)
\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ omac1\+\_\+aes\+\_\+128} (const \textbf{ u8} $\ast$key, const \textbf{ u8} $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len, \textbf{ u8} $\ast$mac)
\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ aes\+\_\+128\+\_\+encrypt\+\_\+block} (const \textbf{ u8} $\ast$key, const \textbf{ u8} $\ast$in, \textbf{ u8} $\ast$out)
\begin{DoxyCompactList}\small\item\em aes\+\_\+128\+\_\+encrypt\+\_\+block -\/ Perform one AES 128-\/bit block operation @key\+: Key for AES @in\+: Input data (16 bytes) @out\+: Output of the AES block operation (16 bytes) Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ aes\+\_\+128\+\_\+ctr\+\_\+encrypt} (const \textbf{ u8} $\ast$key, const \textbf{ u8} $\ast$nonce, \textbf{ u8} $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len)
\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ aes\+\_\+128\+\_\+eax\+\_\+encrypt} (const \textbf{ u8} $\ast$key, const \textbf{ u8} $\ast$nonce, size\+\_\+t nonce\+\_\+len, const \textbf{ u8} $\ast$\textbf{ hdr}, size\+\_\+t \textbf{ hdr\+\_\+len}, \textbf{ u8} $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len, \textbf{ u8} $\ast$tag)
\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ aes\+\_\+128\+\_\+eax\+\_\+decrypt} (const \textbf{ u8} $\ast$key, const \textbf{ u8} $\ast$nonce, size\+\_\+t nonce\+\_\+len, const \textbf{ u8} $\ast$\textbf{ hdr}, size\+\_\+t \textbf{ hdr\+\_\+len}, \textbf{ u8} $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len, const \textbf{ u8} $\ast$tag)
\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ aes\+\_\+128\+\_\+cbc\+\_\+encrypt} (const \textbf{ u8} $\ast$key, const \textbf{ u8} $\ast$iv, \textbf{ u8} $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len)
\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ aes\+\_\+128\+\_\+cbc\+\_\+decrypt} (const \textbf{ u8} $\ast$key, const \textbf{ u8} $\ast$iv, \textbf{ u8} $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
AES-\/based functions. 


\begin{DoxyItemize}
\item AES Key Wrap Algorithm (128-\/bit KEK) (RFC3394)
\item One-\/\+Key CBC MAC (OMAC1) hash with AES-\/128
\item AES-\/128 CTR mode encryption
\item AES-\/128 EAX mode encryption/decryption
\item AES-\/128 CBC 
\end{DoxyItemize}

\doxysubsection{Function Documentation}
\mbox{\label{aes__wrap_8h_a7d8dae9d146a45f13bd34a9b8a09d155}} 
\index{aes\_wrap.h@{aes\_wrap.h}!aes\_128\_cbc\_decrypt@{aes\_128\_cbc\_decrypt}}
\index{aes\_128\_cbc\_decrypt@{aes\_128\_cbc\_decrypt}!aes\_wrap.h@{aes\_wrap.h}}
\doxysubsubsection{aes\_128\_cbc\_decrypt()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} aes\+\_\+128\+\_\+cbc\+\_\+decrypt (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{iv,  }\item[{\textbf{ u8} $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len }\end{DoxyParamCaption})}

\mbox{\label{aes__wrap_8h_a8063299702c22b358680e3bbc8923389}} 
\index{aes\_wrap.h@{aes\_wrap.h}!aes\_128\_cbc\_encrypt@{aes\_128\_cbc\_encrypt}}
\index{aes\_128\_cbc\_encrypt@{aes\_128\_cbc\_encrypt}!aes\_wrap.h@{aes\_wrap.h}}
\doxysubsubsection{aes\_128\_cbc\_encrypt()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} aes\+\_\+128\+\_\+cbc\+\_\+encrypt (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{iv,  }\item[{\textbf{ u8} $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len }\end{DoxyParamCaption})}

\mbox{\label{aes__wrap_8h_a99eee61ff8ba2ea97c6e6956003b8e24}} 
\index{aes\_wrap.h@{aes\_wrap.h}!aes\_128\_ctr\_encrypt@{aes\_128\_ctr\_encrypt}}
\index{aes\_128\_ctr\_encrypt@{aes\_128\_ctr\_encrypt}!aes\_wrap.h@{aes\_wrap.h}}
\doxysubsubsection{aes\_128\_ctr\_encrypt()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} aes\+\_\+128\+\_\+ctr\+\_\+encrypt (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{nonce,  }\item[{\textbf{ u8} $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len }\end{DoxyParamCaption})}

\mbox{\label{aes__wrap_8h_aebb26c29e7d513753eeb14d3743ac8a4}} 
\index{aes\_wrap.h@{aes\_wrap.h}!aes\_128\_eax\_decrypt@{aes\_128\_eax\_decrypt}}
\index{aes\_128\_eax\_decrypt@{aes\_128\_eax\_decrypt}!aes\_wrap.h@{aes\_wrap.h}}
\doxysubsubsection{aes\_128\_eax\_decrypt()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} aes\+\_\+128\+\_\+eax\+\_\+decrypt (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{nonce,  }\item[{size\+\_\+t}]{nonce\+\_\+len,  }\item[{const \textbf{ u8} $\ast$}]{hdr,  }\item[{size\+\_\+t}]{hdr\+\_\+len,  }\item[{\textbf{ u8} $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len,  }\item[{const \textbf{ u8} $\ast$}]{tag }\end{DoxyParamCaption})}

\mbox{\label{aes__wrap_8h_ab3126bc7b1cf16bb6fe65746a7d4406d}} 
\index{aes\_wrap.h@{aes\_wrap.h}!aes\_128\_eax\_encrypt@{aes\_128\_eax\_encrypt}}
\index{aes\_128\_eax\_encrypt@{aes\_128\_eax\_encrypt}!aes\_wrap.h@{aes\_wrap.h}}
\doxysubsubsection{aes\_128\_eax\_encrypt()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} aes\+\_\+128\+\_\+eax\+\_\+encrypt (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{nonce,  }\item[{size\+\_\+t}]{nonce\+\_\+len,  }\item[{const \textbf{ u8} $\ast$}]{hdr,  }\item[{size\+\_\+t}]{hdr\+\_\+len,  }\item[{\textbf{ u8} $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len,  }\item[{\textbf{ u8} $\ast$}]{tag }\end{DoxyParamCaption})}

\mbox{\label{aes__wrap_8h_a4202490b85ad4b1b59e3c3f3d9aeaade}} 
\index{aes\_wrap.h@{aes\_wrap.h}!aes\_128\_encrypt\_block@{aes\_128\_encrypt\_block}}
\index{aes\_128\_encrypt\_block@{aes\_128\_encrypt\_block}!aes\_wrap.h@{aes\_wrap.h}}
\doxysubsubsection{aes\_128\_encrypt\_block()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} aes\+\_\+128\+\_\+encrypt\+\_\+block (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{in,  }\item[{\textbf{ u8} $\ast$}]{out }\end{DoxyParamCaption})}



aes\+\_\+128\+\_\+encrypt\+\_\+block -\/ Perform one AES 128-\/bit block operation @key\+: Key for AES @in\+: Input data (16 bytes) @out\+: Output of the AES block operation (16 bytes) Returns\+: 0 on success, -\/1 on failure 



References \textbf{ aes\+\_\+encrypt()}, \textbf{ aes\+\_\+encrypt\+\_\+deinit()}, and \textbf{ aes\+\_\+encrypt\+\_\+init()}.



Referenced by \textbf{ milenage\+\_\+f1()}, \textbf{ milenage\+\_\+f2345()}, and \textbf{ milenage\+\_\+opc\+\_\+gen()}.

\mbox{\label{aes__wrap_8h_a25cf58ffe3cfada4652ae9be79da457b}} 
\index{aes\_wrap.h@{aes\_wrap.h}!aes\_unwrap@{aes\_unwrap}}
\index{aes\_unwrap@{aes\_unwrap}!aes\_wrap.h@{aes\_wrap.h}}
\doxysubsubsection{aes\_unwrap()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} aes\+\_\+unwrap (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{kek,  }\item[{int}]{n,  }\item[{const \textbf{ u8} $\ast$}]{cipher,  }\item[{\textbf{ u8} $\ast$}]{plain }\end{DoxyParamCaption})}

\mbox{\label{aes__wrap_8h_a11a96f04444bb6977f042b6059220bed}} 
\index{aes\_wrap.h@{aes\_wrap.h}!aes\_wrap@{aes\_wrap}}
\index{aes\_wrap@{aes\_wrap}!aes\_wrap.h@{aes\_wrap.h}}
\doxysubsubsection{aes\_wrap()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} aes\+\_\+wrap (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{kek,  }\item[{int}]{n,  }\item[{const \textbf{ u8} $\ast$}]{plain,  }\item[{\textbf{ u8} $\ast$}]{cipher }\end{DoxyParamCaption})}

\mbox{\label{aes__wrap_8h_a6f4dc79ae21ca8dc9f61bc65390e6966}} 
\index{aes\_wrap.h@{aes\_wrap.h}!omac1\_aes\_128@{omac1\_aes\_128}}
\index{omac1\_aes\_128@{omac1\_aes\_128}!aes\_wrap.h@{aes\_wrap.h}}
\doxysubsubsection{omac1\_aes\_128()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} omac1\+\_\+aes\+\_\+128 (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len,  }\item[{\textbf{ u8} $\ast$}]{mac }\end{DoxyParamCaption})}

\mbox{\label{aes__wrap_8h_a80a94648808a408e67cf3fd88376fe48}} 
\index{aes\_wrap.h@{aes\_wrap.h}!omac1\_aes\_128\_vector@{omac1\_aes\_128\_vector}}
\index{omac1\_aes\_128\_vector@{omac1\_aes\_128\_vector}!aes\_wrap.h@{aes\_wrap.h}}
\doxysubsubsection{omac1\_aes\_128\_vector()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} omac1\+\_\+aes\+\_\+128\+\_\+vector (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{num\+\_\+elem,  }\item[{const \textbf{ u8} $\ast$}]{addr[$\,$],  }\item[{const size\+\_\+t $\ast$}]{len,  }\item[{\textbf{ u8} $\ast$}]{mac }\end{DoxyParamCaption})}

