Mbed OS Reference
Loading...
Searching...
No Matches
platform_mbed.h
1/**
2 * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * This file is part of mbed TLS (https://tls.mbed.org)
18 */
19
20
21#ifndef __PLATFORM_MBED__H__
22#define __PLATFORM_MBED__H__
23
24// Create doxygen group for mbedtls
25/** \defgroup public-crypto Cryptography
26 * \ingroup mbed-os-public
27 */
28
29/**
30 * \defgroup mbedtls Mbed TLS
31 * \ingroup public-crypto
32 */
33
34#if CONFIG_MBEDTLS_ENTROPY_NV_SEED
35#define MBEDTLS_ENTROPY_NV_SEED
36#endif
37
38#if defined(FEATURE_EXPERIMENTAL_API) && defined(FEATURE_PSA)
39
40#if defined(MBEDTLS_ENTROPY_NV_SEED)
41
42#include "default_random_seed.h"
43
44#if !defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO)
45#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbed_default_seed_read
46#endif
47
48#if !defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO)
49#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbed_default_seed_write
50#endif
51
52/* Automatically enable the Mbed Crypto entropy injection API if
53 * MBEDTLS_ENTROPY_NV_SEED is enabled. */
54#define MBEDTLS_PSA_INJECT_ENTROPY
55
56#endif // defined(MBEDTLS_ENTROPY_NV_SEED)
57
58/* The following configurations are a needed for Mbed Crypto submodule.
59 * They are related to the persistent key storage feature.
60 */
61#define MBEDTLS_PSA_CRYPTO_STORAGE_C
62#define MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C
63#undef MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C
64
65#define MBEDTLS_ENTROPY_HARDWARE_ALT
66
67#endif // defined(FEATURE_EXPERIMENTAL_API) && defined(FEATURE_PSA)
68
69#if DEVICE_TRNG
70#if !defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
71#define MBEDTLS_ENTROPY_HARDWARE_ALT
72#endif
73#endif
74
75#if defined(MBEDTLS_CONFIG_HW_SUPPORT)
76#include "mbedtls_device.h"
77#endif
78
79/*
80 * MBEDTLS_ERR_PLATFORM_HW_FAILED is deprecated and should not be used.
81 */
82#define MBEDTLS_ERR_PLATFORM_HW_FAILED -0x0080
83
84#define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED -0x0070
85
86#endif // __PLATFORM_MBED__H__