psa_sign_hash_start() function
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.
Arguments
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.
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.
hash
The hash or message to sign.
hash_length
Size of the \p hash buffer in bytes.
Return value
#PSA_SUCCESS The operation started successfully - call \c psa_sign_hash_complete() with the same context to complete the operation #PSA_ERROR_INVALID_HANDLE \emptydescription #PSA_ERROR_NOT_PERMITTED The key does not have the #PSA_KEY_USAGE_SIGN_HASH flag, or it does not permit the requested algorithm. #PSA_ERROR_BAD_STATE An operation has previously been started on this context, and is still in progress. #PSA_ERROR_NOT_SUPPORTED \emptydescription #PSA_ERROR_INVALID_ARGUMENT \emptydescription #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription #PSA_ERROR_HARDWARE_FAILURE \emptydescription #PSA_ERROR_CORRUPTION_DETECTED \emptydescription #PSA_ERROR_STORAGE_FAILURE \emptydescription #PSA_ERROR_DATA_CORRUPT \emptydescription #PSA_ERROR_DATA_INVALID \emptydescription #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription #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.
Notes
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. 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. If this function returns an error status, the operation enters an error state and must be aborted by calling \c psa_sign_hash_abort().