mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-08-03 01:37:47 +00:00
Be more precise about key pair usage dependencies
Don't always require all of BASIC, IMPORT and EXPORT. BASIC is always implied by any of the creation methods. * `KeyTypeNotSupported`: only does an IMPORT (or GENERATE) attempt. EXPORT is not needed. This reduces dependencies in `test_suite_psa_crypto_not_supported.generated.data`. * `OpFail`: only does an IMPORT, followed by a BASIC attempt. EXPORT is not needed. This reduces dependencies in `test_suite_psa_crypto_op_fail.generated.data`. * `StorageFormat`: only does an IMPORT for save (forward compatibility) tests, and only does an EXPORT for read (backward compatibility) tests. This reduces dependencies in `test_suite_psa_crypto_storage_format.current.data` and `test_suite_psa_crypto_storage_format.v0.data` respectively. Positive test cases that create and exercise a key are still potentially missing BASIC (which is implied) and EXPORT (which isn't) for exercising the key, but this is out of scope of this commit. The generated output has fewer test case dependencies as described above, with BASIC+IMPORT+EXPORT replaced by only one of IMPORT or EXPORT. Since we never test partial support for a key type with import or export disabled, this doesn't change which test cases are executed in each tested configuration. Signed-off-by: Gilles Peskine <[email protected]>
This commit is contained in:
@@ -91,7 +91,7 @@ class KeyTypeNotSupported:
|
||||
['GENERATE'])
|
||||
import_dependencies = \
|
||||
psa_information.fix_key_pair_dependencies(import_dependencies,
|
||||
['BASIC', 'IMPORT', 'EXPORT'])
|
||||
['IMPORT'])
|
||||
for bits in kt.sizes_to_test():
|
||||
yield test_case_for_key_type_not_supported(
|
||||
'import', kt.expression, bits,
|
||||
@@ -261,7 +261,7 @@ class OpFail:
|
||||
' with ' + pretty_type if pretty_type else ''))
|
||||
dependencies = psa_information.automatic_dependencies(alg.base_expression, key_type)
|
||||
dependencies = psa_information.fix_key_pair_dependencies(dependencies,
|
||||
['BASIC', 'IMPORT', 'EXPORT'])
|
||||
['IMPORT'])
|
||||
for i, dep in enumerate(dependencies):
|
||||
if dep in not_deps:
|
||||
dependencies[i] = '!' + dep
|
||||
@@ -484,7 +484,7 @@ class StorageFormat:
|
||||
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', 'EXPORT', 'IMPORT'])
|
||||
tc.set_key_pair_usage(['IMPORT'] if self.forward else ['EXPORT'])
|
||||
if self.forward:
|
||||
extra_arguments = []
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user