Go to the documentation of this file.
55 #ifndef PSA_CRYPTO_STRUCT_H
56 #define PSA_CRYPTO_STRUCT_H
64 #if !defined(MBEDTLS_CONFIG_FILE)
67 #include MBEDTLS_CONFIG_FILE
88 #if defined(MBEDTLS_MD2_C)
91 #if defined(MBEDTLS_MD4_C)
94 #if defined(MBEDTLS_MD5_C)
97 #if defined(MBEDTLS_RIPEMD160_C)
100 #if defined(MBEDTLS_SHA1_C)
103 #if defined(MBEDTLS_SHA256_C)
106 #if defined(MBEDTLS_SHA512_C)
112 #define PSA_HASH_OPERATION_INIT {0, {0}}
119 #if defined(MBEDTLS_MD_C)
141 #if defined(MBEDTLS_MD_C)
144 #if defined(MBEDTLS_CMAC_C)
150 #define PSA_MAC_OPERATION_INIT {0, 0, 0, 0, 0, 0, 0, {0}}
172 #define PSA_CIPHER_OPERATION_INIT {0, 0, 0, 0, 0, 0, {0}}
193 #define PSA_AEAD_OPERATION_INIT {0, 0, 0, 0, 0, {0}}
200 #if defined(MBEDTLS_MD_C)
208 #if PSA_HASH_MAX_SIZE > 0xff
209 #error "PSA_HASH_MAX_SIZE does not fit in uint8_t"
218 #if defined(MBEDTLS_MD_C)
230 #if PSA_HASH_MAX_SIZE > 0xff
231 #error "PSA_HASH_MAX_SIZE does not fit in uint8_t"
264 #if defined(MBEDTLS_MD_C)
272 #define PSA_KEY_DERIVATION_OPERATION_INIT {0, 0, 0, {0}}
287 #define PSA_KEY_POLICY_INIT {0, 0, 0}
299 #define PSA_KEY_BITS_TOO_LARGE ( (psa_key_bits_t) ( -1 ) )
305 #define PSA_MAX_KEY_BITS 0xfff8
316 #define MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER \
317 ( (psa_key_attributes_flag_t) 0x0001 )
321 #define MBEDTLS_PSA_KA_MASK_EXTERNAL_ONLY ( \
322 MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER | \
327 #define MBEDTLS_PSA_KA_MASK_DUAL_USE ( \
340 #define PSA_CORE_KEY_ATTRIBUTES_INIT {PSA_KEY_TYPE_NONE, 0, PSA_KEY_LIFETIME_VOLATILE, PSA_KEY_ID_INIT, PSA_KEY_POLICY_INIT, 0}
345 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
352 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
353 #define PSA_KEY_ATTRIBUTES_INIT {PSA_CORE_KEY_ATTRIBUTES_INIT, 0, NULL, 0}
355 #define PSA_KEY_ATTRIBUTES_INIT {PSA_CORE_KEY_ATTRIBUTES_INIT, NULL, 0}
375 return( attributes->
core.
id );
384 #ifdef MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER
385 attributes->
core.
id.key_id = 0;
386 attributes->
core.
id.owner = 0;
#define PSA_KEY_ATTRIBUTES_INIT
static psa_key_usage_t psa_get_key_usage_flags(const psa_key_attributes_t *attributes)
The SHA-1 context structure.
#define PSA_AEAD_OPERATION_INIT
int32_t psa_status_t
Function return status.
#define PSA_HMAC_MAX_HASH_BLOCK_SIZE
@ TLS12_PRF_STATE_SEED_SET
This file contains SHA-1 definitions and functions.
static struct psa_cipher_operation_s psa_cipher_operation_init(void)
#define PSA_MAC_OPERATION_INIT
This file contains the generic message-digest wrapper.
static void psa_set_key_id(psa_key_attributes_t *attributes, psa_key_id_t id)
mbedtls_sha512_context sha512
This file contains SHA-384 and SHA-512 definitions and functions.
static struct psa_aead_operation_s psa_aead_operation_init(void)
static struct psa_key_policy_s psa_key_policy_init(void)
RIPEMD-160 context structure.
struct psa_tls12_prf_key_derivation_s psa_tls12_prf_key_derivation_t
union psa_hash_operation_s::@4 ctx
uint8_t output_block[PSA_HASH_MAX_SIZE]
#define PSA_KEY_LIFETIME_VOLATILE
psa_core_key_attributes_t core
@ TLS12_PRF_STATE_KEY_SET
static void psa_set_key_type(psa_key_attributes_t *attributes, psa_key_type_t type)
static struct psa_key_derivation_s psa_key_derivation_operation_init(void)
psa_key_attributes_flag_t flags
static size_t psa_get_key_bits(const psa_key_attributes_t *attributes)
psa_hmac_internal_data hmac
static void psa_set_key_bits(psa_key_attributes_t *attributes, size_t bits)
unsigned int can_output_key
psa_hmac_internal_data hmac
union psa_key_derivation_s::@8 ctx
mbedtls_cipher_context_t cipher
The SHA-512 context structure.
static void psa_set_key_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg)
static void psa_set_key_lifetime(psa_key_attributes_t *attributes, psa_key_lifetime_t lifetime)
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
#define PSA_CIPHER_OPERATION_INIT
static psa_key_id_t psa_get_key_id(const psa_key_attributes_t *attributes)
mbedtls_cipher_context_t cipher
static psa_key_type_t psa_get_key_type(const psa_key_attributes_t *attributes)
uint64_t psa_key_slot_number_t
uint32_t psa_key_usage_t
Encoding of permitted usage on a key.
uint16_t psa_key_attributes_flag_t
psa_tls12_prf_key_derivation_state_t state
#define PSA_KEY_DERIVATION_OPERATION_INIT
#define PSA_KEY_POLICY_INIT
psa_hmac_internal_data hmac
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
#define PSA_KEY_LIFETIME_PERSISTENT
mbedtls_ripemd160_context ripemd160
RIPE MD-160 message digest.
static struct psa_mac_operation_s psa_mac_operation_init(void)
This file contains SHA-224 and SHA-256 definitions and functions.
mbedtls_sha256_context sha256
psa_tls12_prf_key_derivation_t tls12_prf
#define PSA_HASH_MAX_SIZE
uint16_t psa_key_type_t
Encoding of a key type.
MD4 message digest algorithm (hash function)
This file contains GCM definitions and functions.
MD5 message digest algorithm (hash function)
union psa_aead_operation_s::@7 ctx
MD2 message digest algorithm (hash function)
The SHA-256 context structure.
psa_key_lifetime_t lifetime
#define PSA_KEY_BITS_TOO_LARGE
union psa_cipher_operation_s::@6 ctx
psa_hkdf_key_derivation_t hkdf
size_t domain_parameters_size
Configuration options (set of defines)
static void psa_set_key_usage_flags(psa_key_attributes_t *attributes, psa_key_usage_t usage_flags)
#define PSA_HASH_OPERATION_INIT
static psa_algorithm_t psa_get_key_algorithm(const psa_key_attributes_t *attributes)
psa_status_t psa_set_key_domain_parameters(psa_key_attributes_t *attributes, psa_key_type_t type, const uint8_t *data, size_t data_length)
static struct psa_hash_operation_s psa_hash_operation_init(void)
union psa_mac_operation_s::@5 ctx
static struct psa_key_attributes_s psa_key_attributes_init(void)
static psa_key_lifetime_t psa_get_key_lifetime(const psa_key_attributes_t *attributes)
This file contains CMAC definitions and functions.
@ TLS12_PRF_STATE_LABEL_SET
uint32_t psa_key_lifetime_t
uint8_t Ai[PSA_HASH_MAX_SIZE]
psa_tls12_prf_key_derivation_state_t
mbedtls_sha1_context sha1