Mbed TLS v4.1.1
Loading...
Searching...
No Matches
crypto_platform.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_PLATFORM_H
22#define PSA_CRYPTO_PLATFORM_H
23#include "mbedtls/private_access.h"
25
26/* PSA requires several types which C99 provides in stdint.h. */
27#include <stdint.h>
28
29#if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
30
31/* Building for the PSA Crypto service on a PSA platform, a key owner is a PSA
32 * partition identifier.
33 *
34 * The function psa_its_identifier_of_slot() in psa_crypto_storage.c that
35 * translates a key identifier to a key storage file name assumes that
36 * mbedtls_key_owner_id_t is a 32-bit integer. This function thus needs
37 * reworking if mbedtls_key_owner_id_t is not defined as a 32-bit integer
38 * here anymore.
39 */
40typedef int32_t mbedtls_key_owner_id_t;
41
49static inline int mbedtls_key_owner_id_equal(mbedtls_key_owner_id_t id1,
50 mbedtls_key_owner_id_t id2)
51{
52 return id1 == id2;
53}
54
55#endif /* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER */
56
57/*
58 * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM
59 * (Secure Partition Manager) integration which separates the code into two
60 * parts: NSPE (Non-Secure Processing Environment) and SPE (Secure Processing
61 * Environment). When building for the SPE, an additional header file should be
62 * included.
63 */
64#if defined(MBEDTLS_PSA_CRYPTO_SPM)
65#define PSA_CRYPTO_SECURE 1
66#include "crypto_spe.h"
67#endif // MBEDTLS_PSA_CRYPTO_SPM
68
69#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
79typedef struct {
80 uintptr_t MBEDTLS_PRIVATE(opaque)[2];
81} mbedtls_psa_external_random_context_t;
82#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
83
84#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
91typedef uint32_t mbedtls_psa_client_handle_t;
92#endif
93
94#endif /* PSA_CRYPTO_PLATFORM_H */
Build-time configuration info.