From 34c434a3cadbe1525fea72e362d70962e341cdbf Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Mon, 20 Nov 2023 12:16:08 +0000 Subject: [PATCH] Add initializers for input / output copies Signed-off-by: David Horstmann --- library/psa_crypto_core.h | 4 ++++ tests/suites/test_suite_psa_crypto_memory.function | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/library/psa_crypto_core.h b/library/psa_crypto_core.h index 1a5a389084..d3785054fa 100644 --- a/library/psa_crypto_core.h +++ b/library/psa_crypto_core.h @@ -520,6 +520,8 @@ typedef struct psa_crypto_input_copy_s { size_t len; } psa_crypto_input_copy_t; +#define PSA_CRYPTO_INPUT_COPY_INIT { NULL, 0 } + /** Allocate a local copy of an input buffer. * * \param[in] input Pointer to input buffer. @@ -548,6 +550,8 @@ typedef struct psa_crypto_output_copy_s { size_t len; } psa_crypto_output_copy_t; +#define PSA_CRYPTO_OUTPUT_COPY_INIT { NULL, NULL, 0 } + /** Allocate a local copy of an output buffer. * * \note This does not copy any data from the original diff --git a/tests/suites/test_suite_psa_crypto_memory.function b/tests/suites/test_suite_psa_crypto_memory.function index 7b6b7f189c..e9e529989e 100644 --- a/tests/suites/test_suite_psa_crypto_memory.function +++ b/tests/suites/test_suite_psa_crypto_memory.function @@ -184,12 +184,9 @@ void output_copy_free(int output_len, int original_is_null, { uint8_t *output = NULL; uint8_t *buffer_copy_for_comparison = NULL; - psa_crypto_output_copy_t output_copy; + psa_crypto_output_copy_t output_copy = PSA_CRYPTO_OUTPUT_COPY_INIT; psa_status_t status; - output_copy.buffer = NULL; - output_copy.len = 0; - if (!original_is_null) { TEST_CALLOC(output, output_len); }