From 0c1aa4af38216640ff9568213bacbfd4fc0b74f4 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Thu, 18 Jul 2024 21:40:16 +0100 Subject: [PATCH] Add psa_generate_key_iop_abort() documentation Signed-off-by: Paul Elliott --- tf-psa-crypto/core/psa_crypto_ecp.c | 8 ++++++ tf-psa-crypto/include/psa/crypto.h | 40 +++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/tf-psa-crypto/core/psa_crypto_ecp.c b/tf-psa-crypto/core/psa_crypto_ecp.c index f12c1cdb00..77bc0b2142 100644 --- a/tf-psa-crypto/core/psa_crypto_ecp.c +++ b/tf-psa-crypto/core/psa_crypto_ecp.c @@ -623,6 +623,14 @@ psa_status_t psa_generate_key_iop_complete( return PSA_SUCCESS; } +psa_status_t psa_generate_key_iop_abort( + psa_generate_key_iop_t *operation) +{ + (void) operation; + + return PSA_SUCCESS; +} + /****************************************************************/ /* Interruptible ECC Key Agreement */ /****************************************************************/ diff --git a/tf-psa-crypto/include/psa/crypto.h b/tf-psa-crypto/include/psa/crypto.h index 72a4a8802c..aabf0f7553 100644 --- a/tf-psa-crypto/include/psa/crypto.h +++ b/tf-psa-crypto/include/psa/crypto.h @@ -5419,6 +5419,46 @@ psa_status_t psa_generate_key_iop_complete( psa_generate_key_iop_t *operation, psa_key_id_t *key); +/** + * \brief Abort a key generation operation. + * + * \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 clears the number of ops completed + * as part of the operation. Please ensure you copy + * this value via + * \c psa_generate_key_iop_get_num_ops() if + * required before calling. + * + * \note Aborting an operation frees all + * associated resources except for the operation + * structure itself. Once aborted, the operation + * object can be reused for another operation by + * calling \c psa_generate_key_iop_setup() again. + * + * \note You may call this function any time after the + * operation object has been initialized. + * In particular, calling \c + * psa_generate_key_iop_abort() after the + * operation has already been terminated by a call + * to \c psa_generate_key_iop_abort() or + * psa_generate_key_iop_complete() is safe. + * + * \param[in,out] operation The \c psa_key_agreement_iop_t to use + * + * \retval #PSA_SUCCESS + * The operation was aborted successfully. + * + * \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription + * \retval #PSA_ERROR_BAD_STATE + * The library has not been previously initialized by + * \c psa_crypto_init(). + */ +psa_status_t psa_generate_key_iop_abort( + psa_generate_key_iop_t *operation); + /**@}*/ #ifdef __cplusplus