Function esp_idf_sys::psa_sign_hash_start

source ยท
pub unsafe extern "C" fn psa_sign_hash_start(
    operation: *mut psa_sign_hash_interruptible_operation_t,
    key: mbedtls_svc_key_id_t,
    alg: psa_algorithm_t,
    hash: *const u8,
    hash_length: usize,
) -> psa_status_t
Expand description

\brief Start signing a hash or short message with a private key, in an interruptible manner.

\see \c psa_sign_hash_complete()

\warning This is a beta API, and thus subject to change at any point. It is not bound by the usual interface stability promises.

\note This function combined with \c psa_sign_hash_complete() is equivalent to \c psa_sign_hash() but \c psa_sign_hash_complete() can return early and resume according to the limit set with \c psa_interruptible_set_max_ops() to reduce the maximum time spent in a function call.

\note Users should call \c psa_sign_hash_complete() repeatedly on the same context after a successful call to this function until \c psa_sign_hash_complete() either returns 0 or an error. \c psa_sign_hash_complete() will return #PSA_OPERATION_INCOMPLETE if there is more work to do. Alternatively users can call \c psa_sign_hash_abort() at any point if they no longer want the result.

\note If this function returns an error status, the operation enters an error state and must be aborted by calling \c psa_sign_hash_abort().

\param[in, out] operation The \c psa_sign_hash_interruptible_operation_t to use. This must be initialized first.

\param key Identifier of the key to use for the operation. It must be an asymmetric key pair. The key must allow the usage #PSA_KEY_USAGE_SIGN_HASH. \param alg A signature algorithm (\c 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 to sign. \param hash_length Size of the \p hash buffer in bytes.

\retval #PSA_SUCCESS The operation started successfully - call \c psa_sign_hash_complete() with the same context to complete the operation

\retval #PSA_ERROR_INVALID_HANDLE \emptydescription \retval #PSA_ERROR_NOT_PERMITTED The key does not have the #PSA_KEY_USAGE_SIGN_HASH flag, or it does not permit the requested algorithm. \retval #PSA_ERROR_BAD_STATE An operation has previously been started on this context, and is still in progress. \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_INSUFFICIENT_ENTROPY \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.