

hash_length Size of the hash buffer in bytes. hash Buffer containing the expected hash value. input_length Size of the input buffer in bytes. input Buffer containing the message to hash. Parameters alg The hash algorithm to compute: a value of type psa_algorithm_t such that PSA_ALG_IS_HASH ( alg ) is true. psa_status_t psa_hash_compare( psa_algorithm_t alg, PSA_ERROR_INSUFFICIENT_MEMORY PSA_ERROR_COMMUNICATION_FAILURE PSA_ERROR_CORRUPTION_DETECTEDĬalculate the hash (digest) of a message and compare it with a reference value. input_length is too large for the implementation.alg is not supported or is not a hash algorithm.The following conditions can result in this error: PSA_HASH_LENGTH() can be used to determine a sufficient buffer size. PSA_ERROR_BUFFER_TOO_SMALL The size of the hash buffer is too small. PSA_ERROR_BAD_STATE The library requires initializing by a call to psa_crypto_init(). The first (*hash_length) bytes of hash contain the hash value. Returns: psa_status_t PSA_SUCCESS Success. hash_length On success, the number of bytes that make up the hash value. This must be at least PSA_HASH_LENGTH ( alg ). hash_size Size of the hash buffer in bytes. hash Buffer where the hash is to be written. psa_status_t psa_hash_compute( psa_algorithm_t alg, To abort the operation or recover from an error, call psa_hash_abort().Ĭalculate the hash (digest) of a message. To verify the digest of a message against a reference value, call psa_hash_verify().To calculate the digest of a message, call psa_hash_finish().The output state can subsequently be used to resume the hash operation. To suspend the hash operation and extract a hash suspend state, call psa_hash_suspend().At the end of the message, call the required finishing function:.Call the psa_hash_update() function on successive chunks of the message.

Call psa_hash_setup() to specify the required hash algorithm, call psa_hash_clone() to duplicate the state of active psa_hash_operation_t object, or call psa_hash_resume() to restart a hash operation with the output from a previously suspended hash operation.Initialize the psa_hash_operation_t object to zero, or by assigning the value of the associated macro PSA_HASH_OPERATION_INIT.A multi-part hash operation is used as follows: The psa_hash_operation_t multi-part operation allows messages to be processed in fragments. psa_hash_compare() to compare the hash of a message with a reference value.psa_hash_compute() to calculate the hash of a message.
