\doxysection{src/gsm/kdf/sha1.h File Reference}
\label{sha1_8h}\index{src/gsm/kdf/sha1.h@{src/gsm/kdf/sha1.h}}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ SHA1\+\_\+\+MAC\+\_\+\+LEN}~20
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ hmac\+\_\+sha1\+\_\+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\+\_\+sha1\+\_\+vector -\/ HMAC-\/\+SHA1 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 (20 bytes) Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ hmac\+\_\+sha1} (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\+\_\+sha1 -\/ HMAC-\/\+SHA1 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) Returns\+: 0 on success, -\/1 of failure \end{DoxyCompactList}\item 
int \textbf{ sha1\+\_\+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 sha1\+\_\+prf -\/ SHA1-\/based Pseudo-\/\+Random Function (PRF) (IEEE 802.\+11i, 8.\+5.\+1.\+1) @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 Returns\+: 0 on success, -\/1 of failure \end{DoxyCompactList}\item 
int \textbf{ sha1\+\_\+t\+\_\+prf} (const \textbf{ u8} $\ast$key, size\+\_\+t key\+\_\+len, const char $\ast$label, const \textbf{ u8} $\ast$seed, size\+\_\+t seed\+\_\+len, \textbf{ u8} $\ast$buf, size\+\_\+t buf\+\_\+len)
\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ tls\+\_\+prf\+\_\+sha1\+\_\+md5} (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)
\item 
int \textbf{ pbkdf2\+\_\+sha1} (const char $\ast$passphrase, const char $\ast$ssid, size\+\_\+t ssid\+\_\+len, int iterations, \textbf{ u8} $\ast$buf, size\+\_\+t buflen)
\end{DoxyCompactItemize}


\doxysubsection{Macro Definition Documentation}
\mbox{\label{sha1_8h_a25d4d74da6f672731d803f7629b3ecef}} 
\index{sha1.h@{sha1.h}!SHA1\_MAC\_LEN@{SHA1\_MAC\_LEN}}
\index{SHA1\_MAC\_LEN@{SHA1\_MAC\_LEN}!sha1.h@{sha1.h}}
\doxysubsubsection{SHA1\_MAC\_LEN}
{\footnotesize\ttfamily \#define SHA1\+\_\+\+MAC\+\_\+\+LEN~20}



\doxysubsection{Function Documentation}
\mbox{\label{sha1_8h_a746cfe54c780a704239af25ea2953cd4}} 
\index{sha1.h@{sha1.h}!hmac\_sha1@{hmac\_sha1}}
\index{hmac\_sha1@{hmac\_sha1}!sha1.h@{sha1.h}}
\doxysubsubsection{hmac\_sha1()}
{\footnotesize\ttfamily int hmac\+\_\+sha1 (\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\+\_\+sha1 -\/ HMAC-\/\+SHA1 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) Returns\+: 0 on success, -\/1 of failure 



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

\mbox{\label{sha1_8h_aa0ee972a55e1005b2bdaf33e1d608946}} 
\index{sha1.h@{sha1.h}!hmac\_sha1\_vector@{hmac\_sha1\_vector}}
\index{hmac\_sha1\_vector@{hmac\_sha1\_vector}!sha1.h@{sha1.h}}
\doxysubsubsection{hmac\_sha1\_vector()}
{\footnotesize\ttfamily int hmac\+\_\+sha1\+\_\+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\+\_\+sha1\+\_\+vector -\/ HMAC-\/\+SHA1 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 (20 bytes) Returns\+: 0 on success, -\/1 on failure 



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



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

\mbox{\label{sha1_8h_a93fb78f3c7dd116251d8de658ab6f636}} 
\index{sha1.h@{sha1.h}!pbkdf2\_sha1@{pbkdf2\_sha1}}
\index{pbkdf2\_sha1@{pbkdf2\_sha1}!sha1.h@{sha1.h}}
\doxysubsubsection{pbkdf2\_sha1()}
{\footnotesize\ttfamily int pbkdf2\+\_\+sha1 (\begin{DoxyParamCaption}\item[{const char $\ast$}]{passphrase,  }\item[{const char $\ast$}]{ssid,  }\item[{size\+\_\+t}]{ssid\+\_\+len,  }\item[{int}]{iterations,  }\item[{\textbf{ u8} $\ast$}]{buf,  }\item[{size\+\_\+t}]{buflen }\end{DoxyParamCaption})}

\mbox{\label{sha1_8h_a0a1d5275823b4b039edc8ea21eea154b}} 
\index{sha1.h@{sha1.h}!sha1\_prf@{sha1\_prf}}
\index{sha1\_prf@{sha1\_prf}!sha1.h@{sha1.h}}
\doxysubsubsection{sha1\_prf()}
{\footnotesize\ttfamily int sha1\+\_\+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})}



sha1\+\_\+prf -\/ SHA1-\/based Pseudo-\/\+Random Function (PRF) (IEEE 802.\+11i, 8.\+5.\+1.\+1) @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 Returns\+: 0 on success, -\/1 of failure 

This function is used to derive new, cryptographically separate keys from a given key (e.\+g., PMK in IEEE 802.\+11i). 

References \textbf{ data}, \textbf{ hmac\+\_\+sha1\+\_\+vector()}, \textbf{ len}, \textbf{ os\+\_\+memcpy}, \textbf{ os\+\_\+strlen}, and \textbf{ SHA1\+\_\+\+MAC\+\_\+\+LEN}.

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

\mbox{\label{sha1_8h_ad4505db890db8e8173845b2878a52b41}} 
\index{sha1.h@{sha1.h}!tls\_prf\_sha1\_md5@{tls\_prf\_sha1\_md5}}
\index{tls\_prf\_sha1\_md5@{tls\_prf\_sha1\_md5}!sha1.h@{sha1.h}}
\doxysubsubsection{tls\_prf\_sha1\_md5()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} tls\+\_\+prf\+\_\+sha1\+\_\+md5 (\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})}

