Mistake on this page?
Report an issue in GitHub or email us
TARGET_MBED_PSA_SRV/inc/psa/crypto_platform.h
1 /**
2  * \file psa/crypto_platform.h
3  *
4  * \brief PSA cryptography module: Mbed TLS platform definitions
5  *
6  * \note This file may not be included directly. Applications must
7  * include psa/crypto.h.
8  *
9  * This file contains platform-dependent type definitions.
10  *
11  * In implementations with isolation between the application and the
12  * cryptography module, implementers should take care to ensure that
13  * the definitions that are exposed to applications match what the
14  * module implements.
15  */
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_PLATFORM_H
34 #define PSA_CRYPTO_PLATFORM_H
35 
36 /* Include the Mbed TLS configuration file, the way Mbed TLS does it
37  * in each of its header files. */
38 #if !defined(MBEDTLS_CONFIG_FILE)
39 #include "mbedtls/config.h"
40 #else
41 #include MBEDTLS_CONFIG_FILE
42 #endif
43 
44 /* Translate between classic MBEDTLS_xxx feature symbols and PSA_xxx
45  * feature symbols. */
46 #include "mbedtls/config_psa.h"
47 
48 /* PSA requires several types which C99 provides in stdint.h. */
49 #include <stdint.h>
50 
51 #if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
52  !defined(inline) && !defined(__cplusplus)
53 #define inline __inline
54 #endif
55 
56 #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
57 
58 /* Building for the PSA Crypto service on a PSA platform, a key owner is a PSA
59  * partition identifier.
60  *
61  * The function psa_its_identifier_of_slot() in psa_crypto_storage.c that
62  * translates a key identifier to a key storage file name assumes that
63  * mbedtls_key_owner_id_t is an 32 bits integer. This function thus needs
64  * reworking if mbedtls_key_owner_id_t is not defined as a 32 bits integer
65  * here anymore.
66  */
67 typedef int32_t mbedtls_key_owner_id_t;
68 
69 /** Compare two key owner identifiers.
70  *
71  * \param id1 First key owner identifier.
72  * \param id2 Second key owner identifier.
73  *
74  * \return Non-zero if the two key owner identifiers are equal, zero otherwise.
75  */
76 static inline int mbedtls_key_owner_id_equal( mbedtls_key_owner_id_t id1,
77  mbedtls_key_owner_id_t id2 )
78 {
79  return( id1 == id2 );
80 }
81 
82 #endif /* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER */
83 
84 #endif /* PSA_CRYPTO_PLATFORM_H */
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.