Ordo
0.3.4
Symmetric Cryptography Library
|
Module. More...
Go to the source code of this file.
Functions | |
ORDO_PUBLIC int | kdf_hkdf (prim_t hash, const void *params, const void *key, size_t key_len, const void *salt, size_t salt_len, const void *info, size_t info_len, void *out, size_t out_len) |
Module.
Module for the HMAC-based Extract-and-Expand Key Derivation Function. HKDF is a key stretching function which takes in a cryptographically secure key (not a password) and an optional salt, and generates a longer keystream deterministically.
Just like PBKDF2, HKDF does not require the use of contexts.
ORDO_PUBLIC int kdf_hkdf | ( | prim_t | hash, |
const void * | params, | ||
const void * | key, | ||
size_t | key_len, | ||
const void * | salt, | ||
size_t | salt_len, | ||
const void * | info, | ||
size_t | info_len, | ||
void * | out, | ||
size_t | out_len | ||
) |
Derives a key using HKDF.
[in] | hash | The hash function to use (the PRF used will be an instantiation of HMAC with it). |
[in] | params | Hash-specific parameters. |
[in] | key | The key to derive a keystream from. |
[in] | key_len | The length in bytes of the key. |
[in] | salt | The cryptographic salt to use. |
[in] | salt_len | The length in bytes of the salt. |
[in] | info | An application specific string. |
[in] | info_len | The length in bytes of the info string. |
[out] | out | The output buffer for the derived key. |
[in] | out_len | The required length, in bytes, of the key. |
ORDO_SUCCESS
on success, else an error code.out
buffer should be at least out_len
bytes long.