diff --git a/scripts/generate_psa_tests.py b/scripts/generate_psa_tests.py index 0038693a5..40c701217 100755 --- a/scripts/generate_psa_tests.py +++ b/scripts/generate_psa_tests.py @@ -144,7 +144,6 @@ def test_cases_for_not_supported(self) -> Iterator[test_case.TestCase]: def test_case_for_key_generation( key_type: str, bits: int, - dependencies: List[str], *args: str, result: str = '' ) -> test_case.TestCase: @@ -158,8 +157,6 @@ def test_case_for_key_generation( tc.set_key_bits(bits) tc.set_key_pair_usage('GENERATE') tc.set_arguments([key_type] + list(args) + [result]) - tc.set_dependencies(dependencies) - tc.skip_if_any_not_implemented(dependencies) return tc class KeyGenerate: @@ -182,33 +179,18 @@ def test_cases_for_key_type_key_generation( All key types can be generated except for public keys. For public key PSA_ERROR_INVALID_ARGUMENT status is expected. """ - result = 'PSA_SUCCESS' - - import_dependencies = [psa_information.psa_want_symbol(kt.name)] - if kt.params is not None: - import_dependencies += [psa_information.psa_want_symbol(sym) - for i, sym in enumerate(kt.params)] - if kt.name.endswith('_PUBLIC_KEY'): - # The library checks whether the key type is a public key generically, - # before it reaches a point where it needs support for the specific key - # type, so it returns INVALID_ARGUMENT for unsupported public key types. - generate_dependencies = [] - result = 'PSA_ERROR_INVALID_ARGUMENT' - else: - generate_dependencies = \ - psa_information.fix_key_pair_dependencies(import_dependencies, 'GENERATE') for bits in kt.sizes_to_test(): - if kt.name == 'PSA_KEY_TYPE_RSA_KEY_PAIR': - size_dependency = "PSA_VENDOR_RSA_GENERATE_MIN_KEY_BITS <= " + str(bits) - test_dependencies = generate_dependencies + [size_dependency] - else: - test_dependencies = generate_dependencies - yield test_case_for_key_generation( + tc = test_case_for_key_generation( kt.expression, bits, - psa_information.finish_family_dependencies(test_dependencies, bits), str(bits), - result + 'PSA_ERROR_INVALID_ARGUMENT' if kt.is_public() else 'PSA_SUCCESS' ) + if kt.is_public(): + # The library checks whether the key type is a public key generically, + # before it reaches a point where it needs support for the specific key + # type, so it returns INVALID_ARGUMENT for unsupported public key types. + tc.set_dependencies([]) + yield tc def test_cases_for_key_generation(self) -> Iterator[test_case.TestCase]: """Generate test cases that exercise the generation of keys.""" @@ -496,13 +478,7 @@ def make_test_case(self, key: StorageTestData) -> test_case.TestCase: verb = 'save' if self.forward else 'read' tc = psa_test_case.TestCase() tc.set_description(verb + ' ' + key.description) - dependencies = psa_information.automatic_dependencies( - key.lifetime.string, key.type.string, - key.alg.string, key.alg2.string, - ) - dependencies = psa_information.finish_family_dependencies(dependencies, key.bits) - dependencies += psa_information.generate_deps_from_description(key.description) - dependencies = psa_information.fix_key_pair_dependencies(dependencies, 'BASIC') + tc.add_dependencies(psa_information.generate_deps_from_description(key.description)) tc.set_function('key_storage_' + verb) tc.set_key_bits(key.bits) tc.set_key_pair_usage('BASIC') @@ -522,7 +498,6 @@ def make_test_case(self, key: StorageTestData) -> test_case.TestCase: '"' + key.material.hex() + '"', '"' + key.hex() + '"', *extra_arguments]) - tc.set_dependencies(dependencies) return tc def key_for_lifetime(