mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-25 09:02:48 +00:00
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 <david.horstmann@arm.com>
This commit is contained in:
parent
3e72db4f51
commit
bf4ec79085
@ -160,16 +160,18 @@ mbedtls_psa_drbg_context_t *const mbedtls_psa_random_state =
|
|||||||
* - <output>_copy was previously allocated by psa_crypto_local_output_alloc()
|
* - <output>_copy was previously allocated by psa_crypto_local_output_alloc()
|
||||||
* - <output> points to <output>_copy.buffer
|
* - <output> points to <output>_copy.buffer
|
||||||
* - psa_status_t status exists
|
* - psa_status_t status exists
|
||||||
|
* - The name <output>_local_output_status is not used for the given value of
|
||||||
|
* <output>
|
||||||
*/
|
*/
|
||||||
#define FREE_LOCAL_OUTPUT(output) \
|
#define FREE_LOCAL_OUTPUT(output) \
|
||||||
output = NULL; \
|
output = NULL; \
|
||||||
psa_status_t local_output_free_status; \
|
psa_status_t output ## _local_output_status; \
|
||||||
local_output_free_status = psa_crypto_local_output_free(&output ## _copy); \
|
output ## _local_output_status = psa_crypto_local_output_free(&output ## _copy); \
|
||||||
if (local_output_free_status != PSA_SUCCESS) { \
|
if (output ## _local_output_status != PSA_SUCCESS) { \
|
||||||
/* Since this error case is an internal error, it's more serious than \
|
/* 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 \
|
* any existing error code and so it's fine to overwrite the existing \
|
||||||
* status. */ \
|
* status. */ \
|
||||||
status = local_output_free_status; \
|
status = output ## _local_output_status; \
|
||||||
}
|
}
|
||||||
#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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user