blob: 64dce487408f0ee7b5b863ff0fb1d9c5c9b5e295 [file] [log] [blame]
Yanray Wangb153aae2023-09-06 12:32:10 +08001/**
2 * \file config-tfm.h
3 *
4 * \brief TF-M configuration with tweaks for a successful build and test.
5 */
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22
23/* TF-M Configuration Options */
24#include "../configs/ext/tfm_mbedcrypto_config_profile_medium.h"
25
26/* TF-M PSA Crypto Configuration */
27#define MBEDTLS_PSA_CRYPTO_CONFIG_FILE "../configs/ext/crypto_config_profile_medium.h"
Yanray Wang0c98f9f2023-09-06 15:47:49 +080028
29/*****************************************************************************/
30/* Tweak configuration based on TF-M config for a successful build and test. */
31/*****************************************************************************/
32
33/* MBEDTLS_PSA_CRYPTO_SPM needs third party files, so disable it. */
34#undef MBEDTLS_PSA_CRYPTO_SPM
35/* TF-M provides its own (dummy) implemenations which Mbed TLS doesn't need. */
36#undef MBEDTLS_AES_SETKEY_DEC_ALT
37#undef MBEDTLS_AES_DECRYPT_ALT
Gilles Peskineda26a512023-09-06 17:15:49 +020038/* The configuration we have enables MBEDTLS_PK_PARSE_C and MBEDTLS_PK_WRITE_C
39 * but not MBEDTLS_OID_C. This is inconsistent, and leads to a link error
40 * when using one of the mbedtls_pk_parse_xxx or mbedtls_pk_write_xxx
41 * functions that depend on an mbedtls_oid_xxx function.
42 * Mbed TLS needs PK parse/write for RSA with PSA, but the medium
43 * profile doesn't have RSA. Later versions of TF-M no longer enable
44 * PK parse/write: it wasn't a wanted feature. So disable it here
45 * (otherwise we'd have to enable MBEDTLS_OID_C).
46 */
47#undef MBEDTLS_PK_PARSE_C
48#undef MBEDTLS_PK_WRITE_C
Yanray Wang0c98f9f2023-09-06 15:47:49 +080049
Yanray Wang0c98f9f2023-09-06 15:47:49 +080050/* Use built-in platform entropy functions. */
51#undef MBEDTLS_NO_PLATFORM_ENTROPY
52/* Disable buffer-based memory allocator */
53#undef MBEDTLS_MEMORY_BUFFER_ALLOC_C