From f5a82fd0a2bb5aa1c383b3fa2b2013d7f643aecd Mon Sep 17 00:00:00 2001 From: Waleed Elmelegy Date: Thu, 21 Nov 2024 14:31:55 +0000 Subject: [PATCH] Add ecp prefix to internal iop generate key function names Add ecp prefix to internal iop generate key function names to emphasize that the functions are doing eliptic curves keys only and not any other types. Signed-off-by: Waleed Elmelegy --- tf-psa-crypto/core/psa_crypto.c | 6 +++--- tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.c | 6 +++--- tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.h | 11 ++++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/tf-psa-crypto/core/psa_crypto.c b/tf-psa-crypto/core/psa_crypto.c index 1899114e36..bd26451294 100644 --- a/tf-psa-crypto/core/psa_crypto.c +++ b/tf-psa-crypto/core/psa_crypto.c @@ -8108,7 +8108,7 @@ static psa_status_t psa_generate_key_iop_abort_internal( return PSA_SUCCESS; } - status = mbedtls_psa_generate_key_iop_abort(&operation->ctx); + status = mbedtls_psa_ecp_generate_key_iop_abort(&operation->ctx); psa_reset_key_attributes(&operation->attributes); @@ -8162,7 +8162,7 @@ psa_status_t psa_generate_key_iop_setup( /* We only support the builtin/Mbed TLS driver for now. */ operation->id = PSA_CRYPTO_MBED_TLS_DRIVER_ID; - status = mbedtls_psa_generate_key_iop_setup(&operation->ctx, attributes); + status = mbedtls_psa_ecp_generate_key_iop_setup(&operation->ctx, attributes); exit: if (status != PSA_SUCCESS) { @@ -8191,7 +8191,7 @@ psa_status_t psa_generate_key_iop_complete( return PSA_ERROR_BAD_STATE; } - status = mbedtls_psa_generate_key_iop_complete(&operation->ctx, key_data, + status = mbedtls_psa_ecp_generate_key_iop_complete(&operation->ctx, key_data, sizeof(key_data), &key_len); if (status != PSA_SUCCESS) { goto exit; diff --git a/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.c b/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.c index 9a2cd16849..6ce1cfb157 100644 --- a/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.c +++ b/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.c @@ -596,7 +596,7 @@ exit: #if defined(MBEDTLS_ECP_RESTARTABLE) -psa_status_t mbedtls_psa_generate_key_iop_setup( +psa_status_t mbedtls_psa_ecp_generate_key_iop_setup( mbedtls_psa_generate_key_iop_t *operation, const psa_key_attributes_t *attributes) { @@ -617,7 +617,7 @@ psa_status_t mbedtls_psa_generate_key_iop_setup( return mbedtls_to_psa_error(status); } -psa_status_t mbedtls_psa_generate_key_iop_complete( +psa_status_t mbedtls_psa_ecp_generate_key_iop_complete( mbedtls_psa_generate_key_iop_t *operation, uint8_t *key_output, size_t key_output_size, @@ -646,7 +646,7 @@ psa_status_t mbedtls_psa_generate_key_iop_complete( return mbedtls_to_psa_error(status); } -psa_status_t mbedtls_psa_generate_key_iop_abort( +psa_status_t mbedtls_psa_ecp_generate_key_iop_abort( mbedtls_psa_generate_key_iop_t *operation) { mbedtls_ecp_keypair_free(&operation->ecp); diff --git a/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.h b/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.h index ad8e6f1e1f..a2efcb71fc 100644 --- a/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.h +++ b/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.h @@ -151,7 +151,7 @@ psa_status_t mbedtls_psa_ecp_generate_key( * \param[in] attributes The desired attributes of the generated key. * * \retval #PSA_SUCCESS - * The operation started successfully - call \c mbedtls_psa_generate_key_iop_complete() + * The operation started successfully - call \c mbedtls_psa_ecp_generate_key_iop_complete() * with the same operation to complete the operation. * * \retval #PSA_ERROR_NOT_SUPPORTED * Either no internal interruptible operations are @@ -160,7 +160,7 @@ psa_status_t mbedtls_psa_ecp_generate_key( * There was insufficient memory to load the key representation. * */ -psa_status_t mbedtls_psa_generate_key_iop_setup( +psa_status_t mbedtls_psa_ecp_generate_key_iop_setup( mbedtls_psa_generate_key_iop_t *operation, const psa_key_attributes_t *attributes); @@ -174,7 +174,7 @@ psa_status_t mbedtls_psa_generate_key_iop_setup( * * \param[in] operation The \c mbedtls_psa_generate_key_iop_t to use. * This must be initialized first and - * had \c mbedtls_psa_generate_key_iop_setup() + * had \c mbedtls_psa_ecp_generate_key_iop_setup() * called successfully. * \param[out] key_output The buffer to which the generated key * is to be written. @@ -186,7 +186,7 @@ psa_status_t mbedtls_psa_generate_key_iop_setup( * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription * */ -psa_status_t mbedtls_psa_generate_key_iop_complete( +psa_status_t mbedtls_psa_ecp_generate_key_iop_complete( mbedtls_psa_generate_key_iop_t *operation, uint8_t *key_output, size_t key_output_size, @@ -201,7 +201,7 @@ psa_status_t mbedtls_psa_generate_key_iop_complete( * The operation was aborted successfully. * */ -psa_status_t mbedtls_psa_generate_key_iop_abort( +psa_status_t mbedtls_psa_ecp_generate_key_iop_abort( mbedtls_psa_generate_key_iop_t *operation); /** Sign an already-calculated hash with ECDSA. @@ -236,6 +236,7 @@ psa_status_t mbedtls_psa_generate_key_iop_abort( * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription * \retval #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription */ + psa_status_t mbedtls_psa_ecdsa_sign_hash( const psa_key_attributes_t *attributes, const uint8_t *key_buffer, size_t key_buffer_size,