You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following sequence of operations (assume nothing fails):
psa_set_key_id(attributes, 3);
psa_open_key(attributes, &handle1);
psa_open_key(attributes, &handle2);
psa_destroy_key(handle1);
…
psa_xxx_setup(…, handle2, …); // Using a destroyed key!
…
psa_set_key_id(attributes, 3);
psa_generate_key(attributes, &handle3);
…
psa_destroy_key(handle2); // Destroying a different key!
Initially, there is a key with the identifier 3, and we take two handles to the same key. The first call to psa_destroy_key wipes the key slot for handle1 and wipes the key in storage, but does not invalidate the key slot for handle2. This results in several undesirable behaviors.
If the key is transparent (i.e. not in a secure element), it is still possible to use the key via handle2, because Mbed Crypto maintains an independent copy of the key in each slot. This means that psa_destroy_key failed to deliver its promise of wiping the key material, making the key unusable.
If the key is in a secure element, it is still possible to attempt to use the key via handle2. But the key has been wiped from the secure element, so attempting to use it will either fail or trigger an operation with some other key (which may even be of a different type, leading to interesting cryptographic information leaks) depending on whether the slot number in the secure element has been reused.
If the key identifier is reused before calling psa_destroy_key on handle2, this destroys a key in storage which is not the key that handle2 references.
This is somewhat related to #86 which is about multipart operations retaining key material of a destroyed key.
Issue request type
[ ] Question
[ ] Enhancement
[x] Bug
The text was updated successfully, but these errors were encountered:
Description
Consider the following sequence of operations (assume nothing fails):
Initially, there is a key with the identifier 3, and we take two handles to the same key. The first call to
psa_destroy_key
wipes the key slot forhandle1
and wipes the key in storage, but does not invalidate the key slot forhandle2
. This results in several undesirable behaviors.handle2
, because Mbed Crypto maintains an independent copy of the key in each slot. This means thatpsa_destroy_key
failed to deliver its promise of wiping the key material, making the key unusable.handle2
. But the key has been wiped from the secure element, so attempting to use it will either fail or trigger an operation with some other key (which may even be of a different type, leading to interesting cryptographic information leaks) depending on whether the slot number in the secure element has been reused.psa_destroy_key
onhandle2
, this destroys a key in storage which is not the key thathandle2
references.This is somewhat related to #86 which is about multipart operations retaining key material of a destroyed key.
Issue request type
The text was updated successfully, but these errors were encountered: