mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/psa_crypto: Fix missing usage flags when creating new keys
The PSA crypto specification states that when creating keys, the usage flags PSA_KEY_USAGE_SIGN_HASH/PSA_KEY_USAGE_VERIFY_HASH automatically set the usage flags PSA_KEY_USAGE_SIGN_MESSAGE/PSA_KEY_USAGE_VERIFY_MESSAGE on the key. Signed-off-by: Armin Wolf <W_Armin@gmx.de>
This commit is contained in:
parent
d0c4e01ca3
commit
82b07318ec
@ -1133,6 +1133,15 @@ static psa_status_t psa_start_key_creation(psa_key_creation_method_t method,
|
||||
slot = *p_slot;
|
||||
slot->attr = *attributes;
|
||||
|
||||
/* See 9.5.2. Key usage flags */
|
||||
if (slot->attr.policy.usage & PSA_KEY_USAGE_SIGN_HASH) {
|
||||
slot->attr.policy.usage |= PSA_KEY_USAGE_SIGN_MESSAGE;
|
||||
}
|
||||
|
||||
if (slot->attr.policy.usage & PSA_KEY_USAGE_VERIFY_HASH) {
|
||||
slot->attr.policy.usage |= PSA_KEY_USAGE_VERIFY_MESSAGE;
|
||||
}
|
||||
|
||||
if (PSA_KEY_LIFETIME_IS_VOLATILE(slot->attr.lifetime)) {
|
||||
slot->attr.id = key_id;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user