Skip to main content

mbedtls_pkcs12_derivation

Function mbedtls_pkcs12_derivation 

Source
pub unsafe extern "C" fn mbedtls_pkcs12_derivation(
    data: *mut c_uchar,
    datalen: usize,
    pwd: *const c_uchar,
    pwdlen: usize,
    salt: *const c_uchar,
    saltlen: usize,
    mbedtls_md: mbedtls_md_type_t,
    id: c_int,
    iterations: c_int,
) -> c_int
Expand description

\brief The PKCS#12 derivation function uses a password and a salt to produce pseudo-random bits for a particular “purpose”.

              Depending on the given id, this function can produce an
              encryption/decryption key, an initialization vector or an
              integrity key.

\param data buffer to store the derived data in \param datalen length of buffer to fill \param pwd The password to use. For compliance with PKCS#12 §B.1, this should be a BMPString, i.e. a Unicode string where each character is encoded as 2 bytes in big-endian order, with no byte order mark and with a null terminator (i.e. the last two bytes should be 0x00 0x00). \param pwdlen length of the password (may be 0). \param salt Salt buffer to use. This may only be \c NULL when \p saltlen is 0. \param saltlen length of the salt (may be zero) \param mbedtls_md mbedtls_md type to use during the derivation \param id id that describes the purpose (can be #MBEDTLS_PKCS12_DERIVE_KEY, #MBEDTLS_PKCS12_DERIVE_IV or #MBEDTLS_PKCS12_DERIVE_MAC_KEY) \param iterations number of iterations

\return 0 if successful, or a MD, BIGNUM type error.