openHiTLS API openHiTLS 0.1.0-Alpha1

◆ CRYPT_EAL_Pbkdf2()

int32_t CRYPT_EAL_Pbkdf2 ( CRYPT_MAC_AlgId  id,
const uint8_t *  key,
uint32_t  keyLen,
const uint8_t *  salt,
uint32_t  saltLen,
uint32_t  it,
uint8_t *  out,
uint32_t  len 
)

PBKDF password-based key derivation function

参数
id[IN] HMAC algorithm ID (Only the HMAC algorithm ID is supported, including CRYPT_MAC_HMAC_MD5, CRYPT_MAC_HMAC_SHA1, and CRYPT_MAC_HMAC_SHA224, CRYPT_MAC_HMAC_SHA256, CRYPT_MAC_HMAC_SHA384, CRYPT_MAC_HMAC_SHA512, CRYPT_MAC_HMAC_SM3)
key[IN] Password, a string input by the user.
keyLen[IN] The password length is any length, including 0.
salt[IN] Salt value, a string input by the user.
saltLen[IN] Salt value length, including 0.
it[IN] Iteration times. The value can be a positive integer that is not 0. The value can be 1000 in special performance scenarios. The default value is 10000, 10000000 is recommended in scenarios where performance is insensitive or security requirements are high.
out[OUT] Derive the key.
len[IN] Length of the derived key. The value range is [1, 0xFFFFFFFF].
返回值
CRYPT_SUCCESS,ifsuccess. Other error codes see the crypt_errno.h