\doxysection{Osmocom Authentication Protocol}
\label{group__oap}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}


The Osmocom Authentication Protocol (OAP) is a way to use the 3GPP AKA (Authentication and Key Agreement) as cryptographic authentication mechanism in other protocols that don\textquotesingle{}t provide cryptographic authentication.  


\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ oap.\+h}
\item 
file \textbf{ oap.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom Authentication Protocol. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+oap\+\_\+message}
\begin{DoxyCompactList}\small\item\em Parsed/decoded OAP protocol message. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ osmo\+\_\+oap\+\_\+iei} \{ \newline
\textbf{ OAP\+\_\+\+CAUSE\+\_\+\+IE} = 0x02
, \newline
\textbf{ OAP\+\_\+\+RAND\+\_\+\+IE} = 0x20
, \newline
\textbf{ OAP\+\_\+\+AUTN\+\_\+\+IE} = 0x23
, \newline
\textbf{ OAP\+\_\+\+XRES\+\_\+\+IE} = 0x24
, \newline
\textbf{ OAP\+\_\+\+AUTS\+\_\+\+IE} = 0x25
, \newline
\textbf{ OAP\+\_\+\+CLIENT\+\_\+\+ID\+\_\+\+IE} = 0x30
 \}
\begin{DoxyCompactList}\small\item\em Information Element Identifiers for OAP IEs. \end{DoxyCompactList}\item 
enum \textbf{ osmo\+\_\+oap\+\_\+message\+\_\+type} \{ \newline
\textbf{ OAP\+\_\+\+MSGT\+\_\+\+REGISTER\+\_\+\+REQUEST} = 0b00000100
, \newline
\textbf{ OAP\+\_\+\+MSGT\+\_\+\+REGISTER\+\_\+\+ERROR} = 0b00000101
, \newline
\textbf{ OAP\+\_\+\+MSGT\+\_\+\+REGISTER\+\_\+\+RESULT} = 0b00000110
, \newline
\textbf{ OAP\+\_\+\+MSGT\+\_\+\+CHALLENGE\+\_\+\+REQUEST} = 0b00001000
, \newline
\textbf{ OAP\+\_\+\+MSGT\+\_\+\+CHALLENGE\+\_\+\+ERROR} = 0b00001001
, \newline
\textbf{ OAP\+\_\+\+MSGT\+\_\+\+CHALLENGE\+\_\+\+RESULT} = 0b00001010
, \newline
\textbf{ OAP\+\_\+\+MSGT\+\_\+\+SYNC\+\_\+\+REQUEST} = 0b00001100
, \newline
\textbf{ OAP\+\_\+\+MSGT\+\_\+\+SYNC\+\_\+\+ERROR} = 0b00001101
, \newline
\textbf{ OAP\+\_\+\+MSGT\+\_\+\+SYNC\+\_\+\+RESULT} = 0b00001110
 \}
\begin{DoxyCompactList}\small\item\em OAP message types. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ osmo\+\_\+oap\+\_\+decode} (struct \textbf{ osmo\+\_\+oap\+\_\+message} $\ast$oap\+\_\+msg, const uint8\+\_\+t $\ast$const\+\_\+data, size\+\_\+t data\+\_\+len)
\begin{DoxyCompactList}\small\item\em Decode OAP message data. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+oap\+\_\+encode} (struct \textbf{ msgb} $\ast$\textbf{ msg}, const struct \textbf{ osmo\+\_\+oap\+\_\+message} $\ast$oap\+\_\+msg)
\begin{DoxyCompactList}\small\item\em Compose OAP message data. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
The Osmocom Authentication Protocol (OAP) is a way to use the 3GPP AKA (Authentication and Key Agreement) as cryptographic authentication mechanism in other protocols that don\textquotesingle{}t provide cryptographic authentication. 



\doxysubsection{Enumeration Type Documentation}
\mbox{\label{group__oap_ga199836e7d38fdcdcb8bbe2cfd1e75f34}} 
\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!osmo\_oap\_iei@{osmo\_oap\_iei}}
\index{osmo\_oap\_iei@{osmo\_oap\_iei}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}
\doxysubsubsection{osmo\_oap\_iei}
{\footnotesize\ttfamily enum \textbf{ osmo\+\_\+oap\+\_\+iei}}



Information Element Identifiers for OAP IEs. 

They match osmo\+\_\+gsup\+\_\+iei (so far). \begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_CAUSE\_IE@{OAP\_CAUSE\_IE}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_CAUSE\_IE@{OAP\_CAUSE\_IE}}}\mbox{\label{group__oap_gga199836e7d38fdcdcb8bbe2cfd1e75f34adb489e66c55e9a116b4f55b764d4f0d4}} 
OAP\+\_\+\+CAUSE\+\_\+\+IE&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_RAND\_IE@{OAP\_RAND\_IE}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_RAND\_IE@{OAP\_RAND\_IE}}}\mbox{\label{group__oap_gga199836e7d38fdcdcb8bbe2cfd1e75f34a37700bdd7a0493cc55e594511b477b05}} 
OAP\+\_\+\+RAND\+\_\+\+IE&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_AUTN\_IE@{OAP\_AUTN\_IE}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_AUTN\_IE@{OAP\_AUTN\_IE}}}\mbox{\label{group__oap_gga199836e7d38fdcdcb8bbe2cfd1e75f34abed0f5656e0c26e77bf2ffc7e2b0830a}} 
OAP\+\_\+\+AUTN\+\_\+\+IE&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_XRES\_IE@{OAP\_XRES\_IE}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_XRES\_IE@{OAP\_XRES\_IE}}}\mbox{\label{group__oap_gga199836e7d38fdcdcb8bbe2cfd1e75f34a6fa1b12bad14f2038a5099e77824c1b1}} 
OAP\+\_\+\+XRES\+\_\+\+IE&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_AUTS\_IE@{OAP\_AUTS\_IE}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_AUTS\_IE@{OAP\_AUTS\_IE}}}\mbox{\label{group__oap_gga199836e7d38fdcdcb8bbe2cfd1e75f34ada5bdbb9960314d29e8989754e5d42f3}} 
OAP\+\_\+\+AUTS\+\_\+\+IE&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_CLIENT\_ID\_IE@{OAP\_CLIENT\_ID\_IE}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_CLIENT\_ID\_IE@{OAP\_CLIENT\_ID\_IE}}}\mbox{\label{group__oap_gga199836e7d38fdcdcb8bbe2cfd1e75f34ab72885a73db5b74f48681a28e47e1362}} 
OAP\+\_\+\+CLIENT\+\_\+\+ID\+\_\+\+IE&\\
\hline

\end{DoxyEnumFields}
\mbox{\label{group__oap_ga833e8a5b20c7cfe0d598919cab5f306c}} 
\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!osmo\_oap\_message\_type@{osmo\_oap\_message\_type}}
\index{osmo\_oap\_message\_type@{osmo\_oap\_message\_type}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}
\doxysubsubsection{osmo\_oap\_message\_type}
{\footnotesize\ttfamily enum \textbf{ osmo\+\_\+oap\+\_\+message\+\_\+type}}



OAP message types. 

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_MSGT\_REGISTER\_REQUEST@{OAP\_MSGT\_REGISTER\_REQUEST}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_MSGT\_REGISTER\_REQUEST@{OAP\_MSGT\_REGISTER\_REQUEST}}}\mbox{\label{group__oap_gga833e8a5b20c7cfe0d598919cab5f306ca461cb5ec879eb717e5022cdf005d6101}} 
OAP\+\_\+\+MSGT\+\_\+\+REGISTER\+\_\+\+REQUEST&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_MSGT\_REGISTER\_ERROR@{OAP\_MSGT\_REGISTER\_ERROR}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_MSGT\_REGISTER\_ERROR@{OAP\_MSGT\_REGISTER\_ERROR}}}\mbox{\label{group__oap_gga833e8a5b20c7cfe0d598919cab5f306ca1d9713fd62b55feae58f65c9a691ba88}} 
OAP\+\_\+\+MSGT\+\_\+\+REGISTER\+\_\+\+ERROR&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_MSGT\_REGISTER\_RESULT@{OAP\_MSGT\_REGISTER\_RESULT}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_MSGT\_REGISTER\_RESULT@{OAP\_MSGT\_REGISTER\_RESULT}}}\mbox{\label{group__oap_gga833e8a5b20c7cfe0d598919cab5f306ca65ba13da2b8e25df21936877f7752e04}} 
OAP\+\_\+\+MSGT\+\_\+\+REGISTER\+\_\+\+RESULT&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_MSGT\_CHALLENGE\_REQUEST@{OAP\_MSGT\_CHALLENGE\_REQUEST}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_MSGT\_CHALLENGE\_REQUEST@{OAP\_MSGT\_CHALLENGE\_REQUEST}}}\mbox{\label{group__oap_gga833e8a5b20c7cfe0d598919cab5f306ca73f09c47880fc2ed5817fe6e7b829a1c}} 
OAP\+\_\+\+MSGT\+\_\+\+CHALLENGE\+\_\+\+REQUEST&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_MSGT\_CHALLENGE\_ERROR@{OAP\_MSGT\_CHALLENGE\_ERROR}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_MSGT\_CHALLENGE\_ERROR@{OAP\_MSGT\_CHALLENGE\_ERROR}}}\mbox{\label{group__oap_gga833e8a5b20c7cfe0d598919cab5f306ca6965ad01cf797e51273f7ce508009c3b}} 
OAP\+\_\+\+MSGT\+\_\+\+CHALLENGE\+\_\+\+ERROR&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_MSGT\_CHALLENGE\_RESULT@{OAP\_MSGT\_CHALLENGE\_RESULT}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_MSGT\_CHALLENGE\_RESULT@{OAP\_MSGT\_CHALLENGE\_RESULT}}}\mbox{\label{group__oap_gga833e8a5b20c7cfe0d598919cab5f306ca928cbc2658fb690880fdc0a42196f344}} 
OAP\+\_\+\+MSGT\+\_\+\+CHALLENGE\+\_\+\+RESULT&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_MSGT\_SYNC\_REQUEST@{OAP\_MSGT\_SYNC\_REQUEST}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_MSGT\_SYNC\_REQUEST@{OAP\_MSGT\_SYNC\_REQUEST}}}\mbox{\label{group__oap_gga833e8a5b20c7cfe0d598919cab5f306ca583404fe32d0b48e97bfd2fd04fa3899}} 
OAP\+\_\+\+MSGT\+\_\+\+SYNC\+\_\+\+REQUEST&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_MSGT\_SYNC\_ERROR@{OAP\_MSGT\_SYNC\_ERROR}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_MSGT\_SYNC\_ERROR@{OAP\_MSGT\_SYNC\_ERROR}}}\mbox{\label{group__oap_gga833e8a5b20c7cfe0d598919cab5f306ca4ff868f2b357649cf95cbd655b8a7735}} 
OAP\+\_\+\+MSGT\+\_\+\+SYNC\+\_\+\+ERROR&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OAP\_MSGT\_SYNC\_RESULT@{OAP\_MSGT\_SYNC\_RESULT}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!OAP\_MSGT\_SYNC\_RESULT@{OAP\_MSGT\_SYNC\_RESULT}}}\mbox{\label{group__oap_gga833e8a5b20c7cfe0d598919cab5f306ca606577dd37ee117f8022baf1fd94a00d}} 
OAP\+\_\+\+MSGT\+\_\+\+SYNC\+\_\+\+RESULT&\\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\mbox{\label{group__oap_gac188809245237da8d619cfe9df98ff0b}} 
\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!osmo\_oap\_decode@{osmo\_oap\_decode}}
\index{osmo\_oap\_decode@{osmo\_oap\_decode}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}
\doxysubsubsection{osmo\_oap\_decode()}
{\footnotesize\ttfamily int osmo\+\_\+oap\+\_\+decode (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+oap\+\_\+message} $\ast$}]{oap\+\_\+msg,  }\item[{const uint8\+\_\+t $\ast$}]{const\+\_\+data,  }\item[{size\+\_\+t}]{data\+\_\+len }\end{DoxyParamCaption})}



Decode OAP message data. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em oap\+\_\+msg} & Parsed data is written to this instance. \\
\hline
\mbox{\texttt{ in}}  & {\em data} & Pointer to the data buffer containing the OAP message. \\
\hline
\mbox{\texttt{ in}}  & {\em data\+\_\+len} & Length of the OAP message data. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, a negative cause value on failure. 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+oap\+\_\+message\+::autn}, \textbf{ osmo\+\_\+oap\+\_\+message\+::autn\+\_\+present}, \textbf{ osmo\+\_\+oap\+\_\+message\+::auts}, \textbf{ osmo\+\_\+oap\+\_\+message\+::auts\+\_\+present}, \textbf{ osmo\+\_\+oap\+\_\+message\+::cause}, \textbf{ osmo\+\_\+oap\+\_\+message\+::client\+\_\+id}, \textbf{ data}, \textbf{ DLOAP}, \textbf{ GMM\+\_\+\+CAUSE\+\_\+\+INV\+\_\+\+MAND\+\_\+\+INFO}, \textbf{ GMM\+\_\+\+CAUSE\+\_\+\+PROTO\+\_\+\+ERR\+\_\+\+UNSPEC}, \textbf{ iei}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGL\+\_\+\+NOTICE}, \textbf{ LOGP}, \textbf{ osmo\+\_\+oap\+\_\+message\+::message\+\_\+type}, \textbf{ OAP\+\_\+\+AUTN\+\_\+\+IE}, \textbf{ OAP\+\_\+\+AUTS\+\_\+\+IE}, \textbf{ OAP\+\_\+\+CAUSE\+\_\+\+IE}, \textbf{ OAP\+\_\+\+CLIENT\+\_\+\+ID\+\_\+\+IE}, \textbf{ OAP\+\_\+\+RAND\+\_\+\+IE}, \textbf{ OAP\+\_\+\+XRES\+\_\+\+IE}, \textbf{ osmo\+\_\+decode\+\_\+big\+\_\+endian()}, \textbf{ osmo\+\_\+shift\+\_\+tlv()}, \textbf{ osmo\+\_\+shift\+\_\+v\+\_\+fixed()}, \textbf{ osmo\+\_\+oap\+\_\+message\+::rand}, \textbf{ osmo\+\_\+oap\+\_\+message\+::rand\+\_\+present}, \textbf{ osmo\+\_\+oap\+\_\+message\+::xres}, and \textbf{ osmo\+\_\+oap\+\_\+message\+::xres\+\_\+present}.



Referenced by \textbf{ osmo\+\_\+oap\+\_\+client\+\_\+handle()}.

\mbox{\label{group__oap_ga949f5c2430f44f354d09c3387e61046a}} 
\index{Osmocom Authentication Protocol@{Osmocom Authentication Protocol}!osmo\_oap\_encode@{osmo\_oap\_encode}}
\index{osmo\_oap\_encode@{osmo\_oap\_encode}!Osmocom Authentication Protocol@{Osmocom Authentication Protocol}}
\doxysubsubsection{osmo\_oap\_encode()}
{\footnotesize\ttfamily void osmo\+\_\+oap\+\_\+encode (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{const struct \textbf{ osmo\+\_\+oap\+\_\+message} $\ast$}]{oap\+\_\+msg }\end{DoxyParamCaption})}



Compose OAP message data. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em msg} & OAP message data is appended to this message buffer. \\
\hline
\mbox{\texttt{ in}}  & {\em oap\+\_\+msg} & Elements to encode in the message data. \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+oap\+\_\+message\+::autn}, \textbf{ osmo\+\_\+oap\+\_\+message\+::autn\+\_\+present}, \textbf{ osmo\+\_\+oap\+\_\+message\+::auts}, \textbf{ osmo\+\_\+oap\+\_\+message\+::auts\+\_\+present}, \textbf{ osmo\+\_\+oap\+\_\+message\+::cause}, \textbf{ osmo\+\_\+oap\+\_\+message\+::client\+\_\+id}, \textbf{ osmo\+\_\+oap\+\_\+message\+::message\+\_\+type}, \textbf{ msg}, \textbf{ msgb\+\_\+tlv\+\_\+put()}, \textbf{ msgb\+\_\+v\+\_\+put()}, \textbf{ OAP\+\_\+\+AUTN\+\_\+\+IE}, \textbf{ OAP\+\_\+\+AUTS\+\_\+\+IE}, \textbf{ OAP\+\_\+\+CAUSE\+\_\+\+IE}, \textbf{ OAP\+\_\+\+CLIENT\+\_\+\+ID\+\_\+\+IE}, \textbf{ OAP\+\_\+\+RAND\+\_\+\+IE}, \textbf{ OAP\+\_\+\+XRES\+\_\+\+IE}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ osmo\+\_\+encode\+\_\+big\+\_\+endian()}, \textbf{ osmo\+\_\+oap\+\_\+message\+::rand}, \textbf{ osmo\+\_\+oap\+\_\+message\+::rand\+\_\+present}, \textbf{ osmo\+\_\+oap\+\_\+message\+::xres}, and \textbf{ osmo\+\_\+oap\+\_\+message\+::xres\+\_\+present}.



Referenced by \textbf{ osmo\+\_\+oap\+\_\+client\+\_\+encoded()}.

