mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-10-31 21:50:31 +03:00 
			
		
		
		
	Add extra testcases for buffer copying
Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
		| @@ -4030,6 +4030,12 @@ psa_crypto_copy_input:10:20:PSA_SUCCESS | ||||
| 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_crypto_copy_output:10:20:PSA_SUCCESS | ||||
| 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 | ||||
|  | ||||
|   | ||||
| @@ -5651,8 +5651,12 @@ void psa_crypto_copy_input(int src_len, int dst_len, int exp_ret) | ||||
|     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 @@ void psa_crypto_copy_output(int src_len, int dst_len, int exp_ret) | ||||
|     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)]; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user