1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-07-24 01:51:03 +08:00

Update test wrapper functions for ciper buffer protection

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
Gabor Mezei 2024-02-01 10:39:56 +01:00
parent 7abf8ee51b
commit b74ac66c8b
No known key found for this signature in database
GPG Key ID: BAB674E1570735EE
2 changed files with 14 additions and 1 deletions

View File

@ -146,7 +146,8 @@ class PSAWrapperGenerator(c_wrapper_generator.Base):
if function_name.startswith('psa_aead'):
return True
if function_name in {'psa_cipher_encrypt', 'psa_cipher_decrypt',
'psa_cipher_update', 'psa_cipher_finish'}:
'psa_cipher_update', 'psa_cipher_finish',
'psa_cipher_generate_iv', 'psa_cipher_set_iv'}:
return True
if function_name in ('psa_key_derivation_output_bytes',
'psa_key_derivation_input_bytes'):

View File

@ -387,7 +387,13 @@ psa_status_t mbedtls_test_wrap_psa_cipher_generate_iv(
size_t arg2_iv_size,
size_t *arg3_iv_length)
{
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
MBEDTLS_TEST_MEMORY_POISON(arg1_iv, arg2_iv_size);
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
psa_status_t status = (psa_cipher_generate_iv)(arg0_operation, arg1_iv, arg2_iv_size, arg3_iv_length);
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
MBEDTLS_TEST_MEMORY_UNPOISON(arg1_iv, arg2_iv_size);
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
return status;
}
@ -397,7 +403,13 @@ psa_status_t mbedtls_test_wrap_psa_cipher_set_iv(
const uint8_t *arg1_iv,
size_t arg2_iv_length)
{
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
MBEDTLS_TEST_MEMORY_POISON(arg1_iv, arg2_iv_length);
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
psa_status_t status = (psa_cipher_set_iv)(arg0_operation, arg1_iv, arg2_iv_length);
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
MBEDTLS_TEST_MEMORY_UNPOISON(arg1_iv, arg2_iv_length);
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
return status;
}