1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-10-31 21:50:31 +03:00

Switch to TEST_CALLOC_NONNULL()

This removes some gubbins related to making sure the buffer is not NULL
that was previously cluttering the test case.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann
2023-11-03 19:45:39 +00:00
parent 113f2d46b0
commit 89b4caab53

View File

@@ -5717,12 +5717,8 @@ void copy_input(int src_len, int dst_len, psa_status_t exp_status)
uint8_t *dst_buffer = NULL;
psa_status_t status;
/* Special case, when src_len or dst_len is 0, we want to test on a real
* buffer. Calling TEST_CALLOC with 0 will return NULL. */
size_t src_calloc_len = (src_len == 0 ? 1 : src_len);
size_t dst_calloc_len = (dst_len == 0 ? 1 : dst_len);
TEST_CALLOC(src_buffer, src_calloc_len);
TEST_CALLOC(dst_buffer, dst_calloc_len);
TEST_CALLOC_NONNULL(src_buffer, src_len);
TEST_CALLOC_NONNULL(dst_buffer, dst_len);
fill_buffer_pattern(src_buffer, src_len);
@@ -5747,12 +5743,8 @@ void copy_output(int src_len, int dst_len, psa_status_t exp_status)
uint8_t *dst_buffer = NULL;
psa_status_t status;
/* Special case, when src_len or dst_len is 0, we want to test on a real
* buffer. Calling TEST_CALLOC with 0 will return NULL. */
size_t src_calloc_len = (src_len == 0 ? 1 : src_len);
size_t dst_calloc_len = (dst_len == 0 ? 1 : dst_len);
TEST_CALLOC(src_buffer, src_calloc_len);
TEST_CALLOC(dst_buffer, dst_calloc_len);
TEST_CALLOC_NONNULL(src_buffer, src_len);
TEST_CALLOC_NONNULL(dst_buffer, dst_len);
fill_buffer_pattern(src_buffer, src_len);