Function esp_idf_hal::sys::psa_verify_hash
source ยท pub unsafe extern "C" fn psa_verify_hash(
key: u32,
alg: u32,
hash: *const u8,
hash_length: usize,
signature: *const u8,
signature_length: usize,
) -> i32
Expand description
\brief Verify the signature of a hash or short message using a public key.
Note that to perform a hash-and-sign signature algorithm, you must first calculate the hash by calling psa_hash_setup(), psa_hash_update() and psa_hash_finish(), or alternatively by calling psa_hash_compute(). Then pass the resulting hash as the \p hash parameter to this function. You can use #PSA_ALG_SIGN_GET_HASH(\p alg) to determine the hash algorithm to use.
\param key Identifier of the key to use for the operation. It must be a public key or an asymmetric key pair. The key must allow the usage #PSA_KEY_USAGE_VERIFY_HASH. \param alg A signature algorithm (PSA_ALG_XXX value such that #PSA_ALG_IS_SIGN_HASH(\p alg) is true), that is compatible with the type of \p key. \param[in] hash The hash or message whose signature is to be verified. \param hash_length Size of the \p hash buffer in bytes. \param[in] signature Buffer containing the signature to verify. \param signature_length Size of the \p signature buffer in bytes.
\retval #PSA_SUCCESS The signature is valid. \retval #PSA_ERROR_INVALID_HANDLE \emptydescription \retval #PSA_ERROR_NOT_PERMITTED \emptydescription \retval #PSA_ERROR_INVALID_SIGNATURE The calculation was performed successfully, but the passed signature is not a valid signature. \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription \retval #PSA_ERROR_INVALID_ARGUMENT \emptydescription \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 library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.