mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-07 06:40:21 +00:00
Zero-length test for psa_crypto_alloc_and_copy()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
f06ac88284
commit
03b0472413
@ -7448,3 +7448,12 @@ psa_crypto_alloc_and_copy:0:20:1:0:PSA_SUCCESS
|
||||
|
||||
PSA buffers alloc and copy: null input and output
|
||||
psa_crypto_alloc_and_copy:1:0:1:0:PSA_SUCCESS
|
||||
|
||||
PSA buffers alloc and copy zero-length input
|
||||
psa_crypto_alloc_and_copy_zero_length:1:0
|
||||
|
||||
PSA buffers alloc and copy zero-length output
|
||||
psa_crypto_alloc_and_copy_zero_length:0:1
|
||||
|
||||
PSA buffers alloc and copy both zero length
|
||||
psa_crypto_alloc_and_copy_zero_length:1:1
|
||||
|
@ -10412,3 +10412,29 @@ exit:
|
||||
mbedtls_free(buffer_copies.output);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void psa_crypto_alloc_and_copy_zero_length(int input_zero_length,
|
||||
int output_zero_length)
|
||||
{
|
||||
uint8_t input_buffer[] = { 0x12 };
|
||||
uint8_t output_buffer[] = { 0x34 };
|
||||
|
||||
psa_crypto_buffer_copy_t buffer_copies;
|
||||
|
||||
size_t input_len = input_zero_length ? 0 : 1;
|
||||
size_t output_len = output_zero_length ? 0 : 1;
|
||||
|
||||
psa_status_t ret = psa_crypto_alloc_and_copy(input_buffer, input_len,
|
||||
output_buffer, output_len,
|
||||
&buffer_copies);
|
||||
TEST_EQUAL(ret, PSA_SUCCESS);
|
||||
|
||||
TEST_MEMORY_COMPARE(input_buffer, input_len, buffer_copies.input, buffer_copies.input_len);
|
||||
TEST_EQUAL(output_len, buffer_copies.output_len);
|
||||
|
||||
exit:
|
||||
mbedtls_free(buffer_copies.input);
|
||||
mbedtls_free(buffer_copies.output);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
Loading…
x
Reference in New Issue
Block a user