Skip to content

Commit fbb1b2d

Browse files
Fix erasure of external flags
This didn't break anything now, but would have broken things once we start to add internal flags.
1 parent f8306d1 commit fbb1b2d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

library/psa_crypto.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,8 +1559,11 @@ static psa_status_t psa_start_key_creation(
15591559
slot->attr = attributes->core;
15601560

15611561
/* Erase external-only flags from the internal copy. To access
1562-
* external-only flags, query `attributes`. */
1563-
slot->attr.flags |= ~MBEDTLS_PSA_KA_MASK_EXTERNAL_ONLY;
1562+
* external-only flags, query `attributes`. Thanks to the check
1563+
* in psa_validate_key_attributes(), this leaves the dual-use
1564+
* flags and any internal flag that psa_internal_allocate_key_slot()
1565+
* may have set. */
1566+
slot->attr.flags &= ~MBEDTLS_PSA_KA_MASK_EXTERNAL_ONLY;
15641567

15651568
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
15661569
/* For a key in a secure element, we need to do three things:

0 commit comments

Comments
 (0)