Mbed TLS v2.28.9
crypto_types.h
Go to the documentation of this file.
1 
16 /*
17  * Copyright The Mbed TLS Contributors
18  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
19  */
20 
21 #ifndef PSA_CRYPTO_TYPES_H
22 #define PSA_CRYPTO_TYPES_H
23 
24 #include "crypto_platform.h"
25 
26 /* If MBEDTLS_PSA_CRYPTO_C is defined, make sure MBEDTLS_PSA_CRYPTO_CLIENT
27  * is defined as well to include all PSA code.
28  */
29 #if defined(MBEDTLS_PSA_CRYPTO_C)
30 #define MBEDTLS_PSA_CRYPTO_CLIENT
31 #endif /* MBEDTLS_PSA_CRYPTO_C */
32 
33 #include <stdint.h>
34 
45 /* If #PSA_SUCCESS is already defined, it means that #psa_status_t
46  * is also defined in an external header, so prevent its multiple
47  * definition.
48  */
49 #ifndef PSA_SUCCESS
50 typedef int32_t psa_status_t;
51 #endif
52 
69 typedef uint16_t psa_key_type_t;
70 
88 typedef uint8_t psa_ecc_family_t;
89 
107 typedef uint8_t psa_dh_family_t;
108 
125 typedef uint32_t psa_algorithm_t;
126 
174 typedef uint32_t psa_key_lifetime_t;
175 
210 typedef uint8_t psa_key_persistence_t;
211 
251 typedef uint32_t psa_key_location_t;
252 
266 typedef uint32_t psa_key_id_t;
267 
282 #if !defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
284 
285 #else /* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER */
286 /* Implementation-specific: The Mbed TLS library can be built as
287  * part of a multi-client service that exposes the PSA Cryptography API in each
288  * client and encodes the client identity in the key identifier argument of
289  * functions such as psa_open_key().
290  */
291 typedef struct {
292  psa_key_id_t key_id;
293  mbedtls_key_owner_id_t owner;
295 
296 #endif /* !MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER */
297 
314 typedef uint32_t psa_key_usage_t;
315 
424 
425 
426 #ifndef __DOXYGEN_ONLY__
427 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
428 /* Mbed TLS defines this type in crypto_types.h because it is also
429  * visible to applications through an implementation-specific extension.
430  * For the PSA Cryptography specification, this type is only visible
431  * via crypto_se_driver.h. */
432 typedef uint64_t psa_key_slot_number_t;
433 #endif /* MBEDTLS_PSA_CRYPTO_SE_C */
434 #endif /* !__DOXYGEN_ONLY__ */
435 
447 typedef uint16_t psa_key_derivation_step_t;
448 
451 #endif /* PSA_CRYPTO_TYPES_H */
PSA cryptography module: Mbed TLS platform definitions.
uint16_t psa_key_type_t
Encoding of a key type.
Definition: crypto_types.h:69
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: crypto_types.h:125
uint8_t psa_ecc_family_t
Definition: crypto_types.h:88
uint8_t psa_dh_family_t
Definition: crypto_types.h:107
uint16_t psa_key_derivation_step_t
Encoding of the step of a key derivation.
Definition: crypto_types.h:447
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:50
uint32_t psa_key_id_t
Definition: crypto_types.h:266
uint8_t psa_key_persistence_t
Definition: crypto_types.h:210
uint32_t psa_key_location_t
Definition: crypto_types.h:251
uint32_t psa_key_lifetime_t
Definition: crypto_types.h:174
psa_key_id_t mbedtls_svc_key_id_t
Definition: crypto_types.h:283
uint32_t psa_key_usage_t
Encoding of permitted usage on a key.
Definition: crypto_types.h:314
uint64_t psa_key_slot_number_t