From e50a75f6ff10904a45c7fc7078a5eb34fed659a3 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Fri, 19 May 2023 17:43:06 +0200 Subject: [PATCH] test: add exception in analyze_outcomes.py and fix test for montgomery curves The exception in analyze_outcomes.py follows previous commit in which a test in test_suite_pkparse was set with the ECP_C guard for a different parsing of the private key between the legacy and PSA implementations. The wrong guard in test_suite_ecp.function instead was erroneously added in a past commit and it was setting a non-existing symbol of mbedTLS so those tests were basically never executed. Signed-off-by: Valerio Setti --- tests/scripts/analyze_outcomes.py | 16 +++++++++++++++- tests/suites/test_suite_ecp.function | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/scripts/analyze_outcomes.py b/tests/scripts/analyze_outcomes.py index 293459b11f..0238555367 100755 --- a/tests/scripts/analyze_outcomes.py +++ b/tests/scripts/analyze_outcomes.py @@ -247,7 +247,21 @@ TASKS = { 'ECP test vectors secp256r1 rfc 5114', 'ECP test vectors secp384r1 rfc 5114', 'ECP test vectors secp521r1 rfc 5114', - ] + ], + 'test_suite_pkparse': [ + # This is a known difference for Montgomery curves: in + # reference component private keys are parsed using + # mbedtls_mpi_read_binary_le(), while in driver version they + # they are imported in PSA and there the parsing is done + # through mbedtls_ecp_read_key(). Unfortunately the latter + # fixes the errors which are intentionally set on the parsed + # key and therefore the following test case is not failing + # as expected. + # This cause the following test to be guarded by ECP_C and + # not being executed on the driver version. + ('Key ASN1 (OneAsymmetricKey X25519, doesn\'t match masking ' + 'requirements, from RFC8410 Appendix A but made into version 0)'), + ], } } }, diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function index 250efcc673..f67c5ae9df 100644 --- a/tests/suites/test_suite_ecp.function +++ b/tests/suites/test_suite_ecp.function @@ -1086,7 +1086,7 @@ exit: } /* END_CASE */ -/* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS:MBEDTLS_ECP_MONTGOMERY_ENABLED:MBBEDTLS_ECP_C */ +/* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS:MBEDTLS_ECP_MONTGOMERY_ENABLED:MBEDTLS_ECP_LIGHT */ void genkey_mx_known_answer(int bits, data_t *seed, data_t *expected) { mbedtls_test_rnd_buf_info rnd_info;