blob: 5e6180e364f725d387e978ea59c3db002eb84dd9 [file] [log] [blame]
Gilles Peskinee59236f2018-01-27 23:32:46 +01001/**
2 * \file psa/crypto_platform.h
3 *
Jaeden Amero95d84382019-05-30 13:14:00 +01004 * \brief PSA cryptography module: Mbed TLS platform definitions
Gilles Peskine07c91f52018-06-28 18:02:53 +02005 *
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.
Gilles Peskinee59236f2018-01-27 23:32:46 +010015 */
16/*
Bence Szépkúti1e148272020-08-07 13:07:28 +020017 * Copyright The Mbed TLS Contributors
Gilles Peskinee59236f2018-01-27 23:32:46 +010018 * 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.
Gilles Peskinee59236f2018-01-27 23:32:46 +010031 */
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)
Jaeden Amerod58a00d2019-06-07 11:49:59 +010039#include "mbedtls/config.h"
Gilles Peskinee59236f2018-01-27 23:32:46 +010040#else
41#include MBEDTLS_CONFIG_FILE
42#endif
43
44/* PSA requires several types which C99 provides in stdint.h. */
45#include <stdint.h>
46
Gilles Peskinef535eb22018-11-30 14:08:36 +010047/* Integral type representing a key handle. */
48typedef uint16_t psa_key_handle_t;
49
Gilles Peskine69d7c8b2019-02-19 14:00:31 +010050#if defined(MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER)
51
Gilles Peskine572f0672019-02-19 14:16:17 +010052#if defined(PSA_CRYPTO_SECURE)
53/* Building for the PSA Crypto service on a PSA platform. */
54/* A key owner is a PSA partition identifier. */
Ronald Cron72f65fc2020-09-01 15:50:17 +020055typedef int32_t mbedtls_key_owner_id_t;
Gilles Peskine572f0672019-02-19 14:16:17 +010056#endif
57
Ronald Cron80b95102020-08-28 14:29:16 +020058#endif /* MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER */
Gilles Peskine69d7c8b2019-02-19 14:00:31 +010059
Gilles Peskinee59236f2018-01-27 23:32:46 +010060#endif /* PSA_CRYPTO_PLATFORM_H */