pub unsafe extern "C" fn psa_mac_verify(
    key: mbedtls_svc_key_id_t,
    alg: psa_algorithm_t,
    input: *const u8,
    input_length: usize,
    mac: *const u8,
    mac_length: usize
) -> psa_status_t
Expand description

Calculate the MAC of a message and compare it with a reference value.

\param key Identifier of the key to use for the operation. It must allow the usage PSA_KEY_USAGE_VERIFY_MESSAGE. \param alg The MAC algorithm to compute (\c PSA_ALG_XXX value such that #PSA_ALG_IS_MAC(\p alg) is true). \param[in] input Buffer containing the input message. \param input_length Size of the \p input buffer in bytes. \param[out] mac Buffer containing the expected MAC value. \param mac_length Size of the \p mac buffer in bytes.

\retval #PSA_SUCCESS The expected MAC is identical to the actual MAC of the input. \retval #PSA_ERROR_INVALID_SIGNATURE The MAC of the message was calculated successfully, but it differs from the expected value. \retval #PSA_ERROR_INVALID_HANDLE \emptydescription \retval #PSA_ERROR_NOT_PERMITTED \emptydescription \retval #PSA_ERROR_INVALID_ARGUMENT \p key is not compatible with \p alg. \retval #PSA_ERROR_NOT_SUPPORTED \p alg is not supported or is not a MAC algorithm. \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription \retval #PSA_ERROR_HARDWARE_FAILURE \emptydescription \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription \retval #PSA_ERROR_STORAGE_FAILURE The key could not be retrieved from storage. \retval #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.