Put local output status in scope

This means that a unique name is no longer needed.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann 2023-12-13 14:09:08 +00:00
parent d57c0731c9
commit 5a945f584e

View File

@ -165,14 +165,16 @@ mbedtls_psa_drbg_context_t *const mbedtls_psa_random_state =
*/ */
#define FREE_LOCAL_OUTPUT(output) \ #define FREE_LOCAL_OUTPUT(output) \
output = NULL; \ output = NULL; \
psa_status_t output##_local_output_status; \ do { \
output##_local_output_status = psa_crypto_local_output_free(&output##_copy); \ psa_status_t local_output_status; \
if (output##_local_output_status != PSA_SUCCESS) { \ local_output_status = psa_crypto_local_output_free(&output##_copy); \
/* Since this error case is an internal error, it's more serious than \ if (local_output_status != PSA_SUCCESS) { \
* any existing error code and so it's fine to overwrite the existing \ /* Since this error case is an internal error, it's more serious than \
* status. */ \ * any existing error code and so it's fine to overwrite the existing \
status = output##_local_output_status; \ * status. */ \
} status = local_output_status; \
} \
} while (0)
#else /* MBEDTLS_PSA_COPY_CALLER_BUFFERS */ #else /* MBEDTLS_PSA_COPY_CALLER_BUFFERS */
#define SWAP_FOR_LOCAL_INPUT(input, length) #define SWAP_FOR_LOCAL_INPUT(input, length)
#define FREE_LOCAL_INPUT(input) #define FREE_LOCAL_INPUT(input)