Add input round-trip testcase
Signed-off-by: David Horstmann <david.horstmann@arm.com>
diff --git a/tests/suites/test_suite_psa_crypto_memory.data b/tests/suites/test_suite_psa_crypto_memory.data
index 2ca7e15..3d14ba3 100644
--- a/tests/suites/test_suite_psa_crypto_memory.data
+++ b/tests/suites/test_suite_psa_crypto_memory.data
@@ -40,6 +40,9 @@
PSA crypto input copy free, NULL buffer
input_copy_free:0
+PSA crypto input copy round-trip
+input_copy_round_trip
+
PSA crypto output copy alloc
output_copy_alloc:200:PSA_SUCCESS
diff --git a/tests/suites/test_suite_psa_crypto_memory.function b/tests/suites/test_suite_psa_crypto_memory.function
index 57a10ae..3c7b842 100644
--- a/tests/suites/test_suite_psa_crypto_memory.function
+++ b/tests/suites/test_suite_psa_crypto_memory.function
@@ -132,6 +132,27 @@
/* END_CASE */
/* BEGIN_CASE */
+void input_copy_round_trip()
+{
+ psa_crypto_input_copy_t input_copy;
+ uint8_t input[200];
+ psa_status_t status;
+
+ fill_buffer_pattern(input, sizeof(input));
+
+ status = psa_crypto_input_copy_alloc(input, sizeof(input), &input_copy);
+ TEST_EQUAL(status, PSA_SUCCESS);
+ TEST_MEMORY_COMPARE(input_copy.buffer, input_copy.len,
+ input, sizeof(input));
+ TEST_ASSERT(input_copy.buffer != input);
+
+ psa_crypto_input_copy_free(&input_copy);
+ TEST_ASSERT(input_copy.buffer == NULL);
+ TEST_EQUAL(input_copy.len, 0);
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
void output_copy_alloc(int output_len, psa_status_t exp_status)
{
uint8_t *output = NULL;