From 4cffd5d4f39e1d8797ef4e6c14fb8a600f8ac6f0 Mon Sep 17 00:00:00 2001 From: Waleed Elmelegy Date: Tue, 3 Dec 2024 13:50:56 +0000 Subject: [PATCH] Add implementaion for psa_export_public_key_iop_complete() Signed-off-by: Waleed Elmelegy --- tf-psa-crypto/core/psa_crypto.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tf-psa-crypto/core/psa_crypto.c b/tf-psa-crypto/core/psa_crypto.c index 359d622728..13ab40a3b6 100644 --- a/tf-psa-crypto/core/psa_crypto.c +++ b/tf-psa-crypto/core/psa_crypto.c @@ -1757,12 +1757,33 @@ psa_status_t psa_export_public_key_iop_complete(psa_export_public_key_iop_t *ope size_t data_size, size_t *data_length) { +#if defined(MBEDTLS_ECP_RESTARTABLE) + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + + if (operation->id == 0 || operation->error_occurred) { + return PSA_ERROR_BAD_STATE; + } + + status = mbedtls_psa_ecp_export_public_key_iop_complete(&operation->ctx, data, data_size, + data_length); + + if (status != PSA_OPERATION_INCOMPLETE) { + psa_export_public_key_iop_abort_internal(operation); + + if (status != PSA_SUCCESS) { + operation->error_occurred = 1; + } + } + + return status; +#else (void) operation; (void) data; (void) data_size; (void) data_length; - return PSA_ERROR_NOT_SUPPORTED; + return PSA_ERROR_BAD_STATE; +#endif } psa_status_t psa_export_public_key_iop_abort(psa_export_public_key_iop_t *operation)