mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-18 05:42:35 +00:00
Generate poisoning in PAKE test wrappers
Enable memory poisoning for all functions whose names start with 'psa_pake'. Regenerate the wrappers and commit the result. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
fdedbb78a5
commit
6076fe486b
@ -142,7 +142,8 @@ class PSAWrapperGenerator(c_wrapper_generator.Base):
|
|||||||
_buffer_name: Optional[str]) -> bool:
|
_buffer_name: Optional[str]) -> bool:
|
||||||
"""Whether the specified buffer argument to a PSA function should be copied.
|
"""Whether the specified buffer argument to a PSA function should be copied.
|
||||||
"""
|
"""
|
||||||
# Proof-of-concept: just instrument one function for now
|
if function_name.startswith('psa_pake'):
|
||||||
|
return True
|
||||||
if function_name == 'psa_cipher_encrypt':
|
if function_name == 'psa_cipher_encrypt':
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -778,7 +778,13 @@ psa_status_t mbedtls_test_wrap_psa_pake_input(
|
|||||||
const uint8_t *arg2_input,
|
const uint8_t *arg2_input,
|
||||||
size_t arg3_input_length)
|
size_t arg3_input_length)
|
||||||
{
|
{
|
||||||
|
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
|
||||||
|
MBEDTLS_TEST_MEMORY_POISON(arg2_input, arg3_input_length);
|
||||||
|
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
|
||||||
psa_status_t status = (psa_pake_input)(arg0_operation, arg1_step, arg2_input, arg3_input_length);
|
psa_status_t status = (psa_pake_input)(arg0_operation, arg1_step, arg2_input, arg3_input_length);
|
||||||
|
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
|
||||||
|
MBEDTLS_TEST_MEMORY_UNPOISON(arg2_input, arg3_input_length);
|
||||||
|
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,7 +796,13 @@ psa_status_t mbedtls_test_wrap_psa_pake_output(
|
|||||||
size_t arg3_output_size,
|
size_t arg3_output_size,
|
||||||
size_t *arg4_output_length)
|
size_t *arg4_output_length)
|
||||||
{
|
{
|
||||||
|
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
|
||||||
|
MBEDTLS_TEST_MEMORY_POISON(arg2_output, arg3_output_size);
|
||||||
|
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
|
||||||
psa_status_t status = (psa_pake_output)(arg0_operation, arg1_step, arg2_output, arg3_output_size, arg4_output_length);
|
psa_status_t status = (psa_pake_output)(arg0_operation, arg1_step, arg2_output, arg3_output_size, arg4_output_length);
|
||||||
|
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
|
||||||
|
MBEDTLS_TEST_MEMORY_UNPOISON(arg2_output, arg3_output_size);
|
||||||
|
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,7 +821,13 @@ psa_status_t mbedtls_test_wrap_psa_pake_set_peer(
|
|||||||
const uint8_t *arg1_peer_id,
|
const uint8_t *arg1_peer_id,
|
||||||
size_t arg2_peer_id_len)
|
size_t arg2_peer_id_len)
|
||||||
{
|
{
|
||||||
|
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
|
||||||
|
MBEDTLS_TEST_MEMORY_POISON(arg1_peer_id, arg2_peer_id_len);
|
||||||
|
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
|
||||||
psa_status_t status = (psa_pake_set_peer)(arg0_operation, arg1_peer_id, arg2_peer_id_len);
|
psa_status_t status = (psa_pake_set_peer)(arg0_operation, arg1_peer_id, arg2_peer_id_len);
|
||||||
|
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
|
||||||
|
MBEDTLS_TEST_MEMORY_UNPOISON(arg1_peer_id, arg2_peer_id_len);
|
||||||
|
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -828,7 +846,13 @@ psa_status_t mbedtls_test_wrap_psa_pake_set_user(
|
|||||||
const uint8_t *arg1_user_id,
|
const uint8_t *arg1_user_id,
|
||||||
size_t arg2_user_id_len)
|
size_t arg2_user_id_len)
|
||||||
{
|
{
|
||||||
|
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
|
||||||
|
MBEDTLS_TEST_MEMORY_POISON(arg1_user_id, arg2_user_id_len);
|
||||||
|
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
|
||||||
psa_status_t status = (psa_pake_set_user)(arg0_operation, arg1_user_id, arg2_user_id_len);
|
psa_status_t status = (psa_pake_set_user)(arg0_operation, arg1_user_id, arg2_user_id_len);
|
||||||
|
#if defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS)
|
||||||
|
MBEDTLS_TEST_MEMORY_UNPOISON(arg1_user_id, arg2_user_id_len);
|
||||||
|
#endif /* defined(MBEDTLS_PSA_COPY_CALLER_BUFFERS) */
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user