Skip to main content

mbedtls_hkdf_extract

Function mbedtls_hkdf_extract 

Source
pub unsafe extern "C" fn mbedtls_hkdf_extract(
    md: *const mbedtls_md_info_t,
    salt: *const c_uchar,
    salt_len: usize,
    ikm: *const c_uchar,
    ikm_len: usize,
    prk: *mut c_uchar,
) -> c_int
Expand description

\brief Take the input keying material \p ikm and extract from it a fixed-length pseudorandom key \p prk.

\warning This function should only be used if the security of it has been studied and established in that particular context (eg. TLS 1.3 key schedule). For standard HKDF security guarantees use \c mbedtls_hkdf instead.

\param md A hash function; md.size denotes the length of the hash function output in bytes. \param salt An optional salt value (a non-secret random value); if the salt is not provided, a string of all zeros of md.size length is used as the salt. \param salt_len The length in bytes of the optional \p salt. \param ikm The input keying material. \param ikm_len The length in bytes of \p ikm. \param[out] prk A pseudorandom key of at least md.size bytes.

\return 0 on success. \return #MBEDTLS_ERR_HKDF_BAD_INPUT_DATA when the parameters are invalid. \return An MBEDTLS_ERR_MD_* error for errors returned from the underlying MD layer.