\doxysection{a5.\+h}
\label{a5_8h_source}\index{include/osmocom/gsm/a5.h@{include/osmocom/gsm/a5.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 \textcolor{comment}{/*}}
\DoxyCodeLine{2 \textcolor{comment}{ * Copyright (C) 2011  Sylvain Munaut <tnt@246tNt.com>}}
\DoxyCodeLine{3 \textcolor{comment}{ *}}
\DoxyCodeLine{4 \textcolor{comment}{ * All Rights Reserved}}
\DoxyCodeLine{5 \textcolor{comment}{ *}}
\DoxyCodeLine{6 \textcolor{comment}{ * This program is free software; you can redistribute it and/or modify}}
\DoxyCodeLine{7 \textcolor{comment}{ * it under the terms of the GNU General Public License as published by}}
\DoxyCodeLine{8 \textcolor{comment}{ * the Free Software Foundation; either version 2 of the License, or}}
\DoxyCodeLine{9 \textcolor{comment}{ * (at your option) any later version.}}
\DoxyCodeLine{10 \textcolor{comment}{ *}}
\DoxyCodeLine{11 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}}
\DoxyCodeLine{12 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}}
\DoxyCodeLine{13 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the}}
\DoxyCodeLine{14 \textcolor{comment}{ * GNU General Public License for more details.}}
\DoxyCodeLine{15 \textcolor{comment}{ */}}
\DoxyCodeLine{16 }
\DoxyCodeLine{17 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{18 }
\DoxyCodeLine{19 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{20 }
\DoxyCodeLine{21 \textcolor{preprocessor}{\#include <osmocom/core/defs.h>}}
\DoxyCodeLine{22 \textcolor{preprocessor}{\#include <osmocom/core/bits.h>}}
\DoxyCodeLine{23 }
\DoxyCodeLine{32 \textcolor{keyword}{static} \textcolor{keyword}{inline} uint32\_t}
\DoxyCodeLine{33 osmo\_a5\_fn\_count(uint32\_t fn)}
\DoxyCodeLine{34 \{}
\DoxyCodeLine{35         \textcolor{keywordtype}{int} t1 = fn / (26 * 51);}
\DoxyCodeLine{36         \textcolor{keywordtype}{int} t2 = fn \% 26;}
\DoxyCodeLine{37         \textcolor{keywordtype}{int} t3 = fn \% 51;}
\DoxyCodeLine{38         \textcolor{keywordflow}{return} (t1 << 11) | (t3 << 5) | t2;}
\DoxyCodeLine{39 \}}
\DoxyCodeLine{40 }
\DoxyCodeLine{41         \textcolor{comment}{/* Notes:}}
\DoxyCodeLine{42 \textcolor{comment}{         *  -\/ key must be 8 or 16 (for a5/4) bytes long (or NULL for A5/0)}}
\DoxyCodeLine{43 \textcolor{comment}{         *  -\/ the dl and ul pointer must be either NULL or 114 bits long}}
\DoxyCodeLine{44 \textcolor{comment}{         *  -\/ fn is the \_real\_ GSM frame number.}}
\DoxyCodeLine{45 \textcolor{comment}{         *    (converted internally to fn\_count)}}
\DoxyCodeLine{46 \textcolor{comment}{         */}}
\DoxyCodeLine{47 \textcolor{keywordtype}{int} osmo\_a5(\textcolor{keywordtype}{int} n, \textcolor{keyword}{const} uint8\_t *key, uint32\_t fn, ubit\_t *dl, ubit\_t *ul);}
\DoxyCodeLine{48 \textcolor{keywordtype}{void} osmo\_a5\_1(\textcolor{keyword}{const} uint8\_t *key, uint32\_t fn, ubit\_t *dl, ubit\_t *ul) OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use generic osmo\_a5() instead"{}});}
\DoxyCodeLine{49 \textcolor{keywordtype}{void} osmo\_a5\_2(\textcolor{keyword}{const} uint8\_t *key, uint32\_t fn, ubit\_t *dl, ubit\_t *ul) OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use generic osmo\_a5() instead"{}});}
\DoxyCodeLine{50 }

\end{DoxyCode}
