\doxysection{src/gsm/kdf/sha256.h File Reference}
\label{sha256_8h}\index{src/gsm/kdf/sha256.h@{src/gsm/kdf/sha256.h}}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ SHA256\+\_\+\+MAC\+\_\+\+LEN}~32
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ hmac\+\_\+sha256\+\_\+vector} (const \textbf{ u8} $\ast$key, size\+\_\+t key\+\_\+len, size\+\_\+t num\+\_\+elem, const \textbf{ u8} $\ast$addr[$\,$], const size\+\_\+t $\ast$\textbf{ len}, \textbf{ u8} $\ast$mac)
\begin{DoxyCompactList}\small\item\em hmac\+\_\+sha256\+\_\+vector -\/ HMAC-\/\+SHA256 over data vector (RFC 2104) @key\+: Key for HMAC operations @key\+\_\+len\+: Length of the key in bytes @num\+\_\+elem\+: Number of elements in the data vector @addr\+: Pointers to the data areas @len\+: Lengths of the data blocks @mac\+: Buffer for the hash (32 bytes) \end{DoxyCompactList}\item 
void \textbf{ hmac\+\_\+sha256} (const \textbf{ u8} $\ast$key, size\+\_\+t key\+\_\+len, const \textbf{ u8} $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len, \textbf{ u8} $\ast$mac)
\begin{DoxyCompactList}\small\item\em hmac\+\_\+sha256 -\/ HMAC-\/\+SHA256 over data buffer (RFC 2104) @key\+: Key for HMAC operations @key\+\_\+len\+: Length of the key in bytes @data\+: Pointers to the data area @data\+\_\+len\+: Length of the data area @mac\+: Buffer for the hash (20 bytes) \end{DoxyCompactList}\item 
void \textbf{ sha256\+\_\+prf} (const \textbf{ u8} $\ast$key, size\+\_\+t key\+\_\+len, const char $\ast$label, const \textbf{ u8} $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len, \textbf{ u8} $\ast$buf, size\+\_\+t buf\+\_\+len)
\begin{DoxyCompactList}\small\item\em sha256\+\_\+prf -\/ SHA256-\/based Pseudo-\/\+Random Function (IEEE 802.\+11r, 8.\+5.\+1.\+5.\+2) @key\+: Key for PRF @key\+\_\+len\+: Length of the key in bytes @label\+: A unique label for each purpose of the PRF @data\+: Extra data to bind into the key @data\+\_\+len\+: Length of the data @buf\+: Buffer for the generated pseudo-\/random key @buf\+\_\+len\+: Number of bytes of key to generate \end{DoxyCompactList}\item 
void \textbf{ tls\+\_\+prf\+\_\+sha256} (const \textbf{ u8} $\ast$secret, size\+\_\+t secret\+\_\+len, const char $\ast$label, const \textbf{ u8} $\ast$seed, size\+\_\+t seed\+\_\+len, \textbf{ u8} $\ast$out, size\+\_\+t outlen)
\end{DoxyCompactItemize}


\doxysubsection{Macro Definition Documentation}
\mbox{\label{sha256_8h_add525eedcc6195755e712a22dcb22f8d}} 
\index{sha256.h@{sha256.h}!SHA256\_MAC\_LEN@{SHA256\_MAC\_LEN}}
\index{SHA256\_MAC\_LEN@{SHA256\_MAC\_LEN}!sha256.h@{sha256.h}}
\doxysubsubsection{SHA256\_MAC\_LEN}
{\footnotesize\ttfamily \#define SHA256\+\_\+\+MAC\+\_\+\+LEN~32}



\doxysubsection{Function Documentation}
\mbox{\label{sha256_8h_aab5c2214e831e1ff3358abdf5e09afa5}} 
\index{sha256.h@{sha256.h}!hmac\_sha256@{hmac\_sha256}}
\index{hmac\_sha256@{hmac\_sha256}!sha256.h@{sha256.h}}
\doxysubsubsection{hmac\_sha256()}
{\footnotesize\ttfamily void hmac\+\_\+sha256 (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{key\+\_\+len,  }\item[{const \textbf{ u8} $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len,  }\item[{\textbf{ u8} $\ast$}]{mac }\end{DoxyParamCaption})}



hmac\+\_\+sha256 -\/ HMAC-\/\+SHA256 over data buffer (RFC 2104) @key\+: Key for HMAC operations @key\+\_\+len\+: Length of the key in bytes @data\+: Pointers to the data area @data\+\_\+len\+: Length of the data area @mac\+: Buffer for the hash (20 bytes) 



References \textbf{ data}, and \textbf{ hmac\+\_\+sha256\+\_\+vector()}.

\mbox{\label{sha256_8h_a5fafd5b2a8f791cb6c05beb908663d37}} 
\index{sha256.h@{sha256.h}!hmac\_sha256\_vector@{hmac\_sha256\_vector}}
\index{hmac\_sha256\_vector@{hmac\_sha256\_vector}!sha256.h@{sha256.h}}
\doxysubsubsection{hmac\_sha256\_vector()}
{\footnotesize\ttfamily void hmac\+\_\+sha256\+\_\+vector (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{key\+\_\+len,  }\item[{size\+\_\+t}]{num\+\_\+elem,  }\item[{const \textbf{ u8} $\ast$}]{addr[$\,$],  }\item[{const size\+\_\+t $\ast$}]{len,  }\item[{\textbf{ u8} $\ast$}]{mac }\end{DoxyParamCaption})}



hmac\+\_\+sha256\+\_\+vector -\/ HMAC-\/\+SHA256 over data vector (RFC 2104) @key\+: Key for HMAC operations @key\+\_\+len\+: Length of the key in bytes @num\+\_\+elem\+: Number of elements in the data vector @addr\+: Pointers to the data areas @len\+: Lengths of the data blocks @mac\+: Buffer for the hash (32 bytes) 



References \textbf{ len}, \textbf{ os\+\_\+memcpy}, \textbf{ os\+\_\+memset}, \textbf{ SHA256\+\_\+\+MAC\+\_\+\+LEN}, and \textbf{ sha256\+\_\+vector()}.



Referenced by \textbf{ hmac\+\_\+sha256()}, and \textbf{ sha256\+\_\+prf()}.

\mbox{\label{sha256_8h_ae75ffcb34eb7260c8b1a20740c314aae}} 
\index{sha256.h@{sha256.h}!sha256\_prf@{sha256\_prf}}
\index{sha256\_prf@{sha256\_prf}!sha256.h@{sha256.h}}
\doxysubsubsection{sha256\_prf()}
{\footnotesize\ttfamily void sha256\+\_\+prf (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{key\+\_\+len,  }\item[{const char $\ast$}]{label,  }\item[{const \textbf{ u8} $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len,  }\item[{\textbf{ u8} $\ast$}]{buf,  }\item[{size\+\_\+t}]{buf\+\_\+len }\end{DoxyParamCaption})}



sha256\+\_\+prf -\/ SHA256-\/based Pseudo-\/\+Random Function (IEEE 802.\+11r, 8.\+5.\+1.\+5.\+2) @key\+: Key for PRF @key\+\_\+len\+: Length of the key in bytes @label\+: A unique label for each purpose of the PRF @data\+: Extra data to bind into the key @data\+\_\+len\+: Length of the data @buf\+: Buffer for the generated pseudo-\/random key @buf\+\_\+len\+: Number of bytes of key to generate 

This function is used to derive new, cryptographically separate keys from a given key. 

References \textbf{ data}, \textbf{ hmac\+\_\+sha256\+\_\+vector()}, \textbf{ len}, \textbf{ os\+\_\+memcpy}, \textbf{ os\+\_\+strlen}, \textbf{ SHA256\+\_\+\+MAC\+\_\+\+LEN}, and \textbf{ WPA\+\_\+\+PUT\+\_\+\+LE16}.

\mbox{\label{sha256_8h_adac9d3d5b5baeddbffe80f50666d9e42}} 
\index{sha256.h@{sha256.h}!tls\_prf\_sha256@{tls\_prf\_sha256}}
\index{tls\_prf\_sha256@{tls\_prf\_sha256}!sha256.h@{sha256.h}}
\doxysubsubsection{tls\_prf\_sha256()}
{\footnotesize\ttfamily void tls\+\_\+prf\+\_\+sha256 (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{secret,  }\item[{size\+\_\+t}]{secret\+\_\+len,  }\item[{const char $\ast$}]{label,  }\item[{const \textbf{ u8} $\ast$}]{seed,  }\item[{size\+\_\+t}]{seed\+\_\+len,  }\item[{\textbf{ u8} $\ast$}]{out,  }\item[{size\+\_\+t}]{outlen }\end{DoxyParamCaption})}

