Replace psa_make_key_persistent by id/lifetime setters
Use individual setters for the id and lifetime fields of an attribute structure, like the other attributes. This commit updates the specification and adds an implementation of the new setters.
This commit is contained in:
parent
80b39ae753
commit
dc8219a10d
2 changed files with 51 additions and 11 deletions
|
@ -287,12 +287,28 @@ static inline void psa_make_key_persistent(psa_key_attributes_t *attributes,
|
|||
attributes->lifetime = lifetime;
|
||||
}
|
||||
|
||||
static inline void psa_set_key_id(psa_key_attributes_t *attributes,
|
||||
psa_key_id_t id)
|
||||
{
|
||||
attributes->id = id;
|
||||
if( attributes->lifetime == PSA_KEY_LIFETIME_VOLATILE )
|
||||
attributes->lifetime = PSA_KEY_LIFETIME_PERSISTENT;
|
||||
}
|
||||
|
||||
static inline psa_key_id_t psa_get_key_id(
|
||||
const psa_key_attributes_t *attributes)
|
||||
{
|
||||
return( attributes->id );
|
||||
}
|
||||
|
||||
static inline void psa_set_key_lifetime(psa_key_attributes_t *attributes,
|
||||
psa_key_lifetime_t lifetime)
|
||||
{
|
||||
attributes->lifetime = lifetime;
|
||||
if( lifetime == PSA_KEY_LIFETIME_VOLATILE )
|
||||
attributes->id = 0;
|
||||
}
|
||||
|
||||
static inline psa_key_lifetime_t psa_get_key_lifetime(
|
||||
const psa_key_attributes_t *attributes)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue