mirror of https://github.com/ARMmbed/mbed-os.git
Fix crypto compliance tests
Prevent passing null buffer with size which is non-zero.pull/10023/head
parent
774294d1e2
commit
ea36a89ec7
|
@ -90,12 +90,18 @@ int32_t psa_aead_encrypt_test(security_t caller)
|
|||
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
|
||||
|
||||
if (is_buffer_empty(check1[i].nonce, check1[i].nonce_length) == TRUE)
|
||||
{
|
||||
nonce = NULL;
|
||||
check1[i].nonce_length = 0;
|
||||
}
|
||||
else
|
||||
nonce = check1[i].nonce;
|
||||
|
||||
if (is_buffer_empty(check1[i].additional_data, check1[i].additional_data_length) == TRUE)
|
||||
{
|
||||
additional_data = NULL;
|
||||
check1[i].additional_data_length = 0;
|
||||
}
|
||||
else
|
||||
additional_data = check1[i].additional_data;
|
||||
|
||||
|
@ -152,12 +158,18 @@ int32_t psa_aead_encrypt_negative_test(security_t caller)
|
|||
check2[i].key_alg);
|
||||
|
||||
if (is_buffer_empty(check2[i].nonce, check2[i].nonce_length) == TRUE)
|
||||
{
|
||||
nonce = NULL;
|
||||
check2[i].nonce_length = 0;
|
||||
}
|
||||
else
|
||||
nonce = check2[i].nonce;
|
||||
|
||||
if (is_buffer_empty(check2[i].additional_data, check2[i].additional_data_length) == TRUE)
|
||||
{
|
||||
additional_data = NULL;
|
||||
check2[i].additional_data_length = 0;
|
||||
}
|
||||
else
|
||||
additional_data = check2[i].additional_data;
|
||||
|
||||
|
|
|
@ -89,12 +89,18 @@ int32_t psa_aead_decrypt_test(security_t caller)
|
|||
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
|
||||
|
||||
if (is_buffer_empty(check1[i].nonce, check1[i].nonce_length) == TRUE)
|
||||
{
|
||||
nonce = NULL;
|
||||
check1[i].nonce_length = 0;
|
||||
}
|
||||
else
|
||||
nonce = check1[i].nonce;
|
||||
|
||||
if (is_buffer_empty(check1[i].additional_data, check1[i].additional_data_length) == TRUE)
|
||||
{
|
||||
additional_data = NULL;
|
||||
check1[i].additional_data_length = 0;
|
||||
}
|
||||
else
|
||||
additional_data = check1[i].additional_data;
|
||||
|
||||
|
@ -149,12 +155,18 @@ int32_t psa_aead_decrypt_negative_test(security_t caller)
|
|||
check2[i].key_alg);
|
||||
|
||||
if (is_buffer_empty(check2[i].nonce, check2[i].nonce_length) == TRUE)
|
||||
{
|
||||
nonce = NULL;
|
||||
check2[i].nonce_length = 0;
|
||||
}
|
||||
else
|
||||
nonce = check2[i].nonce;
|
||||
|
||||
if (is_buffer_empty(check2[i].additional_data, check2[i].additional_data_length) == TRUE)
|
||||
{
|
||||
additional_data = NULL;
|
||||
check2[i].additional_data_length = 0;
|
||||
}
|
||||
else
|
||||
additional_data = check2[i].additional_data;
|
||||
|
||||
|
|
|
@ -128,7 +128,10 @@ int32_t psa_asymmetric_encrypt_test(security_t caller)
|
|||
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
|
||||
|
||||
if (is_buffer_empty(check1[i].salt, check1[i].salt_length) == TRUE)
|
||||
{
|
||||
salt = NULL;
|
||||
check1[i].salt_length = 0;
|
||||
}
|
||||
else
|
||||
salt = check1[i].salt;
|
||||
|
||||
|
@ -223,7 +226,10 @@ int32_t psa_asymmetric_encrypt_negative_test(security_t caller)
|
|||
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
|
||||
|
||||
if (is_buffer_empty(check1[i].salt, check1[i].salt_length) == TRUE)
|
||||
{
|
||||
salt = NULL;
|
||||
check1[i].salt_length = 0;
|
||||
}
|
||||
else
|
||||
salt = check1[i].salt;
|
||||
|
||||
|
|
|
@ -128,7 +128,10 @@ int32_t psa_asymmetric_decrypt_test(security_t caller)
|
|||
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(5));
|
||||
|
||||
if (is_buffer_empty(check1[i].salt, check1[i].salt_length) == TRUE)
|
||||
{
|
||||
salt = NULL;
|
||||
check1[i].salt_length = 0;
|
||||
}
|
||||
else
|
||||
salt = check1[i].salt;
|
||||
|
||||
|
@ -209,7 +212,10 @@ int32_t psa_asymmetric_decrypt_negative_test(security_t caller)
|
|||
TEST_ASSERT_EQUAL(status, PSA_SUCCESS, TEST_CHECKPOINT_NUM(6));
|
||||
|
||||
if (is_buffer_empty(check1[i].salt, check1[i].salt_length) == TRUE)
|
||||
{
|
||||
salt = NULL;
|
||||
check1[i].salt_length = 0;
|
||||
}
|
||||
else
|
||||
salt = check1[i].salt;
|
||||
|
||||
|
|
Loading…
Reference in New Issue