From db0c4a4b2ccd1d0174d3e2fcbd8edb2ee613b6ee Mon Sep 17 00:00:00 2001 From: Waleed Elmelegy Date: Mon, 18 Nov 2024 17:38:59 +0000 Subject: [PATCH] Remove MBEDTLS_ECP_MAX_MPI_BYTES macro Remove MBEDTLS_ECP_MAX_MPI_BYTES macro as it's not needed anymore.It was added when memcpy was being used but now that mbedtls_mpi_write_binary() is being used it can handle copying a large buffer filled with leading zeros into a smaller buffer. Signed-off-by: Waleed Elmelegy --- tf-psa-crypto/core/psa_crypto.c | 2 +- tf-psa-crypto/drivers/builtin/include/mbedtls/ecp.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tf-psa-crypto/core/psa_crypto.c b/tf-psa-crypto/core/psa_crypto.c index 30dd8292d..2eb1d63e3 100644 --- a/tf-psa-crypto/core/psa_crypto.c +++ b/tf-psa-crypto/core/psa_crypto.c @@ -8184,7 +8184,7 @@ psa_status_t psa_generate_key_iop_complete( { #if defined(MBEDTLS_ECP_RESTARTABLE) psa_status_t status; - uint8_t key_data[MBEDTLS_ECP_MAX_MPI_BYTES] = { 0 }; + uint8_t key_data[MBEDTLS_ECP_MAX_BYTES] = { 0 }; size_t key_len = 0; if (operation->id == 0 || operation->error_occurred) { diff --git a/tf-psa-crypto/drivers/builtin/include/mbedtls/ecp.h b/tf-psa-crypto/drivers/builtin/include/mbedtls/ecp.h index 98555903e..b3406142f 100644 --- a/tf-psa-crypto/drivers/builtin/include/mbedtls/ecp.h +++ b/tf-psa-crypto/drivers/builtin/include/mbedtls/ecp.h @@ -345,8 +345,6 @@ mbedtls_ecp_group; #define MBEDTLS_ECP_MAX_BYTES ((MBEDTLS_ECP_MAX_BITS + 7) / 8) #define MBEDTLS_ECP_MAX_PT_LEN (2 * MBEDTLS_ECP_MAX_BYTES + 1) -#define MBEDTLS_ECP_MAX_MPI_BYTES ((MBEDTLS_ECP_MAX_BYTES + sizeof(mbedtls_mpi_uint)) & \ - ~(sizeof(mbedtls_mpi_uint)-1)) #if defined(MBEDTLS_ECP_RESTARTABLE)