pub unsafe extern "C" fn psa_hash_verify(
    operation: *mut psa_hash_operation_t,
    hash: *const u8,
    hash_length: usize
) -> psa_status_t
Expand description

Finish the calculation of the hash of a message and compare it with an expected value.

The application must call psa_hash_setup() before calling this function. This function calculates the hash of the message formed by concatenating the inputs passed to preceding calls to psa_hash_update(). It then compares the calculated hash with the expected hash 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_hash_abort().

\note Implementations shall make the best effort to ensure that the comparison between the actual hash and the expected hash is performed in constant time.

\param[in,out] operation Active hash operation. \param[in] hash Buffer containing the expected hash value. \param hash_length Size of the \p hash buffer in bytes.

\retval #PSA_SUCCESS The expected hash is identical to the actual hash of the message. \retval #PSA_ERROR_INVALID_SIGNATURE The hash of the message was calculated successfully, but it differs from the expected hash. \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_BAD_STATE The operation state is not valid (it must be active), 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.