@@ -144,7 +144,6 @@ def test_cases_for_not_supported(self) -> Iterator[test_case.TestCase]:
144
144
145
145
def test_case_for_key_generation (
146
146
key_type : str , bits : int ,
147
- dependencies : List [str ],
148
147
* args : str ,
149
148
result : str = ''
150
149
) -> test_case .TestCase :
@@ -158,8 +157,6 @@ def test_case_for_key_generation(
158
157
tc .set_key_bits (bits )
159
158
tc .set_key_pair_usage ('GENERATE' )
160
159
tc .set_arguments ([key_type ] + list (args ) + [result ])
161
- tc .set_dependencies (dependencies )
162
- tc .skip_if_any_not_implemented (dependencies )
163
160
return tc
164
161
165
162
class KeyGenerate :
@@ -182,33 +179,18 @@ def test_cases_for_key_type_key_generation(
182
179
All key types can be generated except for public keys. For public key
183
180
PSA_ERROR_INVALID_ARGUMENT status is expected.
184
181
"""
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' )
200
182
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 (
207
184
kt .expression , bits ,
208
- psa_information .finish_family_dependencies (test_dependencies , bits ),
209
185
str (bits ),
210
- result
186
+ 'PSA_ERROR_INVALID_ARGUMENT' if kt . is_public () else 'PSA_SUCCESS'
211
187
)
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
212
194
213
195
def test_cases_for_key_generation (self ) -> Iterator [test_case .TestCase ]:
214
196
"""Generate test cases that exercise the generation of keys."""
@@ -496,13 +478,7 @@ def make_test_case(self, key: StorageTestData) -> test_case.TestCase:
496
478
verb = 'save' if self .forward else 'read'
497
479
tc = psa_test_case .TestCase ()
498
480
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 ))
506
482
tc .set_function ('key_storage_' + verb )
507
483
tc .set_key_bits (key .bits )
508
484
tc .set_key_pair_usage ('BASIC' )
@@ -522,7 +498,6 @@ def make_test_case(self, key: StorageTestData) -> test_case.TestCase:
522
498
'"' + key .material .hex () + '"' ,
523
499
'"' + key .hex () + '"' ,
524
500
* extra_arguments ])
525
- tc .set_dependencies (dependencies )
526
501
return tc
527
502
528
503
def key_for_lifetime (
0 commit comments