mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-24 12:45:35 +00:00
Convert the PSA crypto cryptography tests to the new handle API
Switch from the direct use of slot numbers to handles allocated by psa_allocate_key. This commit does not affect persistent key tests except for the one test function in test_suite_psa_crypto that uses persistent keys (persistent_key_load_key_from_storage). The general principle for each function is: * Change `psa_key_slot_t slot` to `psa_key_handle_t handle`. * Call psa_allocate_key() before setting the policy of the slot, or before creating key material in functions that don't set a policy. * Some PSA_ERROR_EMPTY_SLOT errors become PSA_ERROR_INVALID_HANDLE because there is now a distinction between not having a valid handle, and having a valid handle to a slot that doesn't contain key material. * In tests that use symmetric keys, calculate the max_bits parameters of psa_allocate_key() from the key data size. In tests where the key may be asymmetric, call an auxiliary macro KEY_BITS_FROM_DATA which returns an overapproximation. There's no good way to find a good value for max_bits with the API, I think the API should be tweaked.
This commit is contained in:
parent
a8860b2990
commit
bdf309ccdb
|
@ -29,17 +29,15 @@ PSA import to non empty key slot
|
|||
depends_on:MBEDTLS_AES_C
|
||||
import_key_nonempty_slot
|
||||
|
||||
PSA export empty key slot
|
||||
export_invalid_slot:1:PSA_ERROR_EMPTY_SLOT
|
||||
PSA export invalid handle (0)
|
||||
export_invalid_handle:0:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA export out of range key slot - lower bound
|
||||
export_invalid_slot:0:PSA_ERROR_INVALID_ARGUMENT
|
||||
PSA export invalid handle (smallest plausible handle)
|
||||
# EMPTY_SLOT is temporary, because this valie is treated as a numbered slot, not as a handle
|
||||
export_invalid_handle:1:PSA_ERROR_EMPTY_SLOT
|
||||
|
||||
PSA export out of range key slot - upper bound
|
||||
# Hard-code the upper bound of slots that are directly accessible because the
|
||||
# API does not expose this value. This is temporary: directly-accessible
|
||||
# slots are about to be removed.
|
||||
export_invalid_slot:32767:PSA_ERROR_INVALID_ARGUMENT
|
||||
PSA export invalid handle (largest plausible handle)
|
||||
export_invalid_handle:-1:PSA_ERROR_INVALID_HANDLE
|
||||
|
||||
PSA export a slot where there was some activity but no key material creation
|
||||
export_with_no_key_activity
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue