psa_mac_verify() function
Calculate the MAC of a message and compare it with a reference value.
Arguments
key
Identifier of the key to use for the operation. It must allow the usage PSA_KEY_USAGE_VERIFY_MESSAGE.
alg
The MAC algorithm to compute (\c PSA_ALG_XXX value such that #PSA_ALG_IS_MAC(\p alg) is true).
input
Buffer containing the input message.
input_length
Size of the \p input buffer in bytes.
mac
Buffer containing the expected MAC value.
mac_length
Size of the \p mac buffer in bytes.
Return value
#PSA_SUCCESS The expected MAC is identical to the actual MAC of the input. #PSA_ERROR_INVALID_SIGNATURE The MAC of the message was calculated successfully, but it differs from the expected value. #PSA_ERROR_INVALID_HANDLE \emptydescription #PSA_ERROR_NOT_PERMITTED \emptydescription #PSA_ERROR_INVALID_ARGUMENT \p key is not compatible with \p alg. #PSA_ERROR_NOT_SUPPORTED \p alg is not supported or is not a MAC algorithm. #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription #PSA_ERROR_HARDWARE_FAILURE \emptydescription #PSA_ERROR_CORRUPTION_DETECTED \emptydescription #PSA_ERROR_STORAGE_FAILURE The key could not be retrieved from storage. #PSA_ERROR_BAD_STATE The library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.
psa_mac_verify() calls 5 functions:
![]()
psa_mac_verify()
psa_mac_verify() reads 1 variable:
![]()
psa_mac_verify()