mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-16 04:20:49 +00:00
test_suite_psa_crypto: improve failing tests for EC conversion functions
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
4ba0c61eda
commit
ac73952474
@ -7463,5 +7463,5 @@ ECP group ID <-> PSA family - Null values
|
||||
ecc_conversion_functions:MBEDTLS_ECP_DP_NONE:0:0
|
||||
|
||||
ECP group ID <-> PSA family - Wrong values
|
||||
ecc_conversion_functions:MBEDTLS_ECP_DP_MAX:0:0
|
||||
ecc_conversion_functions_fail
|
||||
|
||||
|
@ -9491,15 +9491,33 @@ void ecc_conversion_functions(int grp_id_arg, int psa_family_arg, int bits_arg)
|
||||
|
||||
TEST_EQUAL(ecc_family, mbedtls_ecc_group_to_psa(grp_id, &bits_tmp));
|
||||
TEST_EQUAL(bits, bits_tmp);
|
||||
|
||||
if (grp_id != MBEDTLS_ECP_DP_MAX) {
|
||||
TEST_EQUAL(grp_id, mbedtls_ecc_group_from_psa(ecc_family, bits));
|
||||
} else {
|
||||
TEST_EQUAL(MBEDTLS_ECP_DP_NONE, mbedtls_ecc_group_from_psa(ecc_family, bits));
|
||||
}
|
||||
TEST_EQUAL(grp_id, mbedtls_ecc_group_from_psa(ecc_family, bits));
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY */
|
||||
void ecc_conversion_functions_fail()
|
||||
{
|
||||
size_t bits;
|
||||
|
||||
/* Invalid legacy curve identifier. */
|
||||
TEST_EQUAL(0, mbedtls_ecc_group_to_psa(MBEDTLS_ECP_DP_NONE, &bits));
|
||||
TEST_EQUAL(0, bits);
|
||||
|
||||
/* Invalid PSA EC family. */
|
||||
TEST_EQUAL(MBEDTLS_ECP_DP_NONE, mbedtls_ecc_group_from_psa(0, 192));
|
||||
/* Invalid bit-size for a valid EC family. */
|
||||
TEST_EQUAL(MBEDTLS_ECP_DP_NONE, mbedtls_ecc_group_from_psa(PSA_ECC_FAMILY_SECP_R1, 512));
|
||||
|
||||
/* Twisted-Edward curves are not supported yet. */
|
||||
TEST_EQUAL(MBEDTLS_ECP_DP_NONE,
|
||||
mbedtls_ecc_group_from_psa(PSA_ECC_FAMILY_TWISTED_EDWARDS, 255));
|
||||
TEST_EQUAL(MBEDTLS_ECP_DP_NONE,
|
||||
mbedtls_ecc_group_from_psa(PSA_ECC_FAMILY_TWISTED_EDWARDS, 448));
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void key_agreement_output(int alg_arg,
|
||||
int our_key_type_arg, data_t *our_key_data,
|
||||
|
Loading…
x
Reference in New Issue
Block a user