From bf4ec79085770abb29bc765e6ac1140094e3c911 Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Mon, 11 Dec 2023 15:45:20 +0000 Subject: [PATCH] Make return statuses unique in FREE_LOCAL_OUTPUT() Previously the return from psa_crypto_local_output_free() had a fixed name, which meant that multiple outputs would cause redefinitions of the same variable. Signed-off-by: David Horstmann --- library/psa_crypto.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 575c08cab9..2847d70dee 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -160,16 +160,18 @@ mbedtls_psa_drbg_context_t *const mbedtls_psa_random_state = * - _copy was previously allocated by psa_crypto_local_output_alloc() * - points to _copy.buffer * - psa_status_t status exists + * - The name _local_output_status is not used for the given value of + * */ #define FREE_LOCAL_OUTPUT(output) \ output = NULL; \ - psa_status_t local_output_free_status; \ - local_output_free_status = psa_crypto_local_output_free(&output ## _copy); \ - if (local_output_free_status != PSA_SUCCESS) { \ + psa_status_t output ## _local_output_status; \ + output ## _local_output_status = psa_crypto_local_output_free(&output ## _copy); \ + if (output ## _local_output_status != PSA_SUCCESS) { \ /* Since this error case is an internal error, it's more serious than \ * any existing error code and so it's fine to overwrite the existing \ * status. */ \ - status = local_output_free_status; \ + status = output ## _local_output_status; \ } #else /* MBEDTLS_PSA_COPY_CALLER_BUFFERS */ #define SWAP_FOR_LOCAL_INPUT(input, length)