Test slot_number attribute

Test the behavior of the getter/setter functions.

Test that psa_get_key_slot_number() reports a slot number for a key in
a secure element, and doesn't report a slot number for a key that is
not in a secure element.

Test that psa_get_key_slot_number() reports the correct slot number
for a key in a secure element.
This commit is contained in:
Gilles Peskine
2019-08-02 20:30:01 +02:00
parent c8000c005a
commit 5fe5e27591
4 changed files with 105 additions and 1 deletions

View File

@@ -163,6 +163,18 @@ static inline void psa_set_key_slot_number(
attributes->slot_number = slot_number;
}
/** Remove the slot number attribute from a key attribute structure.
*
* This function undoes the action of psa_set_key_slot_number().
*
* \param[out] attributes The attribute structure to write to.
*/
static inline void psa_clear_key_slot_number(
psa_key_attributes_t *attributes )
{
attributes->core.flags &= ~MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER;
}
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
/**@}*/