pub unsafe extern "C" fn psa_hash_compare(
    alg: psa_algorithm_t,
    input: *const u8,
    input_length: usize,
    hash: *const u8,
    hash_length: usize
) -> psa_status_t
Expand description

Calculate the hash (digest) of a message and compare it with a reference value.

\param alg The hash algorithm to compute (\c PSA_ALG_XXX value such that #PSA_ALG_IS_HASH(\p alg) is true). \param[in] input Buffer containing the message to hash. \param input_length Size of the \p input buffer in bytes. \param[out] 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 input. \retval #PSA_ERROR_INVALID_SIGNATURE The hash of the message was calculated successfully, but it differs from the expected hash. \retval #PSA_ERROR_NOT_SUPPORTED \p alg is not supported or is not a hash algorithm. \retval #PSA_ERROR_INVALID_ARGUMENT \p input_length or \p hash_length do not match the hash size for \p alg \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 library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.