Function esp_idf_svc::hal::sys::psa_verify_message
source ยท pub unsafe extern "C" fn psa_verify_message(
key: u32,
alg: u32,
input: *const u8,
input_length: usize,
signature: *const u8,
signature_length: usize,
) -> i32
Expand description
\brief Verify the signature of a message with a public key, using a hash-and-sign verification algorithm.
\note To perform a multi-part hash-and-sign signature verification algorithm, first use a multi-part hash operation to hash the message and then pass the resulting hash to psa_verify_hash(). PSA_ALG_GET_HASH(\p alg) can be used to determine the hash algorithm to use.
\param[in] 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_MESSAGE. \param[in] alg An asymmetric signature algorithm (PSA_ALG_XXX value such that #PSA_ALG_IS_SIGN_MESSAGE(\p alg) is true), that is compatible with the type of \p key. \param[in] input The message whose signature is to be verified. \param[in] input_length Size of the \p input buffer in bytes. \param[out] signature Buffer containing the signature to verify. \param[in] signature_length Size of the \p signature buffer in bytes.
\retval #PSA_SUCCESS \emptydescription \retval #PSA_ERROR_INVALID_HANDLE \emptydescription \retval #PSA_ERROR_NOT_PERMITTED The key does not have the #PSA_KEY_USAGE_SIGN_MESSAGE flag, or it does not permit the requested algorithm. \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_DATA_CORRUPT \emptydescription \retval #PSA_ERROR_DATA_INVALID \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.