Add extra testcases for buffer copying

Signed-off-by: David Horstmann <david.horstmann@arm.com>
diff --git a/tests/suites/test_suite_psa_crypto.data b/tests/suites/test_suite_psa_crypto.data
index f747af4..9eee9be 100644
--- a/tests/suites/test_suite_psa_crypto.data
+++ b/tests/suites/test_suite_psa_crypto.data
@@ -4030,6 +4030,12 @@
 PSA input buffer copy: copy buffer too small
 psa_crypto_copy_input:20:10:PSA_ERROR_BUFFER_TOO_SMALL
 
+PSA input buffer copy: zero-length source buffer
+psa_crypto_copy_input:0:10:PSA_SUCCESS
+
+PSA input buffer copy: zero-length both buffers
+psa_crypto_copy_input:0:0:PSA_SUCCESS
+
 PSA output buffer copy: straightforward copy
 psa_crypto_copy_output:20:20:PSA_SUCCESS
 
@@ -4039,6 +4045,12 @@
 PSA output buffer copy: output buffer too small
 psa_crypto_copy_output:20:10:PSA_ERROR_BUFFER_TOO_SMALL
 
+PSA output buffer copy: zero-length source buffer
+psa_crypto_copy_output:0:10:PSA_SUCCESS
+
+PSA output buffer copy: zero-length both buffers
+psa_crypto_copy_output:0:0:PSA_SUCCESS
+
 PSA buffers alloc and copy
 psa_crypto_alloc_and_copy:0:20:0:20:PSA_SUCCESS
 
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 5383ae4..bd8f80d 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -5651,8 +5651,12 @@
     uint8_t *dst_buffer = NULL;
     psa_status_t ret;
 
-    TEST_CALLOC(src_buffer, src_len);
-    TEST_CALLOC(dst_buffer, dst_len);
+    /* 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);
 
     for (int i = 0; i < src_len; i++) {
         src_buffer[i] = data[i % sizeof(data)];
@@ -5680,8 +5684,12 @@
     uint8_t *dst_buffer = NULL;
     psa_status_t ret;
 
-    TEST_CALLOC(src_buffer, src_len);
-    TEST_CALLOC(dst_buffer, dst_len);
+    /* 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);
 
     for (int i = 0; i < src_len; i++) {
         src_buffer[i] = data[i % sizeof(data)];