From 2b70a661182473e45e3090f54515d07fc5ad1e8b Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Wed, 13 Dec 2023 14:09:08 +0000 Subject: [PATCH] Put local output status in scope This means that a unique name is no longer needed. Signed-off-by: David Horstmann --- library/psa_crypto.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index d0dd61b32a..e4a6b5ac80 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -161,14 +161,16 @@ mbedtls_psa_drbg_context_t *const mbedtls_psa_random_state = */ #define FREE_LOCAL_OUTPUT(output) \ output = NULL; \ - 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 = output##_local_output_status; \ - } + do { \ + psa_status_t local_output_status; \ + local_output_status = psa_crypto_local_output_free(&output##_copy); \ + if (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_status; \ + } \ + } while (0) #else /* MBEDTLS_PSA_COPY_CALLER_BUFFERS */ #define SWAP_FOR_LOCAL_INPUT(input, length) #define FREE_LOCAL_INPUT(input)