\doxysection{src/gsm/kdf/crypto.h File Reference}
\label{kdf_2crypto_8h}\index{src/gsm/kdf/crypto.h@{src/gsm/kdf/crypto.h}}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ md5\+\_\+vector\+\_\+non\+\_\+fips\+\_\+allow}~\textbf{ md5\+\_\+vector}
\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ crypto\+\_\+hash\+\_\+alg} \{ \newline
\textbf{ CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+MD5}
, \newline
\textbf{ CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+SHA1}
, \newline
\textbf{ CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+HMAC\+\_\+\+MD5}
, \newline
\textbf{ CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+HMAC\+\_\+\+SHA1}
, \newline
\textbf{ CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+SHA256}
, \newline
\textbf{ CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+HMAC\+\_\+\+SHA256}
 \}
\item 
enum \textbf{ crypto\+\_\+cipher\+\_\+alg} \{ \newline
\textbf{ CRYPTO\+\_\+\+CIPHER\+\_\+\+NULL} = 0
, \newline
\textbf{ CRYPTO\+\_\+\+CIPHER\+\_\+\+ALG\+\_\+\+AES}
, \newline
\textbf{ CRYPTO\+\_\+\+CIPHER\+\_\+\+ALG\+\_\+3\+DES}
, \newline
\textbf{ CRYPTO\+\_\+\+CIPHER\+\_\+\+ALG\+\_\+\+DES}
, \newline
\textbf{ CRYPTO\+\_\+\+CIPHER\+\_\+\+ALG\+\_\+\+RC2}
, \newline
\textbf{ CRYPTO\+\_\+\+CIPHER\+\_\+\+ALG\+\_\+\+RC4}
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ md4\+\_\+vector} (size\+\_\+t num\+\_\+elem, const \textbf{ u8} $\ast$addr[$\,$], const size\+\_\+t $\ast$\textbf{ len}, \textbf{ u8} $\ast$mac)
\begin{DoxyCompactList}\small\item\em md4\+\_\+vector -\/ MD4 hash for data vector @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 Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ md5\+\_\+vector} (size\+\_\+t num\+\_\+elem, const \textbf{ u8} $\ast$addr[$\,$], const size\+\_\+t $\ast$\textbf{ len}, \textbf{ u8} $\ast$mac)
\begin{DoxyCompactList}\small\item\em md5\+\_\+vector -\/ MD5 hash for data vector @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 Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ sha1\+\_\+vector} (size\+\_\+t num\+\_\+elem, const \textbf{ u8} $\ast$addr[$\,$], const size\+\_\+t $\ast$\textbf{ len}, \textbf{ u8} $\ast$mac)
\begin{DoxyCompactList}\small\item\em sha1\+\_\+vector -\/ SHA-\/1 hash for data vector @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 Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ fips186\+\_\+2\+\_\+prf} (const \textbf{ u8} $\ast$seed, size\+\_\+t seed\+\_\+len, \textbf{ u8} $\ast$\textbf{ x}, size\+\_\+t xlen)
\begin{DoxyCompactList}\small\item\em fips186\+\_\+2-\/prf -\/ NIST FIPS Publication 186-\/2 change notice 1 PRF @seed\+: Seed/key for the PRF @seed\+\_\+len\+: Seed length in bytes @x\+: Buffer for PRF output @xlen\+: Output length in bytes Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ sha256\+\_\+vector} (size\+\_\+t num\+\_\+elem, const \textbf{ u8} $\ast$addr[$\,$], const size\+\_\+t $\ast$\textbf{ len}, \textbf{ u8} $\ast$mac)
\begin{DoxyCompactList}\small\item\em sha256\+\_\+vector -\/ SHA256 hash for data vector @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 Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
void \textbf{ des\+\_\+encrypt} (const \textbf{ u8} $\ast$clear, const \textbf{ u8} $\ast$key, \textbf{ u8} $\ast$cypher)
\begin{DoxyCompactList}\small\item\em des\+\_\+encrypt -\/ Encrypt one block with DES @clear\+: 8 octets (in) @key\+: 7 octets (in) (no parity bits included) @cypher\+: 8 octets (out) \end{DoxyCompactList}\item 
void $\ast$ \textbf{ aes\+\_\+encrypt\+\_\+init} (const \textbf{ u8} $\ast$key, size\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em aes\+\_\+encrypt\+\_\+init -\/ Initialize AES for encryption @key\+: Encryption key @len\+: Key length in bytes (usually 16, i.\+e., 128 bits) Returns\+: Pointer to context data or NULL on failure \end{DoxyCompactList}\item 
void \textbf{ aes\+\_\+encrypt} (void $\ast$ctx, const \textbf{ u8} $\ast$plain, \textbf{ u8} $\ast$crypt)
\begin{DoxyCompactList}\small\item\em aes\+\_\+encrypt -\/ Encrypt one AES block @ctx\+: Context pointer from \doxyref{aes\+\_\+encrypt\+\_\+init()}{p.}{kdf_2crypto_8h_a343a371ec5ee6a3785da74796bb25bc4} @plain\+: Plaintext data to be encrypted (16 bytes) @crypt\+: Buffer for the encrypted data (16 bytes) \end{DoxyCompactList}\item 
void \textbf{ aes\+\_\+encrypt\+\_\+deinit} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em aes\+\_\+encrypt\+\_\+deinit -\/ Deinitialize AES encryption @ctx\+: Context pointer from \doxyref{aes\+\_\+encrypt\+\_\+init()}{p.}{kdf_2crypto_8h_a343a371ec5ee6a3785da74796bb25bc4} \end{DoxyCompactList}\item 
void $\ast$ \textbf{ aes\+\_\+decrypt\+\_\+init} (const \textbf{ u8} $\ast$key, size\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em aes\+\_\+decrypt\+\_\+init -\/ Initialize AES for decryption @key\+: Decryption key @len\+: Key length in bytes (usually 16, i.\+e., 128 bits) Returns\+: Pointer to context data or NULL on failure \end{DoxyCompactList}\item 
void \textbf{ aes\+\_\+decrypt} (void $\ast$ctx, const \textbf{ u8} $\ast$crypt, \textbf{ u8} $\ast$plain)
\begin{DoxyCompactList}\small\item\em aes\+\_\+decrypt -\/ Decrypt one AES block @ctx\+: Context pointer from \doxyref{aes\+\_\+encrypt\+\_\+init()}{p.}{kdf_2crypto_8h_a343a371ec5ee6a3785da74796bb25bc4} @crypt\+: Encrypted data (16 bytes) @plain\+: Buffer for the decrypted data (16 bytes) \end{DoxyCompactList}\item 
void \textbf{ aes\+\_\+decrypt\+\_\+deinit} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em aes\+\_\+decrypt\+\_\+deinit -\/ Deinitialize AES decryption @ctx\+: Context pointer from \doxyref{aes\+\_\+encrypt\+\_\+init()}{p.}{kdf_2crypto_8h_a343a371ec5ee6a3785da74796bb25bc4} \end{DoxyCompactList}\item 
struct crypto\+\_\+hash $\ast$ \textbf{ crypto\+\_\+hash\+\_\+init} (enum \textbf{ crypto\+\_\+hash\+\_\+alg} alg, const \textbf{ u8} $\ast$key, size\+\_\+t key\+\_\+len)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+hash\+\_\+init -\/ Initialize hash/\+HMAC function @alg\+: Hash algorithm @key\+: Key for keyed hash (e.\+g., HMAC) or NULL if not needed @key\+\_\+len\+: Length of the key in bytes Returns\+: Pointer to hash context to use with other hash functions or NULL on failure \end{DoxyCompactList}\item 
void \textbf{ crypto\+\_\+hash\+\_\+update} (struct crypto\+\_\+hash $\ast$ctx, const \textbf{ u8} $\ast$\textbf{ data}, size\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em crypto\+\_\+hash\+\_\+update -\/ Add data to hash calculation @ctx\+: Context pointer from \doxyref{crypto\+\_\+hash\+\_\+init()}{p.}{kdf_2crypto_8h_ad0c546241f44759d6239a1dc832f775b} @data\+: Data buffer to add @len\+: Length of the buffer \end{DoxyCompactList}\item 
int \textbf{ crypto\+\_\+hash\+\_\+finish} (struct crypto\+\_\+hash $\ast$ctx, \textbf{ u8} $\ast$hash, size\+\_\+t $\ast$\textbf{ len})
\begin{DoxyCompactList}\small\item\em crypto\+\_\+hash\+\_\+finish -\/ Complete hash calculation @ctx\+: Context pointer from \doxyref{crypto\+\_\+hash\+\_\+init()}{p.}{kdf_2crypto_8h_ad0c546241f44759d6239a1dc832f775b} @hash\+: Buffer for hash value or NULL if caller is just freeing the hash context @len\+: Pointer to length of the buffer or NULL if caller is just freeing the hash context; on return, this is set to the actual length of the hash value Returns\+: 0 on success, -\/1 if buffer is too small (len set to needed length), or -\/2 on other failures (including failed \doxyref{crypto\+\_\+hash\+\_\+update()}{p.}{kdf_2crypto_8h_a17daf15e48ce92e626fd0628f73cfc93} operations) \end{DoxyCompactList}\item 
struct crypto\+\_\+cipher $\ast$ \textbf{ crypto\+\_\+cipher\+\_\+init} (enum \textbf{ crypto\+\_\+cipher\+\_\+alg} alg, const \textbf{ u8} $\ast$iv, const \textbf{ u8} $\ast$key, size\+\_\+t key\+\_\+len)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+cipher\+\_\+init -\/ Initialize block/stream cipher function @alg\+: Cipher algorithm @iv\+: Initialization vector for block ciphers or NULL for stream ciphers @key\+: Cipher key @key\+\_\+len\+: Length of key in bytes Returns\+: Pointer to cipher context to use with other cipher functions or NULL on failure \end{DoxyCompactList}\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ crypto\+\_\+cipher\+\_\+encrypt} (struct crypto\+\_\+cipher $\ast$ctx, const \textbf{ u8} $\ast$plain, \textbf{ u8} $\ast$crypt, size\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em crypto\+\_\+cipher\+\_\+encrypt -\/ Cipher encrypt @ctx\+: Context pointer from \doxyref{crypto\+\_\+cipher\+\_\+init()}{p.}{kdf_2crypto_8h_a817ce769663994348131aaa12c71266a} @plain\+: Plaintext to cipher @crypt\+: Resulting ciphertext @len\+: Length of the plaintext Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ crypto\+\_\+cipher\+\_\+decrypt} (struct crypto\+\_\+cipher $\ast$ctx, const \textbf{ u8} $\ast$crypt, \textbf{ u8} $\ast$plain, size\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em crypto\+\_\+cipher\+\_\+decrypt -\/ Cipher decrypt @ctx\+: Context pointer from \doxyref{crypto\+\_\+cipher\+\_\+init()}{p.}{kdf_2crypto_8h_a817ce769663994348131aaa12c71266a} @crypt\+: Ciphertext to decrypt @plain\+: Resulting plaintext @len\+: Length of the cipher text Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
void \textbf{ crypto\+\_\+cipher\+\_\+deinit} (struct crypto\+\_\+cipher $\ast$ctx)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+cipher\+\_\+decrypt -\/ Free cipher context @ctx\+: Context pointer from \doxyref{crypto\+\_\+cipher\+\_\+init()}{p.}{kdf_2crypto_8h_a817ce769663994348131aaa12c71266a} \end{DoxyCompactList}\item 
struct crypto\+\_\+public\+\_\+key $\ast$ \textbf{ crypto\+\_\+public\+\_\+key\+\_\+import} (const \textbf{ u8} $\ast$key, size\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em crypto\+\_\+public\+\_\+key\+\_\+import -\/ Import an RSA public key @key\+: Key buffer (DER encoded RSA public key) @len\+: Key buffer length in bytes Returns\+: Pointer to the public key or NULL on failure \end{DoxyCompactList}\item 
struct crypto\+\_\+private\+\_\+key $\ast$ \textbf{ crypto\+\_\+private\+\_\+key\+\_\+import} (const \textbf{ u8} $\ast$key, size\+\_\+t \textbf{ len}, const char $\ast$passwd)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+private\+\_\+key\+\_\+import -\/ Import an RSA private key @key\+: Key buffer (DER encoded RSA private key) @len\+: Key buffer length in bytes @passwd\+: Key encryption password or NULL if key is not encrypted Returns\+: Pointer to the private key or NULL on failure \end{DoxyCompactList}\item 
struct crypto\+\_\+public\+\_\+key $\ast$ \textbf{ crypto\+\_\+public\+\_\+key\+\_\+from\+\_\+cert} (const \textbf{ u8} $\ast$buf, size\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em crypto\+\_\+public\+\_\+key\+\_\+from\+\_\+cert -\/ Import an RSA public key from a certificate @buf\+: DER encoded X.\+509 certificate @len\+: Certificate buffer length in bytes Returns\+: Pointer to public key or NULL on failure \end{DoxyCompactList}\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ crypto\+\_\+public\+\_\+key\+\_\+encrypt\+\_\+pkcs1\+\_\+v15} (struct crypto\+\_\+public\+\_\+key $\ast$key, const \textbf{ u8} $\ast$in, size\+\_\+t inlen, \textbf{ u8} $\ast$out, size\+\_\+t $\ast$outlen)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+public\+\_\+key\+\_\+encrypt\+\_\+pkcs1\+\_\+v15 -\/ Public key encryption (PKCS \#1 v1.\+5) @key\+: Public key @in\+: Plaintext buffer @inlen\+: Length of plaintext buffer in bytes @out\+: Output buffer for encrypted data @outlen\+: Length of output buffer in bytes; set to used length on success Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ crypto\+\_\+private\+\_\+key\+\_\+decrypt\+\_\+pkcs1\+\_\+v15} (struct crypto\+\_\+private\+\_\+key $\ast$key, const \textbf{ u8} $\ast$in, size\+\_\+t inlen, \textbf{ u8} $\ast$out, size\+\_\+t $\ast$outlen)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+private\+\_\+key\+\_\+decrypt\+\_\+pkcs1\+\_\+v15 -\/ Private key decryption (PKCS \#1 v1.\+5) @key\+: Private key @in\+: Encrypted buffer @inlen\+: Length of encrypted buffer in bytes @out\+: Output buffer for encrypted data @outlen\+: Length of output buffer in bytes; set to used length on success Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ crypto\+\_\+private\+\_\+key\+\_\+sign\+\_\+pkcs1} (struct crypto\+\_\+private\+\_\+key $\ast$key, const \textbf{ u8} $\ast$in, size\+\_\+t inlen, \textbf{ u8} $\ast$out, size\+\_\+t $\ast$outlen)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+private\+\_\+key\+\_\+sign\+\_\+pkcs1 -\/ Sign with private key (PKCS \#1) @key\+: Private key from \doxyref{crypto\+\_\+private\+\_\+key\+\_\+import()}{p.}{kdf_2crypto_8h_ae6507e8211c81c44b6749fb05b78e8a9} @in\+: Plaintext buffer @inlen\+: Length of plaintext buffer in bytes @out\+: Output buffer for encrypted (signed) data @outlen\+: Length of output buffer in bytes; set to used length on success Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
void \textbf{ crypto\+\_\+public\+\_\+key\+\_\+free} (struct crypto\+\_\+public\+\_\+key $\ast$key)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+public\+\_\+key\+\_\+free -\/ Free public key @key\+: Public key \end{DoxyCompactList}\item 
void \textbf{ crypto\+\_\+private\+\_\+key\+\_\+free} (struct crypto\+\_\+private\+\_\+key $\ast$key)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+private\+\_\+key\+\_\+free -\/ Free private key @key\+: Private key from \doxyref{crypto\+\_\+private\+\_\+key\+\_\+import()}{p.}{kdf_2crypto_8h_ae6507e8211c81c44b6749fb05b78e8a9} \end{DoxyCompactList}\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ crypto\+\_\+public\+\_\+key\+\_\+decrypt\+\_\+pkcs1} (struct crypto\+\_\+public\+\_\+key $\ast$key, const \textbf{ u8} $\ast$crypt, size\+\_\+t crypt\+\_\+len, \textbf{ u8} $\ast$plain, size\+\_\+t $\ast$plain\+\_\+len)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+public\+\_\+key\+\_\+decrypt\+\_\+pkcs1 -\/ Decrypt PKCS \#1 signature @key\+: Public key @crypt\+: Encrypted signature data (using the private key) @crypt\+\_\+len\+: Encrypted signature data length @plain\+: Buffer for plaintext (at least crypt\+\_\+len bytes) @plain\+\_\+len\+: Plaintext length (max buffer size on input, real len on output); Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ crypto\+\_\+global\+\_\+init} (void)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+global\+\_\+init -\/ Initialize crypto wrapper \end{DoxyCompactList}\item 
void \textbf{ crypto\+\_\+global\+\_\+deinit} (void)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+global\+\_\+deinit -\/ Deinitialize crypto wrapper \end{DoxyCompactList}\item 
int \textbf{ \+\_\+\+\_\+must\+\_\+check} \textbf{ crypto\+\_\+mod\+\_\+exp} (const \textbf{ u8} $\ast$base, size\+\_\+t base\+\_\+len, const \textbf{ u8} $\ast$power, size\+\_\+t power\+\_\+len, const \textbf{ u8} $\ast$modulus, size\+\_\+t modulus\+\_\+len, \textbf{ u8} $\ast$result, size\+\_\+t $\ast$result\+\_\+len)
\begin{DoxyCompactList}\small\item\em crypto\+\_\+mod\+\_\+exp -\/ Modular exponentiation of large integers @base\+: Base integer (big endian byte array) @base\+\_\+len\+: Length of base integer in bytes @power\+: Power integer (big endian byte array) @power\+\_\+len\+: Length of power integer in bytes @modulus\+: Modulus integer (big endian byte array) @modulus\+\_\+len\+: Length of modulus integer in bytes \end{DoxyCompactList}\item 
int \textbf{ rc4\+\_\+skip} (const \textbf{ u8} $\ast$key, size\+\_\+t keylen, size\+\_\+t skip, \textbf{ u8} $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len)
\begin{DoxyCompactList}\small\item\em rc4\+\_\+skip -\/ XOR RC4 stream to given data with skip-\/stream-\/start @key\+: RC4 key @keylen\+: RC4 key length  number of bytes to skip from the beginning of the RC4 stream @data\+: data to be XOR\textquotesingle{}ed with RC4 stream @data\+\_\+len\+: buf length Returns\+: 0 on success, -\/1 on failure \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Macro Definition Documentation}
\mbox{\label{kdf_2crypto_8h_a8dbdaced81ee84b42226a8480b0c9c37}} 
\index{crypto.h@{crypto.h}!md5\_vector\_non\_fips\_allow@{md5\_vector\_non\_fips\_allow}}
\index{md5\_vector\_non\_fips\_allow@{md5\_vector\_non\_fips\_allow}!crypto.h@{crypto.h}}
\doxysubsubsection{md5\_vector\_non\_fips\_allow}
{\footnotesize\ttfamily \#define md5\+\_\+vector\+\_\+non\+\_\+fips\+\_\+allow~\textbf{ md5\+\_\+vector}}



\doxysubsection{Enumeration Type Documentation}
\mbox{\label{kdf_2crypto_8h_a68e1c052558ae681878025fa58561266}} 
\index{crypto.h@{crypto.h}!crypto\_cipher\_alg@{crypto\_cipher\_alg}}
\index{crypto\_cipher\_alg@{crypto\_cipher\_alg}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_cipher\_alg}
{\footnotesize\ttfamily enum \textbf{ crypto\+\_\+cipher\+\_\+alg}}

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_CIPHER\_NULL@{CRYPTO\_CIPHER\_NULL}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_CIPHER\_NULL@{CRYPTO\_CIPHER\_NULL}}}\mbox{\label{kdf_2crypto_8h_a68e1c052558ae681878025fa58561266af856b6e1af5becace0ffd22dda299a59}} 
CRYPTO\+\_\+\+CIPHER\+\_\+\+NULL&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_CIPHER\_ALG\_AES@{CRYPTO\_CIPHER\_ALG\_AES}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_CIPHER\_ALG\_AES@{CRYPTO\_CIPHER\_ALG\_AES}}}\mbox{\label{kdf_2crypto_8h_a68e1c052558ae681878025fa58561266a67f457ab7ed609444ebba4de87ce7289}} 
CRYPTO\+\_\+\+CIPHER\+\_\+\+ALG\+\_\+\+AES&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_CIPHER\_ALG\_3DES@{CRYPTO\_CIPHER\_ALG\_3DES}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_CIPHER\_ALG\_3DES@{CRYPTO\_CIPHER\_ALG\_3DES}}}\mbox{\label{kdf_2crypto_8h_a68e1c052558ae681878025fa58561266a788adde74b14e81fecee718b7b26a0f0}} 
CRYPTO\+\_\+\+CIPHER\+\_\+\+ALG\+\_\+3\+DES&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_CIPHER\_ALG\_DES@{CRYPTO\_CIPHER\_ALG\_DES}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_CIPHER\_ALG\_DES@{CRYPTO\_CIPHER\_ALG\_DES}}}\mbox{\label{kdf_2crypto_8h_a68e1c052558ae681878025fa58561266a4d2269fa86d5d76c9753fb9d262d1bd3}} 
CRYPTO\+\_\+\+CIPHER\+\_\+\+ALG\+\_\+\+DES&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_CIPHER\_ALG\_RC2@{CRYPTO\_CIPHER\_ALG\_RC2}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_CIPHER\_ALG\_RC2@{CRYPTO\_CIPHER\_ALG\_RC2}}}\mbox{\label{kdf_2crypto_8h_a68e1c052558ae681878025fa58561266a08e96af5504bc8369c4c7c0fd5c266cf}} 
CRYPTO\+\_\+\+CIPHER\+\_\+\+ALG\+\_\+\+RC2&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_CIPHER\_ALG\_RC4@{CRYPTO\_CIPHER\_ALG\_RC4}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_CIPHER\_ALG\_RC4@{CRYPTO\_CIPHER\_ALG\_RC4}}}\mbox{\label{kdf_2crypto_8h_a68e1c052558ae681878025fa58561266a831b7851b7efb03b6512b6cd07671b17}} 
CRYPTO\+\_\+\+CIPHER\+\_\+\+ALG\+\_\+\+RC4&\\
\hline

\end{DoxyEnumFields}
\mbox{\label{kdf_2crypto_8h_a40270b791c8e896b4ae12238dab61025}} 
\index{crypto.h@{crypto.h}!crypto\_hash\_alg@{crypto\_hash\_alg}}
\index{crypto\_hash\_alg@{crypto\_hash\_alg}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_hash\_alg}
{\footnotesize\ttfamily enum \textbf{ crypto\+\_\+hash\+\_\+alg}}

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_HASH\_ALG\_MD5@{CRYPTO\_HASH\_ALG\_MD5}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_HASH\_ALG\_MD5@{CRYPTO\_HASH\_ALG\_MD5}}}\mbox{\label{kdf_2crypto_8h_a40270b791c8e896b4ae12238dab61025add217000e96afa8e0a195882758a2499}} 
CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+MD5&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_HASH\_ALG\_SHA1@{CRYPTO\_HASH\_ALG\_SHA1}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_HASH\_ALG\_SHA1@{CRYPTO\_HASH\_ALG\_SHA1}}}\mbox{\label{kdf_2crypto_8h_a40270b791c8e896b4ae12238dab61025a2aacf4ca61a13d8f3778f0ecbb89f153}} 
CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+SHA1&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_HASH\_ALG\_HMAC\_MD5@{CRYPTO\_HASH\_ALG\_HMAC\_MD5}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_HASH\_ALG\_HMAC\_MD5@{CRYPTO\_HASH\_ALG\_HMAC\_MD5}}}\mbox{\label{kdf_2crypto_8h_a40270b791c8e896b4ae12238dab61025a78710d24d5b466039416e40a6149f785}} 
CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+HMAC\+\_\+\+MD5&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_HASH\_ALG\_HMAC\_SHA1@{CRYPTO\_HASH\_ALG\_HMAC\_SHA1}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_HASH\_ALG\_HMAC\_SHA1@{CRYPTO\_HASH\_ALG\_HMAC\_SHA1}}}\mbox{\label{kdf_2crypto_8h_a40270b791c8e896b4ae12238dab61025af0acd8baff62be695d9aae4180a435e3}} 
CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+HMAC\+\_\+\+SHA1&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_HASH\_ALG\_SHA256@{CRYPTO\_HASH\_ALG\_SHA256}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_HASH\_ALG\_SHA256@{CRYPTO\_HASH\_ALG\_SHA256}}}\mbox{\label{kdf_2crypto_8h_a40270b791c8e896b4ae12238dab61025a4ed7eedd05936742f7524671ba3899b8}} 
CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+SHA256&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{CRYPTO\_HASH\_ALG\_HMAC\_SHA256@{CRYPTO\_HASH\_ALG\_HMAC\_SHA256}!crypto.h@{crypto.h}}\index{crypto.h@{crypto.h}!CRYPTO\_HASH\_ALG\_HMAC\_SHA256@{CRYPTO\_HASH\_ALG\_HMAC\_SHA256}}}\mbox{\label{kdf_2crypto_8h_a40270b791c8e896b4ae12238dab61025a0efd4cd706425cce87b1efaede54efbe}} 
CRYPTO\+\_\+\+HASH\+\_\+\+ALG\+\_\+\+HMAC\+\_\+\+SHA256&\\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\mbox{\label{kdf_2crypto_8h_adb9aa3132c2799cd2623de4daf9ef714}} 
\index{crypto.h@{crypto.h}!aes\_decrypt@{aes\_decrypt}}
\index{aes\_decrypt@{aes\_decrypt}!crypto.h@{crypto.h}}
\doxysubsubsection{aes\_decrypt()}
{\footnotesize\ttfamily void aes\+\_\+decrypt (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{const \textbf{ u8} $\ast$}]{crypt,  }\item[{\textbf{ u8} $\ast$}]{plain }\end{DoxyParamCaption})}



aes\+\_\+decrypt -\/ Decrypt one AES block @ctx\+: Context pointer from \doxyref{aes\+\_\+encrypt\+\_\+init()}{p.}{kdf_2crypto_8h_a343a371ec5ee6a3785da74796bb25bc4} @crypt\+: Encrypted data (16 bytes) @plain\+: Buffer for the decrypted data (16 bytes) 

\mbox{\label{kdf_2crypto_8h_ac52e91f8bc091ad5e45cbb557a8abfb9}} 
\index{crypto.h@{crypto.h}!aes\_decrypt\_deinit@{aes\_decrypt\_deinit}}
\index{aes\_decrypt\_deinit@{aes\_decrypt\_deinit}!crypto.h@{crypto.h}}
\doxysubsubsection{aes\_decrypt\_deinit()}
{\footnotesize\ttfamily void aes\+\_\+decrypt\+\_\+deinit (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



aes\+\_\+decrypt\+\_\+deinit -\/ Deinitialize AES decryption @ctx\+: Context pointer from \doxyref{aes\+\_\+encrypt\+\_\+init()}{p.}{kdf_2crypto_8h_a343a371ec5ee6a3785da74796bb25bc4} 

\mbox{\label{kdf_2crypto_8h_aeffbce75537e7a819960ad21a7e32961}} 
\index{crypto.h@{crypto.h}!aes\_decrypt\_init@{aes\_decrypt\_init}}
\index{aes\_decrypt\_init@{aes\_decrypt\_init}!crypto.h@{crypto.h}}
\doxysubsubsection{aes\_decrypt\_init()}
{\footnotesize\ttfamily void $\ast$ aes\+\_\+decrypt\+\_\+init (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



aes\+\_\+decrypt\+\_\+init -\/ Initialize AES for decryption @key\+: Decryption key @len\+: Key length in bytes (usually 16, i.\+e., 128 bits) Returns\+: Pointer to context data or NULL on failure 

\mbox{\label{kdf_2crypto_8h_ab5d5144d5ff65df3a2141b61aa8cbbc5}} 
\index{crypto.h@{crypto.h}!aes\_encrypt@{aes\_encrypt}}
\index{aes\_encrypt@{aes\_encrypt}!crypto.h@{crypto.h}}
\doxysubsubsection{aes\_encrypt()}
{\footnotesize\ttfamily void aes\+\_\+encrypt (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{const \textbf{ u8} $\ast$}]{plain,  }\item[{\textbf{ u8} $\ast$}]{crypt }\end{DoxyParamCaption})}



aes\+\_\+encrypt -\/ Encrypt one AES block @ctx\+: Context pointer from \doxyref{aes\+\_\+encrypt\+\_\+init()}{p.}{kdf_2crypto_8h_a343a371ec5ee6a3785da74796bb25bc4} @plain\+: Plaintext data to be encrypted (16 bytes) @crypt\+: Buffer for the encrypted data (16 bytes) 



References \textbf{ rijndael\+Encrypt()}.



Referenced by \textbf{ aes\+\_\+128\+\_\+encrypt\+\_\+block()}.

\mbox{\label{kdf_2crypto_8h_a3de4d709c14b6f0801604d37fde3306a}} 
\index{crypto.h@{crypto.h}!aes\_encrypt\_deinit@{aes\_encrypt\_deinit}}
\index{aes\_encrypt\_deinit@{aes\_encrypt\_deinit}!crypto.h@{crypto.h}}
\doxysubsubsection{aes\_encrypt\_deinit()}
{\footnotesize\ttfamily void aes\+\_\+encrypt\+\_\+deinit (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



aes\+\_\+encrypt\+\_\+deinit -\/ Deinitialize AES encryption @ctx\+: Context pointer from \doxyref{aes\+\_\+encrypt\+\_\+init()}{p.}{kdf_2crypto_8h_a343a371ec5ee6a3785da74796bb25bc4} 



References \textbf{ AES\+\_\+\+PRIV\+\_\+\+SIZE}, \textbf{ os\+\_\+free}, and \textbf{ os\+\_\+memset}.



Referenced by \textbf{ aes\+\_\+128\+\_\+encrypt\+\_\+block()}.

\mbox{\label{kdf_2crypto_8h_a343a371ec5ee6a3785da74796bb25bc4}} 
\index{crypto.h@{crypto.h}!aes\_encrypt\_init@{aes\_encrypt\_init}}
\index{aes\_encrypt\_init@{aes\_encrypt\_init}!crypto.h@{crypto.h}}
\doxysubsubsection{aes\_encrypt\_init()}
{\footnotesize\ttfamily void $\ast$ aes\+\_\+encrypt\+\_\+init (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



aes\+\_\+encrypt\+\_\+init -\/ Initialize AES for encryption @key\+: Encryption key @len\+: Key length in bytes (usually 16, i.\+e., 128 bits) Returns\+: Pointer to context data or NULL on failure 



References \textbf{ AES\+\_\+\+PRIV\+\_\+\+SIZE}, \textbf{ len}, \textbf{ os\+\_\+malloc}, and \textbf{ rijndael\+Key\+Setup\+Enc()}.



Referenced by \textbf{ aes\+\_\+128\+\_\+encrypt\+\_\+block()}.

\mbox{\label{kdf_2crypto_8h_aa4ae2a795d1032da3d00936d1781bf4c}} 
\index{crypto.h@{crypto.h}!crypto\_cipher\_decrypt@{crypto\_cipher\_decrypt}}
\index{crypto\_cipher\_decrypt@{crypto\_cipher\_decrypt}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_cipher\_decrypt()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} crypto\+\_\+cipher\+\_\+decrypt (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+cipher $\ast$}]{ctx,  }\item[{const \textbf{ u8} $\ast$}]{crypt,  }\item[{\textbf{ u8} $\ast$}]{plain,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



crypto\+\_\+cipher\+\_\+decrypt -\/ Cipher decrypt @ctx\+: Context pointer from \doxyref{crypto\+\_\+cipher\+\_\+init()}{p.}{kdf_2crypto_8h_a817ce769663994348131aaa12c71266a} @crypt\+: Ciphertext to decrypt @plain\+: Resulting plaintext @len\+: Length of the cipher text Returns\+: 0 on success, -\/1 on failure 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_a265953606c0f9a7ef5f8ba021899da74}} 
\index{crypto.h@{crypto.h}!crypto\_cipher\_deinit@{crypto\_cipher\_deinit}}
\index{crypto\_cipher\_deinit@{crypto\_cipher\_deinit}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_cipher\_deinit()}
{\footnotesize\ttfamily void crypto\+\_\+cipher\+\_\+deinit (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+cipher $\ast$}]{ctx }\end{DoxyParamCaption})}



crypto\+\_\+cipher\+\_\+decrypt -\/ Free cipher context @ctx\+: Context pointer from \doxyref{crypto\+\_\+cipher\+\_\+init()}{p.}{kdf_2crypto_8h_a817ce769663994348131aaa12c71266a} 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_aed0c919332f652daa9359c367382eafa}} 
\index{crypto.h@{crypto.h}!crypto\_cipher\_encrypt@{crypto\_cipher\_encrypt}}
\index{crypto\_cipher\_encrypt@{crypto\_cipher\_encrypt}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_cipher\_encrypt()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} crypto\+\_\+cipher\+\_\+encrypt (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+cipher $\ast$}]{ctx,  }\item[{const \textbf{ u8} $\ast$}]{plain,  }\item[{\textbf{ u8} $\ast$}]{crypt,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



crypto\+\_\+cipher\+\_\+encrypt -\/ Cipher encrypt @ctx\+: Context pointer from \doxyref{crypto\+\_\+cipher\+\_\+init()}{p.}{kdf_2crypto_8h_a817ce769663994348131aaa12c71266a} @plain\+: Plaintext to cipher @crypt\+: Resulting ciphertext @len\+: Length of the plaintext Returns\+: 0 on success, -\/1 on failure 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_a817ce769663994348131aaa12c71266a}} 
\index{crypto.h@{crypto.h}!crypto\_cipher\_init@{crypto\_cipher\_init}}
\index{crypto\_cipher\_init@{crypto\_cipher\_init}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_cipher\_init()}
{\footnotesize\ttfamily struct crypto\+\_\+cipher $\ast$ crypto\+\_\+cipher\+\_\+init (\begin{DoxyParamCaption}\item[{enum \textbf{ crypto\+\_\+cipher\+\_\+alg}}]{alg,  }\item[{const \textbf{ u8} $\ast$}]{iv,  }\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{key\+\_\+len }\end{DoxyParamCaption})}



crypto\+\_\+cipher\+\_\+init -\/ Initialize block/stream cipher function @alg\+: Cipher algorithm @iv\+: Initialization vector for block ciphers or NULL for stream ciphers @key\+: Cipher key @key\+\_\+len\+: Length of key in bytes Returns\+: Pointer to cipher context to use with other cipher functions or NULL on failure 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_a0def3d4be2c3c478c452cd443a583fec}} 
\index{crypto.h@{crypto.h}!crypto\_global\_deinit@{crypto\_global\_deinit}}
\index{crypto\_global\_deinit@{crypto\_global\_deinit}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_global\_deinit()}
{\footnotesize\ttfamily void crypto\+\_\+global\+\_\+deinit (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



crypto\+\_\+global\+\_\+deinit -\/ Deinitialize crypto wrapper 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_a6657fdc80f5eb4261123c6c6e1bdaa49}} 
\index{crypto.h@{crypto.h}!crypto\_global\_init@{crypto\_global\_init}}
\index{crypto\_global\_init@{crypto\_global\_init}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_global\_init()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} crypto\+\_\+global\+\_\+init (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



crypto\+\_\+global\+\_\+init -\/ Initialize crypto wrapper 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_a007b3e1daaacbde45b4c4561885187dd}} 
\index{crypto.h@{crypto.h}!crypto\_hash\_finish@{crypto\_hash\_finish}}
\index{crypto\_hash\_finish@{crypto\_hash\_finish}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_hash\_finish()}
{\footnotesize\ttfamily int crypto\+\_\+hash\+\_\+finish (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+hash $\ast$}]{ctx,  }\item[{\textbf{ u8} $\ast$}]{hash,  }\item[{size\+\_\+t $\ast$}]{len }\end{DoxyParamCaption})}



crypto\+\_\+hash\+\_\+finish -\/ Complete hash calculation @ctx\+: Context pointer from \doxyref{crypto\+\_\+hash\+\_\+init()}{p.}{kdf_2crypto_8h_ad0c546241f44759d6239a1dc832f775b} @hash\+: Buffer for hash value or NULL if caller is just freeing the hash context @len\+: Pointer to length of the buffer or NULL if caller is just freeing the hash context; on return, this is set to the actual length of the hash value Returns\+: 0 on success, -\/1 if buffer is too small (len set to needed length), or -\/2 on other failures (including failed \doxyref{crypto\+\_\+hash\+\_\+update()}{p.}{kdf_2crypto_8h_a17daf15e48ce92e626fd0628f73cfc93} operations) 

This function calculates the hash value and frees the context buffer that was used for hash calculation.

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_ad0c546241f44759d6239a1dc832f775b}} 
\index{crypto.h@{crypto.h}!crypto\_hash\_init@{crypto\_hash\_init}}
\index{crypto\_hash\_init@{crypto\_hash\_init}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_hash\_init()}
{\footnotesize\ttfamily struct crypto\+\_\+hash $\ast$ crypto\+\_\+hash\+\_\+init (\begin{DoxyParamCaption}\item[{enum \textbf{ crypto\+\_\+hash\+\_\+alg}}]{alg,  }\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{key\+\_\+len }\end{DoxyParamCaption})}



crypto\+\_\+hash\+\_\+init -\/ Initialize hash/\+HMAC function @alg\+: Hash algorithm @key\+: Key for keyed hash (e.\+g., HMAC) or NULL if not needed @key\+\_\+len\+: Length of the key in bytes Returns\+: Pointer to hash context to use with other hash functions or NULL on failure 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_a17daf15e48ce92e626fd0628f73cfc93}} 
\index{crypto.h@{crypto.h}!crypto\_hash\_update@{crypto\_hash\_update}}
\index{crypto\_hash\_update@{crypto\_hash\_update}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_hash\_update()}
{\footnotesize\ttfamily void crypto\+\_\+hash\+\_\+update (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+hash $\ast$}]{ctx,  }\item[{const \textbf{ u8} $\ast$}]{data,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



crypto\+\_\+hash\+\_\+update -\/ Add data to hash calculation @ctx\+: Context pointer from \doxyref{crypto\+\_\+hash\+\_\+init()}{p.}{kdf_2crypto_8h_ad0c546241f44759d6239a1dc832f775b} @data\+: Data buffer to add @len\+: Length of the buffer 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_a0accc98bc503b396b336269ef271bc33}} 
\index{crypto.h@{crypto.h}!crypto\_mod\_exp@{crypto\_mod\_exp}}
\index{crypto\_mod\_exp@{crypto\_mod\_exp}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_mod\_exp()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} crypto\+\_\+mod\+\_\+exp (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{base,  }\item[{size\+\_\+t}]{base\+\_\+len,  }\item[{const \textbf{ u8} $\ast$}]{power,  }\item[{size\+\_\+t}]{power\+\_\+len,  }\item[{const \textbf{ u8} $\ast$}]{modulus,  }\item[{size\+\_\+t}]{modulus\+\_\+len,  }\item[{\textbf{ u8} $\ast$}]{result,  }\item[{size\+\_\+t $\ast$}]{result\+\_\+len }\end{DoxyParamCaption})}



crypto\+\_\+mod\+\_\+exp -\/ Modular exponentiation of large integers @base\+: Base integer (big endian byte array) @base\+\_\+len\+: Length of base integer in bytes @power\+: Power integer (big endian byte array) @power\+\_\+len\+: Length of power integer in bytes @modulus\+: Modulus integer (big endian byte array) @modulus\+\_\+len\+: Length of modulus integer in bytes 

\begin{DoxyReturn}{Returns}
\+: Buffer for the result @result\+\_\+len\+: Result length (max buffer size on input, real len on output) Returns\+: 0 on success, -\/1 on failure
\end{DoxyReturn}
This function calculates result = base $^\wedge$ power mod modulus. modules\+\_\+len is used as the maximum size of modulus buffer. It is set to the used size on success.

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_a2a00fa9f2fef40e5ee1ccc20b3678756}} 
\index{crypto.h@{crypto.h}!crypto\_private\_key\_decrypt\_pkcs1\_v15@{crypto\_private\_key\_decrypt\_pkcs1\_v15}}
\index{crypto\_private\_key\_decrypt\_pkcs1\_v15@{crypto\_private\_key\_decrypt\_pkcs1\_v15}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_private\_key\_decrypt\_pkcs1\_v15()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} crypto\+\_\+private\+\_\+key\+\_\+decrypt\+\_\+pkcs1\+\_\+v15 (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+private\+\_\+key $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{in,  }\item[{size\+\_\+t}]{inlen,  }\item[{\textbf{ u8} $\ast$}]{out,  }\item[{size\+\_\+t $\ast$}]{outlen }\end{DoxyParamCaption})}



crypto\+\_\+private\+\_\+key\+\_\+decrypt\+\_\+pkcs1\+\_\+v15 -\/ Private key decryption (PKCS \#1 v1.\+5) @key\+: Private key @in\+: Encrypted buffer @inlen\+: Length of encrypted buffer in bytes @out\+: Output buffer for encrypted data @outlen\+: Length of output buffer in bytes; set to used length on success Returns\+: 0 on success, -\/1 on failure 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_abf1c3823b8be6717bd7845fa3682f856}} 
\index{crypto.h@{crypto.h}!crypto\_private\_key\_free@{crypto\_private\_key\_free}}
\index{crypto\_private\_key\_free@{crypto\_private\_key\_free}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_private\_key\_free()}
{\footnotesize\ttfamily void crypto\+\_\+private\+\_\+key\+\_\+free (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+private\+\_\+key $\ast$}]{key }\end{DoxyParamCaption})}



crypto\+\_\+private\+\_\+key\+\_\+free -\/ Free private key @key\+: Private key from \doxyref{crypto\+\_\+private\+\_\+key\+\_\+import()}{p.}{kdf_2crypto_8h_ae6507e8211c81c44b6749fb05b78e8a9} 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_ae6507e8211c81c44b6749fb05b78e8a9}} 
\index{crypto.h@{crypto.h}!crypto\_private\_key\_import@{crypto\_private\_key\_import}}
\index{crypto\_private\_key\_import@{crypto\_private\_key\_import}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_private\_key\_import()}
{\footnotesize\ttfamily struct crypto\+\_\+private\+\_\+key $\ast$ crypto\+\_\+private\+\_\+key\+\_\+import (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{len,  }\item[{const char $\ast$}]{passwd }\end{DoxyParamCaption})}



crypto\+\_\+private\+\_\+key\+\_\+import -\/ Import an RSA private key @key\+: Key buffer (DER encoded RSA private key) @len\+: Key buffer length in bytes @passwd\+: Key encryption password or NULL if key is not encrypted Returns\+: Pointer to the private key or NULL on failure 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_ab06579fea15a9b9a2a2fae5f624497f1}} 
\index{crypto.h@{crypto.h}!crypto\_private\_key\_sign\_pkcs1@{crypto\_private\_key\_sign\_pkcs1}}
\index{crypto\_private\_key\_sign\_pkcs1@{crypto\_private\_key\_sign\_pkcs1}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_private\_key\_sign\_pkcs1()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} crypto\+\_\+private\+\_\+key\+\_\+sign\+\_\+pkcs1 (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+private\+\_\+key $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{in,  }\item[{size\+\_\+t}]{inlen,  }\item[{\textbf{ u8} $\ast$}]{out,  }\item[{size\+\_\+t $\ast$}]{outlen }\end{DoxyParamCaption})}



crypto\+\_\+private\+\_\+key\+\_\+sign\+\_\+pkcs1 -\/ Sign with private key (PKCS \#1) @key\+: Private key from \doxyref{crypto\+\_\+private\+\_\+key\+\_\+import()}{p.}{kdf_2crypto_8h_ae6507e8211c81c44b6749fb05b78e8a9} @in\+: Plaintext buffer @inlen\+: Length of plaintext buffer in bytes @out\+: Output buffer for encrypted (signed) data @outlen\+: Length of output buffer in bytes; set to used length on success Returns\+: 0 on success, -\/1 on failure 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_ac288f7eedb065f76eb1869404268c80f}} 
\index{crypto.h@{crypto.h}!crypto\_public\_key\_decrypt\_pkcs1@{crypto\_public\_key\_decrypt\_pkcs1}}
\index{crypto\_public\_key\_decrypt\_pkcs1@{crypto\_public\_key\_decrypt\_pkcs1}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_public\_key\_decrypt\_pkcs1()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} crypto\+\_\+public\+\_\+key\+\_\+decrypt\+\_\+pkcs1 (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+public\+\_\+key $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{crypt,  }\item[{size\+\_\+t}]{crypt\+\_\+len,  }\item[{\textbf{ u8} $\ast$}]{plain,  }\item[{size\+\_\+t $\ast$}]{plain\+\_\+len }\end{DoxyParamCaption})}



crypto\+\_\+public\+\_\+key\+\_\+decrypt\+\_\+pkcs1 -\/ Decrypt PKCS \#1 signature @key\+: Public key @crypt\+: Encrypted signature data (using the private key) @crypt\+\_\+len\+: Encrypted signature data length @plain\+: Buffer for plaintext (at least crypt\+\_\+len bytes) @plain\+\_\+len\+: Plaintext length (max buffer size on input, real len on output); Returns\+: 0 on success, -\/1 on failure 

\mbox{\label{kdf_2crypto_8h_acbc3af32147f7a7d37827f0939c11a50}} 
\index{crypto.h@{crypto.h}!crypto\_public\_key\_encrypt\_pkcs1\_v15@{crypto\_public\_key\_encrypt\_pkcs1\_v15}}
\index{crypto\_public\_key\_encrypt\_pkcs1\_v15@{crypto\_public\_key\_encrypt\_pkcs1\_v15}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_public\_key\_encrypt\_pkcs1\_v15()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} crypto\+\_\+public\+\_\+key\+\_\+encrypt\+\_\+pkcs1\+\_\+v15 (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+public\+\_\+key $\ast$}]{key,  }\item[{const \textbf{ u8} $\ast$}]{in,  }\item[{size\+\_\+t}]{inlen,  }\item[{\textbf{ u8} $\ast$}]{out,  }\item[{size\+\_\+t $\ast$}]{outlen }\end{DoxyParamCaption})}



crypto\+\_\+public\+\_\+key\+\_\+encrypt\+\_\+pkcs1\+\_\+v15 -\/ Public key encryption (PKCS \#1 v1.\+5) @key\+: Public key @in\+: Plaintext buffer @inlen\+: Length of plaintext buffer in bytes @out\+: Output buffer for encrypted data @outlen\+: Length of output buffer in bytes; set to used length on success Returns\+: 0 on success, -\/1 on failure 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_aa36dd8c84608da5e0716d02a3edfd1e8}} 
\index{crypto.h@{crypto.h}!crypto\_public\_key\_free@{crypto\_public\_key\_free}}
\index{crypto\_public\_key\_free@{crypto\_public\_key\_free}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_public\_key\_free()}
{\footnotesize\ttfamily void crypto\+\_\+public\+\_\+key\+\_\+free (\begin{DoxyParamCaption}\item[{struct crypto\+\_\+public\+\_\+key $\ast$}]{key }\end{DoxyParamCaption})}



crypto\+\_\+public\+\_\+key\+\_\+free -\/ Free public key @key\+: Public key 

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_a8492a6817d48e8f8ce8f1ef34674a73a}} 
\index{crypto.h@{crypto.h}!crypto\_public\_key\_from\_cert@{crypto\_public\_key\_from\_cert}}
\index{crypto\_public\_key\_from\_cert@{crypto\_public\_key\_from\_cert}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_public\_key\_from\_cert()}
{\footnotesize\ttfamily struct crypto\+\_\+public\+\_\+key $\ast$ crypto\+\_\+public\+\_\+key\+\_\+from\+\_\+cert (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{buf,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



crypto\+\_\+public\+\_\+key\+\_\+from\+\_\+cert -\/ Import an RSA public key from a certificate @buf\+: DER encoded X.\+509 certificate @len\+: Certificate buffer length in bytes Returns\+: Pointer to public key or NULL on failure 

This function can just return NULL if the crypto library does not support X.\+509 parsing. In that case, internal code will be used to parse the certificate and public key is imported using \doxyref{crypto\+\_\+public\+\_\+key\+\_\+import()}{p.}{kdf_2crypto_8h_acd10c1960be00119eab878d7b7f064ff}.

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_acd10c1960be00119eab878d7b7f064ff}} 
\index{crypto.h@{crypto.h}!crypto\_public\_key\_import@{crypto\_public\_key\_import}}
\index{crypto\_public\_key\_import@{crypto\_public\_key\_import}!crypto.h@{crypto.h}}
\doxysubsubsection{crypto\_public\_key\_import()}
{\footnotesize\ttfamily struct crypto\+\_\+public\+\_\+key $\ast$ crypto\+\_\+public\+\_\+key\+\_\+import (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



crypto\+\_\+public\+\_\+key\+\_\+import -\/ Import an RSA public key @key\+: Key buffer (DER encoded RSA public key) @len\+: Key buffer length in bytes Returns\+: Pointer to the public key or NULL on failure 

This function can just return NULL if the crypto library supports X.\+509 parsing. In that case, \doxyref{crypto\+\_\+public\+\_\+key\+\_\+from\+\_\+cert()}{p.}{kdf_2crypto_8h_a8492a6817d48e8f8ce8f1ef34674a73a} is used to import the public key from a certificate.

This function is only used with internal TLSv1 implementation (CONFIG\+\_\+\+TLS=internal). If that is not used, the crypto wrapper does not need to implement this. \mbox{\label{kdf_2crypto_8h_aaa8b310f0847b7d324e3728f588a8e88}} 
\index{crypto.h@{crypto.h}!des\_encrypt@{des\_encrypt}}
\index{des\_encrypt@{des\_encrypt}!crypto.h@{crypto.h}}
\doxysubsubsection{des\_encrypt()}
{\footnotesize\ttfamily void des\+\_\+encrypt (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{clear,  }\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{\textbf{ u8} $\ast$}]{cypher }\end{DoxyParamCaption})}



des\+\_\+encrypt -\/ Encrypt one block with DES @clear\+: 8 octets (in) @key\+: 7 octets (in) (no parity bits included) @cypher\+: 8 octets (out) 

\mbox{\label{kdf_2crypto_8h_ad4166afcdd28fd84a80ecd4b7afbce9f}} 
\index{crypto.h@{crypto.h}!fips186\_2\_prf@{fips186\_2\_prf}}
\index{fips186\_2\_prf@{fips186\_2\_prf}!crypto.h@{crypto.h}}
\doxysubsubsection{fips186\_2\_prf()}
{\footnotesize\ttfamily int \textbf{ \+\_\+\+\_\+must\+\_\+check} fips186\+\_\+2\+\_\+prf (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{seed,  }\item[{size\+\_\+t}]{seed\+\_\+len,  }\item[{\textbf{ u8} $\ast$}]{x,  }\item[{size\+\_\+t}]{xlen }\end{DoxyParamCaption})}



fips186\+\_\+2-\/prf -\/ NIST FIPS Publication 186-\/2 change notice 1 PRF @seed\+: Seed/key for the PRF @seed\+\_\+len\+: Seed length in bytes @x\+: Buffer for PRF output @xlen\+: Output length in bytes Returns\+: 0 on success, -\/1 on failure 

This function implements random number generation specified in NIST FIPS Publication 186-\/2 for EAP-\/\+SIM. This PRF uses a function that is similar to SHA-\/1, but has different message padding. \mbox{\label{kdf_2crypto_8h_a2e5821f20a20ae1bbb2194e5578061de}} 
\index{crypto.h@{crypto.h}!md4\_vector@{md4\_vector}}
\index{md4\_vector@{md4\_vector}!crypto.h@{crypto.h}}
\doxysubsubsection{md4\_vector()}
{\footnotesize\ttfamily int md4\+\_\+vector (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{num\+\_\+elem,  }\item[{const \textbf{ u8} $\ast$}]{addr[$\,$],  }\item[{const size\+\_\+t $\ast$}]{len,  }\item[{\textbf{ u8} $\ast$}]{mac }\end{DoxyParamCaption})}



md4\+\_\+vector -\/ MD4 hash for data vector @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 Returns\+: 0 on success, -\/1 on failure 

\mbox{\label{kdf_2crypto_8h_a442ccf66ca84dfc1877f0ce5c82067ce}} 
\index{crypto.h@{crypto.h}!md5\_vector@{md5\_vector}}
\index{md5\_vector@{md5\_vector}!crypto.h@{crypto.h}}
\doxysubsubsection{md5\_vector()}
{\footnotesize\ttfamily int md5\+\_\+vector (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{num\+\_\+elem,  }\item[{const \textbf{ u8} $\ast$}]{addr[$\,$],  }\item[{const size\+\_\+t $\ast$}]{len,  }\item[{\textbf{ u8} $\ast$}]{mac }\end{DoxyParamCaption})}



md5\+\_\+vector -\/ MD5 hash for data vector @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 Returns\+: 0 on success, -\/1 on failure 

\mbox{\label{kdf_2crypto_8h_a6d713a9c7a3771e525230566fd438bf2}} 
\index{crypto.h@{crypto.h}!rc4\_skip@{rc4\_skip}}
\index{rc4\_skip@{rc4\_skip}!crypto.h@{crypto.h}}
\doxysubsubsection{rc4\_skip()}
{\footnotesize\ttfamily int rc4\+\_\+skip (\begin{DoxyParamCaption}\item[{const \textbf{ u8} $\ast$}]{key,  }\item[{size\+\_\+t}]{keylen,  }\item[{size\+\_\+t}]{skip,  }\item[{\textbf{ u8} $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len }\end{DoxyParamCaption})}



rc4\+\_\+skip -\/ XOR RC4 stream to given data with skip-\/stream-\/start @key\+: RC4 key @keylen\+: RC4 key length  number of bytes to skip from the beginning of the RC4 stream @data\+: data to be XOR\textquotesingle{}ed with RC4 stream @data\+\_\+len\+: buf length Returns\+: 0 on success, -\/1 on failure 

Generate RC4 pseudo random stream for the given key, skip beginning of the stream, and XOR the end result with the data buffer to perform RC4 encryption/decryption. \mbox{\label{kdf_2crypto_8h_ac06a574002700fe245e6f543e79daccd}} 
\index{crypto.h@{crypto.h}!sha1\_vector@{sha1\_vector}}
\index{sha1\_vector@{sha1\_vector}!crypto.h@{crypto.h}}
\doxysubsubsection{sha1\_vector()}
{\footnotesize\ttfamily int sha1\+\_\+vector (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{num\+\_\+elem,  }\item[{const \textbf{ u8} $\ast$}]{addr[$\,$],  }\item[{const size\+\_\+t $\ast$}]{len,  }\item[{\textbf{ u8} $\ast$}]{mac }\end{DoxyParamCaption})}



sha1\+\_\+vector -\/ SHA-\/1 hash for data vector @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 Returns\+: 0 on success, -\/1 on failure 

sha1\+\_\+vector -\/ SHA-\/1 hash for data vector @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 Returns\+: 0 on success, -\/1 on failure 

References \textbf{ len}, \textbf{ SHA1\+Final()}, \textbf{ SHA1\+Init()}, and \textbf{ SHA1\+Update()}.



Referenced by \textbf{ hmac\+\_\+sha1\+\_\+vector()}.

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



sha256\+\_\+vector -\/ SHA256 hash for data vector @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 Returns\+: 0 on success, -\/1 on failure 

sha256\+\_\+vector -\/ SHA256 hash for data vector @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 Returns\+: 0 on success, -\/1 on failure 

References \textbf{ len}, \textbf{ sha256\+\_\+done()}, \textbf{ sha256\+\_\+init()}, and \textbf{ sha256\+\_\+process()}.



Referenced by \textbf{ hmac\+\_\+sha256\+\_\+vector()}.

