\doxysection{common.\+h}
\label{kdf_2common_8h_source}\index{src/gsm/kdf/common.h@{src/gsm/kdf/common.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{2 }
\DoxyCodeLine{3 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{4 \textcolor{preprocessor}{\#include <stdlib.h>}}
\DoxyCodeLine{5 \textcolor{preprocessor}{\#include <string.h>}}
\DoxyCodeLine{6 }
\DoxyCodeLine{7 \textcolor{preprocessor}{\#define CONFIG\_CRYPTO\_INTERNAL}}
\DoxyCodeLine{8 \textcolor{preprocessor}{\#define TEST\_FAIL() 0}}
\DoxyCodeLine{9 }
\DoxyCodeLine{10 \textcolor{preprocessor}{\#define MSG\_DEBUG}}
\DoxyCodeLine{11 \textcolor{preprocessor}{\#define wpa\_hexdump(x, args...)}}
\DoxyCodeLine{12 \textcolor{preprocessor}{\#define wpa\_hexdump\_key(x, args...)}}
\DoxyCodeLine{13 \textcolor{preprocessor}{\#define wpa\_printf(x, args...)}}
\DoxyCodeLine{14 }
\DoxyCodeLine{15 \textcolor{preprocessor}{\#define os\_memcpy(x, y, z)  memcpy(x, y, z)}}
\DoxyCodeLine{16 \textcolor{preprocessor}{\#define os\_memcmp(x, y, z)  memcmp(x, y, z)}}
\DoxyCodeLine{17 \textcolor{preprocessor}{\#define os\_memset(x, y, z)  memset(x, y, z)}}
\DoxyCodeLine{18 \textcolor{preprocessor}{\#define os\_malloc(x)  malloc(x)}}
\DoxyCodeLine{19 \textcolor{preprocessor}{\#define os\_free(x)  free(x)}}
\DoxyCodeLine{20 \textcolor{preprocessor}{\#define os\_strlen(x)  strlen(x)}}
\DoxyCodeLine{21 }
\DoxyCodeLine{22 \textcolor{preprocessor}{\#define forced\_memzero(ptr, len) memset(ptr, 0, len);}}
\DoxyCodeLine{23 }
\DoxyCodeLine{24 \textcolor{keyword}{typedef} uint64\_t u64;}
\DoxyCodeLine{25 \textcolor{keyword}{typedef} uint32\_t u32;}
\DoxyCodeLine{26 \textcolor{keyword}{typedef} uint16\_t u16;}
\DoxyCodeLine{27 \textcolor{keyword}{typedef} uint8\_t u8;}
\DoxyCodeLine{28 \textcolor{keyword}{typedef} int64\_t s64;}
\DoxyCodeLine{29 \textcolor{keyword}{typedef} int32\_t s32;}
\DoxyCodeLine{30 \textcolor{keyword}{typedef} int16\_t s16;}
\DoxyCodeLine{31 \textcolor{keyword}{typedef} int8\_t s8;}
\DoxyCodeLine{32 }
\DoxyCodeLine{33 }
\DoxyCodeLine{34 \textcolor{comment}{/* Macros for handling unaligned memory accesses */}}
\DoxyCodeLine{35 }
\DoxyCodeLine{36 \textcolor{preprocessor}{\#define WPA\_GET\_BE16(a) ((u16) (((a)[0] << 8) | (a)[1]))}}
\DoxyCodeLine{37 \textcolor{preprocessor}{\#define WPA\_PUT\_BE16(a, val)                    \(\backslash\)}}
\DoxyCodeLine{38 \textcolor{preprocessor}{        do \{                                    \(\backslash\)}}
\DoxyCodeLine{39 \textcolor{preprocessor}{                (a)[0] = ((u16) (val)) >> 8;    \(\backslash\)}}
\DoxyCodeLine{40 \textcolor{preprocessor}{                (a)[1] = ((u16) (val)) \& 0xff;  \(\backslash\)}}
\DoxyCodeLine{41 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{42 }
\DoxyCodeLine{43 \textcolor{preprocessor}{\#define WPA\_GET\_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))}}
\DoxyCodeLine{44 \textcolor{preprocessor}{\#define WPA\_PUT\_LE16(a, val)                    \(\backslash\)}}
\DoxyCodeLine{45 \textcolor{preprocessor}{        do \{                                    \(\backslash\)}}
\DoxyCodeLine{46 \textcolor{preprocessor}{                (a)[1] = ((u16) (val)) >> 8;    \(\backslash\)}}
\DoxyCodeLine{47 \textcolor{preprocessor}{                (a)[0] = ((u16) (val)) \& 0xff;  \(\backslash\)}}
\DoxyCodeLine{48 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{49 }
\DoxyCodeLine{50 \textcolor{preprocessor}{\#define WPA\_GET\_BE24(a) ((((u32) (a)[0]) << 16) | (((u32) (a)[1]) << 8) | \(\backslash\)}}
\DoxyCodeLine{51 \textcolor{preprocessor}{                         ((u32) (a)[2]))}}
\DoxyCodeLine{52 \textcolor{preprocessor}{\#define WPA\_PUT\_BE24(a, val)                                    \(\backslash\)}}
\DoxyCodeLine{53 \textcolor{preprocessor}{        do \{                                                    \(\backslash\)}}
\DoxyCodeLine{54 \textcolor{preprocessor}{                (a)[0] = (u8) ((((u32) (val)) >> 16) \& 0xff);   \(\backslash\)}}
\DoxyCodeLine{55 \textcolor{preprocessor}{                (a)[1] = (u8) ((((u32) (val)) >> 8) \& 0xff);    \(\backslash\)}}
\DoxyCodeLine{56 \textcolor{preprocessor}{                (a)[2] = (u8) (((u32) (val)) \& 0xff);           \(\backslash\)}}
\DoxyCodeLine{57 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{58 }
\DoxyCodeLine{59 \textcolor{preprocessor}{\#define WPA\_GET\_BE32(a) ((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \(\backslash\)}}
\DoxyCodeLine{60 \textcolor{preprocessor}{                         (((u32) (a)[2]) << 8) | ((u32) (a)[3]))}}
\DoxyCodeLine{61 \textcolor{preprocessor}{\#define WPA\_PUT\_BE32(a, val)                                    \(\backslash\)}}
\DoxyCodeLine{62 \textcolor{preprocessor}{        do \{                                                    \(\backslash\)}}
\DoxyCodeLine{63 \textcolor{preprocessor}{                (a)[0] = (u8) ((((u32) (val)) >> 24) \& 0xff);   \(\backslash\)}}
\DoxyCodeLine{64 \textcolor{preprocessor}{                (a)[1] = (u8) ((((u32) (val)) >> 16) \& 0xff);   \(\backslash\)}}
\DoxyCodeLine{65 \textcolor{preprocessor}{                (a)[2] = (u8) ((((u32) (val)) >> 8) \& 0xff);    \(\backslash\)}}
\DoxyCodeLine{66 \textcolor{preprocessor}{                (a)[3] = (u8) (((u32) (val)) \& 0xff);           \(\backslash\)}}
\DoxyCodeLine{67 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{68 }
\DoxyCodeLine{69 \textcolor{preprocessor}{\#define WPA\_GET\_LE32(a) ((((u32) (a)[3]) << 24) | (((u32) (a)[2]) << 16) | \(\backslash\)}}
\DoxyCodeLine{70 \textcolor{preprocessor}{                         (((u32) (a)[1]) << 8) | ((u32) (a)[0]))}}
\DoxyCodeLine{71 \textcolor{preprocessor}{\#define WPA\_PUT\_LE32(a, val)                                    \(\backslash\)}}
\DoxyCodeLine{72 \textcolor{preprocessor}{        do \{                                                    \(\backslash\)}}
\DoxyCodeLine{73 \textcolor{preprocessor}{                (a)[3] = (u8) ((((u32) (val)) >> 24) \& 0xff);   \(\backslash\)}}
\DoxyCodeLine{74 \textcolor{preprocessor}{                (a)[2] = (u8) ((((u32) (val)) >> 16) \& 0xff);   \(\backslash\)}}
\DoxyCodeLine{75 \textcolor{preprocessor}{                (a)[1] = (u8) ((((u32) (val)) >> 8) \& 0xff);    \(\backslash\)}}
\DoxyCodeLine{76 \textcolor{preprocessor}{                (a)[0] = (u8) (((u32) (val)) \& 0xff);           \(\backslash\)}}
\DoxyCodeLine{77 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{78 }
\DoxyCodeLine{79 \textcolor{preprocessor}{\#define WPA\_GET\_BE64(a) ((((u64) (a)[0]) << 56) | (((u64) (a)[1]) << 48) | \(\backslash\)}}
\DoxyCodeLine{80 \textcolor{preprocessor}{                         (((u64) (a)[2]) << 40) | (((u64) (a)[3]) << 32) | \(\backslash\)}}
\DoxyCodeLine{81 \textcolor{preprocessor}{                         (((u64) (a)[4]) << 24) | (((u64) (a)[5]) << 16) | \(\backslash\)}}
\DoxyCodeLine{82 \textcolor{preprocessor}{                         (((u64) (a)[6]) << 8) | ((u64) (a)[7]))}}
\DoxyCodeLine{83 \textcolor{preprocessor}{\#define WPA\_PUT\_BE64(a, val)                            \(\backslash\)}}
\DoxyCodeLine{84 \textcolor{preprocessor}{        do \{                                            \(\backslash\)}}
\DoxyCodeLine{85 \textcolor{preprocessor}{                (a)[0] = (u8) (((u64) (val)) >> 56);    \(\backslash\)}}
\DoxyCodeLine{86 \textcolor{preprocessor}{                (a)[1] = (u8) (((u64) (val)) >> 48);    \(\backslash\)}}
\DoxyCodeLine{87 \textcolor{preprocessor}{                (a)[2] = (u8) (((u64) (val)) >> 40);    \(\backslash\)}}
\DoxyCodeLine{88 \textcolor{preprocessor}{                (a)[3] = (u8) (((u64) (val)) >> 32);    \(\backslash\)}}
\DoxyCodeLine{89 \textcolor{preprocessor}{                (a)[4] = (u8) (((u64) (val)) >> 24);    \(\backslash\)}}
\DoxyCodeLine{90 \textcolor{preprocessor}{                (a)[5] = (u8) (((u64) (val)) >> 16);    \(\backslash\)}}
\DoxyCodeLine{91 \textcolor{preprocessor}{                (a)[6] = (u8) (((u64) (val)) >> 8);     \(\backslash\)}}
\DoxyCodeLine{92 \textcolor{preprocessor}{                (a)[7] = (u8) (((u64) (val)) \& 0xff);   \(\backslash\)}}
\DoxyCodeLine{93 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{94 }
\DoxyCodeLine{95 \textcolor{preprocessor}{\#define WPA\_GET\_LE64(a) ((((u64) (a)[7]) << 56) | (((u64) (a)[6]) << 48) | \(\backslash\)}}
\DoxyCodeLine{96 \textcolor{preprocessor}{                         (((u64) (a)[5]) << 40) | (((u64) (a)[4]) << 32) | \(\backslash\)}}
\DoxyCodeLine{97 \textcolor{preprocessor}{                         (((u64) (a)[3]) << 24) | (((u64) (a)[2]) << 16) | \(\backslash\)}}
\DoxyCodeLine{98 \textcolor{preprocessor}{                         (((u64) (a)[1]) << 8) | ((u64) (a)[0]))}}
\DoxyCodeLine{99 }
\DoxyCodeLine{100 }
\DoxyCodeLine{101 \textcolor{preprocessor}{\#define \_\_must\_check}}

\end{DoxyCode}
