23 #ifndef PSA_CRYPTO_STRUCT_H 24 #define PSA_CRYPTO_STRUCT_H 52 #define PSA_HASH_OPERATION_INIT {0} 64 #define PSA_MAC_OPERATION_INIT {0} 76 #define PSA_CIPHER_OPERATION_INIT {0} 88 #define PSA_AEAD_OPERATION_INIT {0} 100 #define PSA_KEY_DERIVATION_OPERATION_INIT {0} 109 typedef uint16_t psa_key_bits_t;
112 #define PSA_KEY_BITS_TOO_LARGE ( (psa_key_bits_t) ( -1 ) ) 118 #define PSA_MAX_KEY_BITS 0xfff8 120 #define PSA_KEY_ATTRIBUTES_INIT PSA_CLIENT_KEY_ATTRIBUTES_INIT 139 return( attributes->id );
145 attributes->lifetime = lifetime;
155 return( attributes->lifetime );
161 attributes->usage = usage_flags;
167 return( attributes->usage );
173 attributes->alg = alg;
179 return( attributes->alg );
185 attributes->type = type;
191 return( attributes->type );
197 if( bits > PSA_MAX_KEY_BITS )
198 attributes->bits = PSA_KEY_BITS_TOO_LARGE;
200 attributes->bits = bits;
206 return( attributes->bits );
static void psa_set_key_id(psa_key_attributes_t *attributes, psa_key_id_t id)
Declare a key as persistent and set its key identifier.
static psa_key_derivation_operation_t psa_key_derivation_operation_init(void)
Return an initial value for a key derivation operation object.
static void psa_set_key_bits(psa_key_attributes_t *attributes, size_t bits)
Declare the size of a key.
#define PSA_KEY_LIFETIME_VOLATILE
The default lifetime for volatile keys.
uint32_t psa_key_id_t
Encoding of identifiers of persistent keys.
static psa_algorithm_t psa_get_key_algorithm(const psa_key_attributes_t *attributes)
Retrieve the algorithm policy from key attributes.
static void psa_set_key_usage_flags(psa_key_attributes_t *attributes, psa_key_usage_t usage_flags)
Declare usage flags for a key.
static void psa_set_key_lifetime(psa_key_attributes_t *attributes, psa_key_lifetime_t lifetime)
Set the location of a persistent key.
static psa_hash_operation_t psa_hash_operation_init(void)
Return an initial value for a hash operation object.
static psa_key_lifetime_t psa_get_key_lifetime(const psa_key_attributes_t *attributes)
Retrieve the lifetime from key attributes.
static void psa_set_key_type(psa_key_attributes_t *attributes, psa_key_type_t type)
Declare the type of a key.
static psa_key_id_t psa_get_key_id(const psa_key_attributes_t *attributes)
Retrieve the key identifier from key attributes.
static size_t psa_get_key_bits(const psa_key_attributes_t *attributes)
Retrieve the key size from key attributes.
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
#define PSA_KEY_LIFETIME_PERSISTENT
The default lifetime for persistent keys.
static psa_cipher_operation_t psa_cipher_operation_init(void)
Return an initial value for a cipher operation object.
uint32_t psa_key_usage_t
Encoding of permitted usage on a key.
static void psa_set_key_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg)
Declare the permitted algorithm policy for a key.
uint16_t psa_key_type_t
Encoding of a key type.
static psa_aead_operation_t psa_aead_operation_init(void)
Return an initial value for an AEAD operation object.
static psa_key_type_t psa_get_key_type(const psa_key_attributes_t *attributes)
Retrieve the key type from key attributes.
static psa_key_usage_t psa_get_key_usage_flags(const psa_key_attributes_t *attributes)
Retrieve the usage flags from key attributes.
static psa_key_attributes_t psa_key_attributes_init(void)
Return an initial value for a key attributes structure.
uint32_t psa_key_lifetime_t
Encoding of key lifetimes.
static psa_mac_operation_t psa_mac_operation_init(void)
Return an initial value for a MAC operation object.