Function esp_idf_hal::sys::psa_mac_verify_finish
source ยท pub unsafe extern "C" fn psa_mac_verify_finish(
operation: *mut psa_mac_operation_s,
mac: *const u8,
mac_length: usize,
) -> i32
Expand description
Finish the calculation of the MAC of a message and compare it with an expected value.
The application must call psa_mac_verify_setup() before calling this function. This function calculates the MAC of the message formed by concatenating the inputs passed to preceding calls to psa_mac_update(). It then compares the calculated MAC with the expected MAC passed as a parameter to this function.
When this function returns successfully, the operation becomes inactive. If this function returns an error status, the operation enters an error state and must be aborted by calling psa_mac_abort().
\note Implementations shall make the best effort to ensure that the comparison between the actual MAC and the expected MAC is performed in constant time.
\param[in,out] operation Active MAC operation. \param[in] 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 message. \retval #PSA_ERROR_INVALID_SIGNATURE The MAC of the message was calculated successfully, but it differs from the expected MAC. \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 \emptydescription \retval #PSA_ERROR_BAD_STATE The operation state is not valid (it must be an active mac verify operation), or 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.