openHiTLS API openHiTLS 0.1.0-Alpha1

◆ CRYPT_EAL_MacFinal()

int32_t CRYPT_EAL_MacFinal ( CRYPT_EAL_MacCtx ctx,
uint8_t *  out,
uint32_t *  len 
)

Output the MAC result.

This API must be used after the CRYPT_EAL_MacInit API is successfully executed, during the process, you

do not need to call the CRYPT_EAL_MacUpdate API. MAC output length. HMAC-SHA1 corresponds to 20 bytes, HMAC-SHA224 corresponds to 28 bytes, and HMAC-SHA256 corresponds to 32 bytes. HMAC-SHA384 corresponds to 48 bytes, HMAC-SHA512 corresponds to 64 bytes, and CMAC-AES corresponds to 16 bytes. HMAC-SHA3-224 corresponds to 28 bytes, HMAC-SHA3-256 corresponds to 32 bytes, HMAC-SHA3-384 corresponds to 48 bytes, and HMAC-SHA3-512 corresponds to 64 bytes.

参数
ctx[IN] MAC context
out[OUT] Output data. Sufficient memory must be allocated to store MAC results and cannot be null.
len[IN/OUT] Output data length. The input parameter must specify the out length, which must be greater than or equal to the length generated by the MAC. The output parameter is the output length of the MAC.
返回值
CRYPT_SUCCESS,calculationsucceeded.
CRYPT_NULL_INPUT,theinput parameter is NULL.
CRYPT_EAL_ERR_STATE,statusincorrect.
CRYPT_HMAC_OUT_BUFF_LEN_NOT_ENOUGH,thelength of the output buffer in the HMAC algorithm is insufficient.
#CRYPT_CMAC_OUT_BUFF_LEN_NOT_ENOUGH,thelength of the output buffer in the CMAC algorithm is insufficient.
CRYPT_SHA1_INPUT_OVERFLOW,thelength of the HMAC-SHA1 input data exceeds the maximum.
CRYPT_SHA2_INPUT_OVERFLOW,thelength of the input data in HMAC-SHA224, HMAC-SHA256, HMAC-SHA384, or HMAC-SHA512 exceeds the maximum value. Other error codes see the crypt_errno.h