@@ -144,7 +144,6 @@ def test_cases_for_not_supported(self) -> Iterator[test_case.TestCase]:
144144
145145def test_case_for_key_generation (
146146 key_type : str , bits : int ,
147- dependencies : List [str ],
148147 * args : str ,
149148 result : str = ''
150149) -> test_case .TestCase :
@@ -158,8 +157,6 @@ def test_case_for_key_generation(
158157 tc .set_key_bits (bits )
159158 tc .set_key_pair_usage ('GENERATE' )
160159 tc .set_arguments ([key_type ] + list (args ) + [result ])
161- tc .set_dependencies (dependencies )
162- tc .skip_if_any_not_implemented (dependencies )
163160 return tc
164161
165162class KeyGenerate :
@@ -182,33 +179,18 @@ def test_cases_for_key_type_key_generation(
182179 All key types can be generated except for public keys. For public key
183180 PSA_ERROR_INVALID_ARGUMENT status is expected.
184181 """
185- result = 'PSA_SUCCESS'
186-
187- import_dependencies = [psa_information .psa_want_symbol (kt .name )]
188- if kt .params is not None :
189- import_dependencies += [psa_information .psa_want_symbol (sym )
190- for i , sym in enumerate (kt .params )]
191- if kt .name .endswith ('_PUBLIC_KEY' ):
192- # The library checks whether the key type is a public key generically,
193- # before it reaches a point where it needs support for the specific key
194- # type, so it returns INVALID_ARGUMENT for unsupported public key types.
195- generate_dependencies = []
196- result = 'PSA_ERROR_INVALID_ARGUMENT'
197- else :
198- generate_dependencies = \
199- psa_information .fix_key_pair_dependencies (import_dependencies , 'GENERATE' )
200182 for bits in kt .sizes_to_test ():
201- if kt .name == 'PSA_KEY_TYPE_RSA_KEY_PAIR' :
202- size_dependency = "PSA_VENDOR_RSA_GENERATE_MIN_KEY_BITS <= " + str (bits )
203- test_dependencies = generate_dependencies + [size_dependency ]
204- else :
205- test_dependencies = generate_dependencies
206- yield test_case_for_key_generation (
183+ tc = test_case_for_key_generation (
207184 kt .expression , bits ,
208- psa_information .finish_family_dependencies (test_dependencies , bits ),
209185 str (bits ),
210- result
186+ 'PSA_ERROR_INVALID_ARGUMENT' if kt . is_public () else 'PSA_SUCCESS'
211187 )
188+ if kt .is_public ():
189+ # The library checks whether the key type is a public key generically,
190+ # before it reaches a point where it needs support for the specific key
191+ # type, so it returns INVALID_ARGUMENT for unsupported public key types.
192+ tc .set_dependencies ([])
193+ yield tc
212194
213195 def test_cases_for_key_generation (self ) -> Iterator [test_case .TestCase ]:
214196 """Generate test cases that exercise the generation of keys."""
@@ -496,13 +478,7 @@ def make_test_case(self, key: StorageTestData) -> test_case.TestCase:
496478 verb = 'save' if self .forward else 'read'
497479 tc = psa_test_case .TestCase ()
498480 tc .set_description (verb + ' ' + key .description )
499- dependencies = psa_information .automatic_dependencies (
500- key .lifetime .string , key .type .string ,
501- key .alg .string , key .alg2 .string ,
502- )
503- dependencies = psa_information .finish_family_dependencies (dependencies , key .bits )
504- dependencies += psa_information .generate_deps_from_description (key .description )
505- dependencies = psa_information .fix_key_pair_dependencies (dependencies , 'BASIC' )
481+ tc .add_dependencies (psa_information .generate_deps_from_description (key .description ))
506482 tc .set_function ('key_storage_' + verb )
507483 tc .set_key_bits (key .bits )
508484 tc .set_key_pair_usage ('BASIC' )
@@ -522,7 +498,6 @@ def make_test_case(self, key: StorageTestData) -> test_case.TestCase:
522498 '"' + key .material .hex () + '"' ,
523499 '"' + key .hex () + '"' ,
524500 * extra_arguments ])
525- tc .set_dependencies (dependencies )
526501 return tc
527502
528503 def key_for_lifetime (
0 commit comments