49#ifndef PSA_CRYPTO_STRUCT_H
50#define PSA_CRYPTO_STRUCT_H
71#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
72 mbedtls_psa_client_handle_t handle;
84#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
85#define PSA_HASH_OPERATION_INIT { 0 }
87#define PSA_HASH_OPERATION_INIT { 0, { 0 } }
96#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
97 mbedtls_psa_client_handle_t handle;
116#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
117#define PSA_CIPHER_OPERATION_INIT { 0 }
119#define PSA_CIPHER_OPERATION_INIT { 0, 0, 0, 0, { 0 } }
132#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
133 mbedtls_psa_client_handle_t handle;
148#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
149#define PSA_MAC_OPERATION_INIT { 0 }
151#define PSA_MAC_OPERATION_INIT { 0, 0, 0, { 0 } }
160#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
161 mbedtls_psa_client_handle_t handle;
187#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
188#define PSA_AEAD_OPERATION_INIT { 0 }
190#define PSA_AEAD_OPERATION_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0 } }
203#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
204 mbedtls_psa_client_handle_t handle;
213#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
214#define PSA_KEY_DERIVATION_OPERATION_INIT { 0 }
217#define PSA_KEY_DERIVATION_OPERATION_INIT { 0, 0, 0, { 0 } }
240#define PSA_KEY_PRODUCTION_PARAMETERS_INIT { 0 }
249#define PSA_KEY_POLICY_INIT { 0, 0, 0 }
261#define PSA_KEY_BITS_TOO_LARGE ((psa_key_bits_t) -1)
267#define PSA_MAX_KEY_BITS 0xfff8
270#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
292#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
293#define PSA_KEY_ATTRIBUTES_MAYBE_SLOT_NUMBER 0, 0,
295#define PSA_KEY_ATTRIBUTES_MAYBE_SLOT_NUMBER
297#define PSA_KEY_ATTRIBUTES_INIT { PSA_KEY_ATTRIBUTES_MAYBE_SLOT_NUMBER \
298 PSA_KEY_TYPE_NONE, 0, \
299 PSA_KEY_LIFETIME_VOLATILE, \
300 PSA_KEY_POLICY_INIT, \
301 MBEDTLS_SVC_KEY_ID_INIT }
314 attributes->MBEDTLS_PRIVATE(
id) = key;
317 attributes->MBEDTLS_PRIVATE(lifetime) =
327 return attributes->MBEDTLS_PRIVATE(
id);
330#ifdef MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
332 mbedtls_key_owner_id_t owner)
334 attributes->MBEDTLS_PRIVATE(
id).MBEDTLS_PRIVATE(owner) = owner;
341 attributes->MBEDTLS_PRIVATE(lifetime) = lifetime;
343#ifdef MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
344 attributes->MBEDTLS_PRIVATE(
id).MBEDTLS_PRIVATE(key_id) = 0;
346 attributes->MBEDTLS_PRIVATE(
id) = 0;
354 return attributes->MBEDTLS_PRIVATE(lifetime);
372 attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(usage) = usage_flags;
378 return attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(usage);
384 attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg) = alg;
390 return attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg);
396 attributes->MBEDTLS_PRIVATE(type) = type;
402 return attributes->MBEDTLS_PRIVATE(type);
418 return attributes->MBEDTLS_PRIVATE(bits);
425#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
426 mbedtls_psa_client_handle_t handle;
444#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
445#define PSA_SIGN_HASH_INTERRUPTIBLE_OPERATION_INIT { 0 }
447#define PSA_SIGN_HASH_INTERRUPTIBLE_OPERATION_INIT { 0, { 0 }, 0, 0 }
463#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
464 mbedtls_psa_client_handle_t handle;
482#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
483#define PSA_VERIFY_HASH_INTERRUPTIBLE_OPERATION_INIT { 0 }
485#define PSA_VERIFY_HASH_INTERRUPTIBLE_OPERATION_INIT { 0, { 0 }, 0, 0 }
#define PSA_KEY_BITS_TOO_LARGE
static struct psa_sign_hash_interruptible_operation_s psa_sign_hash_interruptible_operation_init(void)
static void psa_set_key_usage_flags(psa_key_attributes_t *attributes, psa_key_usage_t usage_flags)
static struct psa_aead_operation_s psa_aead_operation_init(void)
static struct psa_verify_hash_interruptible_operation_s psa_verify_hash_interruptible_operation_init(void)
static size_t psa_get_key_bits(const psa_key_attributes_t *attributes)
#define PSA_KEY_POLICY_INIT
static void psa_set_key_type(psa_key_attributes_t *attributes, psa_key_type_t type)
static struct psa_key_attributes_s psa_key_attributes_init(void)
static struct psa_cipher_operation_s psa_cipher_operation_init(void)
static struct psa_key_derivation_s psa_key_derivation_operation_init(void)
static psa_key_lifetime_t psa_get_key_lifetime(const psa_key_attributes_t *attributes)
static psa_key_usage_t psa_get_key_usage_flags(const psa_key_attributes_t *attributes)
static void psa_extend_key_usage_flags(psa_key_usage_t *usage_flags)
static struct psa_mac_operation_s psa_mac_operation_init(void)
static void psa_set_key_lifetime(psa_key_attributes_t *attributes, psa_key_lifetime_t lifetime)
static psa_algorithm_t psa_get_key_algorithm(const psa_key_attributes_t *attributes)
static struct psa_hash_operation_s psa_hash_operation_init(void)
static void psa_set_key_id(psa_key_attributes_t *attributes, mbedtls_svc_key_id_t key)
static psa_key_type_t psa_get_key_type(const psa_key_attributes_t *attributes)
#define PSA_SIGN_HASH_INTERRUPTIBLE_OPERATION_INIT
static void psa_set_key_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg)
#define PSA_VERIFY_HASH_INTERRUPTIBLE_OPERATION_INIT
static void psa_set_key_bits(psa_key_attributes_t *attributes, size_t bits)
static mbedtls_svc_key_id_t psa_get_key_id(const psa_key_attributes_t *attributes)
static struct psa_key_policy_s psa_key_policy_init(void)
#define PSA_MAC_OPERATION_INIT
#define PSA_AEAD_OPERATION_INIT
#define PSA_KEY_ATTRIBUTES_INIT
#define PSA_CIPHER_OPERATION_INIT
uint16_t psa_key_type_t
Encoding of a key type.
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
#define PSA_HASH_OPERATION_INIT
#define PSA_KEY_DERIVATION_OPERATION_INIT
#define PSA_KEY_LIFETIME_PERSISTENT
#define PSA_KEY_LIFETIME_GET_LOCATION(lifetime)
#define PSA_KEY_LIFETIME_IS_VOLATILE(lifetime)
uint32_t psa_key_lifetime_t
psa_key_id_t mbedtls_svc_key_id_t
#define PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(persistence, location)
#define PSA_KEY_USAGE_SIGN_HASH
#define PSA_KEY_USAGE_SIGN_MESSAGE
uint32_t psa_key_usage_t
Encoding of permitted usage on a key.
#define PSA_KEY_USAGE_VERIFY_MESSAGE
#define PSA_KEY_USAGE_VERIFY_HASH
uint64_t psa_key_slot_number_t
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
Build-time PSA configuration info.
The context for PSA interruptible hash signing.
The context for PSA interruptible hash verification.