\doxysection{src/gsm/tuak/tuak.h File Reference}
\label{tuak_8h}\index{src/gsm/tuak/tuak.h@{src/gsm/tuak/tuak.h}}
{\ttfamily \#include $<$stdint.\+h$>$}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ tuak\+\_\+f1} (const uint8\+\_\+t $\ast$opc, const uint8\+\_\+t $\ast$k, uint8\+\_\+t k\+\_\+len\+\_\+bytes, const uint8\+\_\+t $\ast$\+\_\+rand, const uint8\+\_\+t $\ast$sqn, const uint8\+\_\+t $\ast$amf, uint8\+\_\+t $\ast$mac\+\_\+a, uint8\+\_\+t mac\+\_\+a\+\_\+len\+\_\+bytes, unsigned int keccac\+\_\+iterations)
\begin{DoxyCompactList}\small\item\em tuak\+\_\+f1 -\/ TUAK f1 algorithm @opc\+: OPc = 256-\/bit value derived from OP and K @k\+: K = 128-\/bit or 256-\/bit subscriber key @\+\_\+rand\+: RAND = 128-\/bit random challenge @sqn\+: SQN = 48-\/bit sequence number @amf\+: AMF = 16-\/bit authentication management field @mac\+\_\+a\+: Buffer for MAC-\/A = 64/128/256-\/bit network authentication code Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ tuak\+\_\+f1star} (const uint8\+\_\+t $\ast$opc, const uint8\+\_\+t $\ast$k, uint8\+\_\+t k\+\_\+len\+\_\+bytes, const uint8\+\_\+t $\ast$\+\_\+rand, const uint8\+\_\+t $\ast$sqn, const uint8\+\_\+t $\ast$amf, uint8\+\_\+t $\ast$mac\+\_\+s, uint8\+\_\+t mac\+\_\+s\+\_\+len\+\_\+bytes, unsigned int keccac\+\_\+iterations)
\begin{DoxyCompactList}\small\item\em tuak\+\_\+f1star -\/ TUAK f1$\ast$ algorithm @opc\+: OPc = 256-\/bit value derived from OP and K @k\+: K = 128-\/bit or 256-\/bit subscriber key @\+\_\+rand\+: RAND = 128-\/bit random challenge @sqn\+: SQN = 48-\/bit sequence number @amf\+: AMF = 16-\/bit authentication management field @mac\+\_\+s\+: Buffer for MAC-\/S = 64/128/256-\/bit resync authentication code Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ tuak\+\_\+f2345} (const uint8\+\_\+t $\ast$opc, const uint8\+\_\+t $\ast$k, uint8\+\_\+t k\+\_\+len\+\_\+bytes, const uint8\+\_\+t $\ast$\+\_\+rand, uint8\+\_\+t $\ast$\textbf{ res}, uint8\+\_\+t res\+\_\+len\+\_\+bytes, uint8\+\_\+t $\ast$ck, uint8\+\_\+t ck\+\_\+len\+\_\+bytes, uint8\+\_\+t $\ast$ik, uint8\+\_\+t ik\+\_\+len\+\_\+bytes, uint8\+\_\+t $\ast$ak, unsigned int keccac\+\_\+iterations)
\begin{DoxyCompactList}\small\item\em tuak\+\_\+f2345 -\/ TUAK f2, f3, f4, f5, algorithms @opc\+: OPc = 256-\/bit value derived from OP and K @k\+: K = 128/256-\/bit subscriber key @\+\_\+rand\+: RAND = 128-\/bit random challenge @res\+: Buffer for RES = 32/64/128/256-\/bit signed response (f2), or NULL @ck\+: Buffer for CK = 128/256-\/bit confidentiality key (f3), or NULL @ik\+: Buffer for IK = 128/256-\/bit integrity key (f4), or NULL @ak\+: Buffer for AK = 48-\/bit anonymity key (f5), or NULL Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ tuak\+\_\+f5star} (const uint8\+\_\+t $\ast$opc, const uint8\+\_\+t $\ast$k, uint8\+\_\+t k\+\_\+len\+\_\+bytes, const uint8\+\_\+t $\ast$\+\_\+rand, uint8\+\_\+t $\ast$ak, unsigned int keccac\+\_\+iterations)
\begin{DoxyCompactList}\small\item\em tuak\+\_\+f5star -\/ TUAK f5$\ast$ algorithm @opc\+: OPc = 256-\/bit value derived from OP and K @k\+: K = 128/256-\/bit subscriber key @\+\_\+rand\+: RAND = 128-\/bit random challenge @ak\+: Buffer for AK = 48-\/bit anonymity key (f5) Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
void \textbf{ tuak\+\_\+set\+\_\+keccak\+\_\+iterations} (unsigned int i)
\item 
void \textbf{ tuak\+\_\+generate} (const uint8\+\_\+t $\ast$opc, const uint8\+\_\+t $\ast$amf, const uint8\+\_\+t $\ast$k, uint8\+\_\+t k\+\_\+len\+\_\+bytes, const uint8\+\_\+t $\ast$sqn, const uint8\+\_\+t $\ast$\+\_\+rand, uint8\+\_\+t $\ast$autn, uint8\+\_\+t $\ast$ik, uint8\+\_\+t $\ast$ck, uint8\+\_\+t $\ast$\textbf{ res}, size\+\_\+t $\ast$res\+\_\+len)
\begin{DoxyCompactList}\small\item\em tuak\+\_\+generate -\/ Generate AKA AUTN,IK,CK,RES @opc\+: OPc = 256-\/bit operator variant algorithm configuration field (encr.) @amf\+: AMF = 16-\/bit authentication management field @k\+: K = 128/256-\/bit subscriber key @sqn\+: SQN = 48-\/bit sequence number @\+\_\+rand\+: RAND = 128-\/bit random challenge @autn\+: Buffer for AUTN = 128-\/bit authentication token @ik\+: Buffer for IK = 128/256-\/bit integrity key (f4), or NULL @ck\+: Buffer for CK = 128/256-\/bit confidentiality key (f3), or NULL @res\+: Buffer for RES = 32/64/128-\/bit signed response (f2), or NULL @res\+\_\+len\+: Max length for res; set to used length or 0 on failure \end{DoxyCompactList}\item 
int \textbf{ tuak\+\_\+auts} (const uint8\+\_\+t $\ast$opc, const uint8\+\_\+t $\ast$k, uint8\+\_\+t k\+\_\+len\+\_\+bytes, const uint8\+\_\+t $\ast$\+\_\+rand, const uint8\+\_\+t $\ast$auts, uint8\+\_\+t $\ast$sqn)
\begin{DoxyCompactList}\small\item\em tuak\+\_\+auts -\/ Milenage AUTS validation @opc\+: OPc = 256-\/bit operator variant algorithm configuration field (encr.) @k\+: K = 128/256-\/bit subscriber key @\+\_\+rand\+: RAND = 128-\/bit random challenge @auts\+: AUTS = 112-\/bit authentication token from client @sqn\+: Buffer for SQN = 48-\/bit sequence number Returns\+: 0 = success (sqn filled), -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ tuak\+\_\+opc\+\_\+gen} (uint8\+\_\+t $\ast$opc, const uint8\+\_\+t $\ast$k, uint8\+\_\+t k\+\_\+len\+\_\+bytes, const uint8\+\_\+t $\ast$op)
\end{DoxyCompactItemize}


\doxysubsection{Function Documentation}
\mbox{\label{tuak_8h_a0e446ef4b03720862d856fefee045a96}} 
\index{tuak.h@{tuak.h}!tuak\_auts@{tuak\_auts}}
\index{tuak\_auts@{tuak\_auts}!tuak.h@{tuak.h}}
\doxysubsubsection{tuak\_auts()}
{\footnotesize\ttfamily int tuak\+\_\+auts (\begin{DoxyParamCaption}\item[{const uint8\+\_\+t $\ast$}]{opc,  }\item[{const uint8\+\_\+t $\ast$}]{k,  }\item[{uint8\+\_\+t}]{k\+\_\+len\+\_\+bytes,  }\item[{const uint8\+\_\+t $\ast$}]{\+\_\+rand,  }\item[{const uint8\+\_\+t $\ast$}]{auts,  }\item[{uint8\+\_\+t $\ast$}]{sqn }\end{DoxyParamCaption})}



tuak\+\_\+auts -\/ Milenage AUTS validation @opc\+: OPc = 256-\/bit operator variant algorithm configuration field (encr.) @k\+: K = 128/256-\/bit subscriber key @\+\_\+rand\+: RAND = 128-\/bit random challenge @auts\+: AUTS = 112-\/bit authentication token from client @sqn\+: Buffer for SQN = 48-\/bit sequence number Returns\+: 0 = success (sqn filled), -\/1 on failure 



References \textbf{ g\+\_\+keccak\+\_\+iterations}, \textbf{ tuak\+\_\+f1star()}, and \textbf{ tuak\+\_\+f5star()}.



Referenced by \textbf{ tuak\+\_\+gen\+\_\+vec\+\_\+auts()}.

\mbox{\label{tuak_8h_a23c9672e0fa4005af9ac95a85f4c037b}} 
\index{tuak.h@{tuak.h}!tuak\_f1@{tuak\_f1}}
\index{tuak\_f1@{tuak\_f1}!tuak.h@{tuak.h}}
\doxysubsubsection{tuak\_f1()}
{\footnotesize\ttfamily int tuak\+\_\+f1 (\begin{DoxyParamCaption}\item[{const uint8\+\_\+t $\ast$}]{opc,  }\item[{const uint8\+\_\+t $\ast$}]{k,  }\item[{uint8\+\_\+t}]{k\+\_\+len\+\_\+bytes,  }\item[{const uint8\+\_\+t $\ast$}]{\+\_\+rand,  }\item[{const uint8\+\_\+t $\ast$}]{sqn,  }\item[{const uint8\+\_\+t $\ast$}]{amf,  }\item[{uint8\+\_\+t $\ast$}]{mac\+\_\+a,  }\item[{uint8\+\_\+t}]{mac\+\_\+a\+\_\+len\+\_\+bytes,  }\item[{unsigned int}]{keccac\+\_\+iterations }\end{DoxyParamCaption})}



tuak\+\_\+f1 -\/ TUAK f1 algorithm @opc\+: OPc = 256-\/bit value derived from OP and K @k\+: K = 128-\/bit or 256-\/bit subscriber key @\+\_\+rand\+: RAND = 128-\/bit random challenge @sqn\+: SQN = 48-\/bit sequence number @amf\+: AMF = 16-\/bit authentication management field @mac\+\_\+a\+: Buffer for MAC-\/A = 64/128/256-\/bit network authentication code Returns\+: 0 on success, -\/1 on failure 



References \textbf{ memcpy\+\_\+reverse()}, and \textbf{ tuak\+\_\+core()}.



Referenced by \textbf{ tuak\+\_\+generate()}.

\mbox{\label{tuak_8h_aedf582cc5bfb7417777568621ba104e1}} 
\index{tuak.h@{tuak.h}!tuak\_f1star@{tuak\_f1star}}
\index{tuak\_f1star@{tuak\_f1star}!tuak.h@{tuak.h}}
\doxysubsubsection{tuak\_f1star()}
{\footnotesize\ttfamily int tuak\+\_\+f1star (\begin{DoxyParamCaption}\item[{const uint8\+\_\+t $\ast$}]{opc,  }\item[{const uint8\+\_\+t $\ast$}]{k,  }\item[{uint8\+\_\+t}]{k\+\_\+len\+\_\+bytes,  }\item[{const uint8\+\_\+t $\ast$}]{\+\_\+rand,  }\item[{const uint8\+\_\+t $\ast$}]{sqn,  }\item[{const uint8\+\_\+t $\ast$}]{amf,  }\item[{uint8\+\_\+t $\ast$}]{mac\+\_\+s,  }\item[{uint8\+\_\+t}]{mac\+\_\+s\+\_\+len\+\_\+bytes,  }\item[{unsigned int}]{keccac\+\_\+iterations }\end{DoxyParamCaption})}



tuak\+\_\+f1star -\/ TUAK f1$\ast$ algorithm @opc\+: OPc = 256-\/bit value derived from OP and K @k\+: K = 128-\/bit or 256-\/bit subscriber key @\+\_\+rand\+: RAND = 128-\/bit random challenge @sqn\+: SQN = 48-\/bit sequence number @amf\+: AMF = 16-\/bit authentication management field @mac\+\_\+s\+: Buffer for MAC-\/S = 64/128/256-\/bit resync authentication code Returns\+: 0 on success, -\/1 on failure 



References \textbf{ memcpy\+\_\+reverse()}, and \textbf{ tuak\+\_\+core()}.



Referenced by \textbf{ tuak\+\_\+auts()}.

\mbox{\label{tuak_8h_a3170dfeb6f3f84fd501ed185a8a47590}} 
\index{tuak.h@{tuak.h}!tuak\_f2345@{tuak\_f2345}}
\index{tuak\_f2345@{tuak\_f2345}!tuak.h@{tuak.h}}
\doxysubsubsection{tuak\_f2345()}
{\footnotesize\ttfamily int tuak\+\_\+f2345 (\begin{DoxyParamCaption}\item[{const uint8\+\_\+t $\ast$}]{opc,  }\item[{const uint8\+\_\+t $\ast$}]{k,  }\item[{uint8\+\_\+t}]{k\+\_\+len\+\_\+bytes,  }\item[{const uint8\+\_\+t $\ast$}]{\+\_\+rand,  }\item[{uint8\+\_\+t $\ast$}]{res,  }\item[{uint8\+\_\+t}]{res\+\_\+len\+\_\+bytes,  }\item[{uint8\+\_\+t $\ast$}]{ck,  }\item[{uint8\+\_\+t}]{ck\+\_\+len\+\_\+bytes,  }\item[{uint8\+\_\+t $\ast$}]{ik,  }\item[{uint8\+\_\+t}]{ik\+\_\+len\+\_\+bytes,  }\item[{uint8\+\_\+t $\ast$}]{ak,  }\item[{unsigned int}]{keccac\+\_\+iterations }\end{DoxyParamCaption})}



tuak\+\_\+f2345 -\/ TUAK f2, f3, f4, f5, algorithms @opc\+: OPc = 256-\/bit value derived from OP and K @k\+: K = 128/256-\/bit subscriber key @\+\_\+rand\+: RAND = 128-\/bit random challenge @res\+: Buffer for RES = 32/64/128/256-\/bit signed response (f2), or NULL @ck\+: Buffer for CK = 128/256-\/bit confidentiality key (f3), or NULL @ik\+: Buffer for IK = 128/256-\/bit integrity key (f4), or NULL @ak\+: Buffer for AK = 48-\/bit anonymity key (f5), or NULL Returns\+: 0 on success, -\/1 on failure 



References \textbf{ memcpy\+\_\+reverse()}, \textbf{ res}, \textbf{ tuak\+\_\+core()}, and \textbf{ zero16}.



Referenced by \textbf{ tuak\+\_\+generate()}.

\mbox{\label{tuak_8h_a822d1de6798e1ec99e006a6c9dd4d3c6}} 
\index{tuak.h@{tuak.h}!tuak\_f5star@{tuak\_f5star}}
\index{tuak\_f5star@{tuak\_f5star}!tuak.h@{tuak.h}}
\doxysubsubsection{tuak\_f5star()}
{\footnotesize\ttfamily int tuak\+\_\+f5star (\begin{DoxyParamCaption}\item[{const uint8\+\_\+t $\ast$}]{opc,  }\item[{const uint8\+\_\+t $\ast$}]{k,  }\item[{uint8\+\_\+t}]{k\+\_\+len\+\_\+bytes,  }\item[{const uint8\+\_\+t $\ast$}]{\+\_\+rand,  }\item[{uint8\+\_\+t $\ast$}]{ak,  }\item[{unsigned int}]{keccac\+\_\+iterations }\end{DoxyParamCaption})}



tuak\+\_\+f5star -\/ TUAK f5$\ast$ algorithm @opc\+: OPc = 256-\/bit value derived from OP and K @k\+: K = 128/256-\/bit subscriber key @\+\_\+rand\+: RAND = 128-\/bit random challenge @ak\+: Buffer for AK = 48-\/bit anonymity key (f5) Returns\+: 0 on success, -\/1 on failure 



References \textbf{ memcpy\+\_\+reverse()}, \textbf{ tuak\+\_\+core()}, and \textbf{ zero16}.



Referenced by \textbf{ tuak\+\_\+auts()}.

\mbox{\label{tuak_8h_a2b86b5423511b76fbfe4ceec77bea90d}} 
\index{tuak.h@{tuak.h}!tuak\_generate@{tuak\_generate}}
\index{tuak\_generate@{tuak\_generate}!tuak.h@{tuak.h}}
\doxysubsubsection{tuak\_generate()}
{\footnotesize\ttfamily void tuak\+\_\+generate (\begin{DoxyParamCaption}\item[{const uint8\+\_\+t $\ast$}]{opc,  }\item[{const uint8\+\_\+t $\ast$}]{amf,  }\item[{const uint8\+\_\+t $\ast$}]{k,  }\item[{uint8\+\_\+t}]{k\+\_\+len\+\_\+bytes,  }\item[{const uint8\+\_\+t $\ast$}]{sqn,  }\item[{const uint8\+\_\+t $\ast$}]{\+\_\+rand,  }\item[{uint8\+\_\+t $\ast$}]{autn,  }\item[{uint8\+\_\+t $\ast$}]{ik,  }\item[{uint8\+\_\+t $\ast$}]{ck,  }\item[{uint8\+\_\+t $\ast$}]{res,  }\item[{size\+\_\+t $\ast$}]{res\+\_\+len }\end{DoxyParamCaption})}



tuak\+\_\+generate -\/ Generate AKA AUTN,IK,CK,RES @opc\+: OPc = 256-\/bit operator variant algorithm configuration field (encr.) @amf\+: AMF = 16-\/bit authentication management field @k\+: K = 128/256-\/bit subscriber key @sqn\+: SQN = 48-\/bit sequence number @\+\_\+rand\+: RAND = 128-\/bit random challenge @autn\+: Buffer for AUTN = 128-\/bit authentication token @ik\+: Buffer for IK = 128/256-\/bit integrity key (f4), or NULL @ck\+: Buffer for CK = 128/256-\/bit confidentiality key (f3), or NULL @res\+: Buffer for RES = 32/64/128-\/bit signed response (f2), or NULL @res\+\_\+len\+: Max length for res; set to used length or 0 on failure 



References \textbf{ g\+\_\+keccak\+\_\+iterations}, \textbf{ res}, \textbf{ tuak\+\_\+f1()}, and \textbf{ tuak\+\_\+f2345()}.



Referenced by \textbf{ tuak\+\_\+gen\+\_\+vec()}.

\mbox{\label{tuak_8h_aacbc8a48e15a41c0753553c363578cdc}} 
\index{tuak.h@{tuak.h}!tuak\_opc\_gen@{tuak\_opc\_gen}}
\index{tuak\_opc\_gen@{tuak\_opc\_gen}!tuak.h@{tuak.h}}
\doxysubsubsection{tuak\_opc\_gen()}
{\footnotesize\ttfamily int tuak\+\_\+opc\+\_\+gen (\begin{DoxyParamCaption}\item[{uint8\+\_\+t $\ast$}]{opc,  }\item[{const uint8\+\_\+t $\ast$}]{k,  }\item[{uint8\+\_\+t}]{k\+\_\+len\+\_\+bytes,  }\item[{const uint8\+\_\+t $\ast$}]{op }\end{DoxyParamCaption})}



References \textbf{ g\+\_\+keccak\+\_\+iterations}, \textbf{ memcpy\+\_\+reverse()}, \textbf{ tuak\+\_\+core()}, and \textbf{ zero16}.



Referenced by \textbf{ gen\+\_\+opc\+\_\+if\+\_\+needed()}.

\mbox{\label{tuak_8h_a9040005f2cdfb243f4c92ba4294373b5}} 
\index{tuak.h@{tuak.h}!tuak\_set\_keccak\_iterations@{tuak\_set\_keccak\_iterations}}
\index{tuak\_set\_keccak\_iterations@{tuak\_set\_keccak\_iterations}!tuak.h@{tuak.h}}
\doxysubsubsection{tuak\_set\_keccak\_iterations()}
{\footnotesize\ttfamily void tuak\+\_\+set\+\_\+keccak\+\_\+iterations (\begin{DoxyParamCaption}\item[{unsigned int}]{i }\end{DoxyParamCaption})}



References \textbf{ g\+\_\+keccak\+\_\+iterations}.

