psa_hash_finish() function
Finish the calculation of the hash of a message. 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(). 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(). \warning Applications should not call this function if they expect a specific value for the hash. Call psa_hash_verify() instead. Beware that comparing integrity or authenticity data such as hash values with a function such as \c memcmp is risky because the time taken by the comparison may leak information about the hashed data which could allow an attacker to guess a valid hash and thereby bypass security controls.
Arguments
operation
Active hash operation.
hash
Buffer where the hash is to be written.
hash_size
Size of the \p hash buffer in bytes.
hash_length
On success, the number of bytes that make up the hash value. This is always #PSA_HASH_LENGTH(\c alg) where \c alg is the hash algorithm that is calculated.
Return value
#PSA_SUCCESS Success. #PSA_ERROR_BUFFER_TOO_SMALL The size of the \p hash buffer is too small. You can determine a sufficient buffer size by calling #PSA_HASH_LENGTH(\c alg) where \c alg is the hash algorithm that is calculated. #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription #PSA_ERROR_HARDWARE_FAILURE \emptydescription #PSA_ERROR_CORRUPTION_DETECTED \emptydescription #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.