Mbed TLS v3.5.0
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
19  *
20  * Licensed under the Apache License, Version 2.0 (the "License"); you may
21  * not use this file except in compliance with the License.
22  * You may obtain a copy of the License at
23  *
24  * http://www.apache.org/licenses/LICENSE-2.0
25  *
26  * Unless required by applicable law or agreed to in writing, software
27  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
28  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29  * See the License for the specific language governing permissions and
30  * limitations under the License.
31  */
32 
33 #ifndef PSA_CRYPTO_TYPES_H
34 #define PSA_CRYPTO_TYPES_H
35 
36 /* Make sure the Mbed TLS configuration is visible. */
37 #include "mbedtls/build_info.h"
38 /* Define the MBEDTLS_PRIVATE macro. */
39 #include "mbedtls/private_access.h"
40 
41 #if defined(MBEDTLS_PSA_CRYPTO_PLATFORM_FILE)
42 #include MBEDTLS_PSA_CRYPTO_PLATFORM_FILE
43 #else
44 #include "crypto_platform.h"
45 #endif
46 
47 #include <stdint.h>
48 
59 /* If #PSA_SUCCESS is already defined, it means that #psa_status_t
60  * is also defined in an external header, so prevent its multiple
61  * definition.
62  */
63 #ifndef PSA_SUCCESS
64 typedef int32_t psa_status_t;
65 #endif
66 
83 typedef uint16_t psa_key_type_t;
84 
102 typedef uint8_t psa_ecc_family_t;
103 
121 typedef uint8_t psa_dh_family_t;
122 
139 typedef uint32_t psa_algorithm_t;
140 
188 typedef uint32_t psa_key_lifetime_t;
189 
224 typedef uint8_t psa_key_persistence_t;
225 
265 typedef uint32_t psa_key_location_t;
266 
280 typedef uint32_t psa_key_id_t;
281 
296 #if !defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
298 
299 #else /* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER */
300 /* Implementation-specific: The Mbed TLS library can be built as
301  * part of a multi-client service that exposes the PSA Cryptography API in each
302  * client and encodes the client identity in the key identifier argument of
303  * functions such as psa_open_key().
304  */
305 typedef struct {
307  mbedtls_key_owner_id_t MBEDTLS_PRIVATE(owner);
309 
310 #endif /* !MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER */
311 
328 typedef uint32_t psa_key_usage_t;
329 
438 
439 
440 #ifndef __DOXYGEN_ONLY__
441 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
442 /* Mbed TLS defines this type in crypto_types.h because it is also
443  * visible to applications through an implementation-specific extension.
444  * For the PSA Cryptography specification, this type is only visible
445  * via crypto_se_driver.h. */
446 typedef uint64_t psa_key_slot_number_t;
447 #endif /* MBEDTLS_PSA_CRYPTO_SE_C */
448 #endif /* !__DOXYGEN_ONLY__ */
449 
461 typedef uint16_t psa_key_derivation_step_t;
462 
465 #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:83
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: crypto_types.h:139
uint8_t psa_ecc_family_t
Definition: crypto_types.h:102
uint8_t psa_dh_family_t
Definition: crypto_types.h:121
uint16_t psa_key_derivation_step_t
Encoding of the step of a key derivation.
Definition: crypto_types.h:461
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:64
uint32_t psa_key_id_t
Definition: crypto_types.h:280
uint8_t psa_key_persistence_t
Definition: crypto_types.h:224
uint32_t psa_key_location_t
Definition: crypto_types.h:265
uint32_t psa_key_lifetime_t
Definition: crypto_types.h:188
psa_key_id_t mbedtls_svc_key_id_t
Definition: crypto_types.h:297
uint32_t psa_key_usage_t
Encoding of permitted usage on a key.
Definition: crypto_types.h:328
uint64_t psa_key_slot_number_t
Build-time configuration info.
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)