blob: 191e4c4f416268d58d05f26225b7e3cf14144376 [file] [log] [blame]
Yanray Wangb153aae2023-09-06 12:32:10 +08001/**
2 * \file config-tfm.h
3 *
Gilles Peskinee23fa412023-09-06 17:16:36 +02004 * \brief TF-M medium profile, adapted to work on other platforms.
Yanray Wangb153aae2023-09-06 12:32:10 +08005 */
6/*
7 * Copyright The Mbed TLS Contributors
Yanray Wang8636d472023-11-08 10:07:01 +08008 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Yanray Wangb153aae2023-09-06 12:32:10 +08009 */
10
Gilles Peskinee23fa412023-09-06 17:16:36 +020011/* TF-M medium profile: mbedtls legacy configuration */
Yanray Wang4419d382023-09-07 11:28:27 +080012#include "../configs/ext/tfm_mbedcrypto_config_profile_medium.h"
Yanray Wangb153aae2023-09-06 12:32:10 +080013
Gilles Peskinee23fa412023-09-06 17:16:36 +020014/* TF-M medium profile: PSA crypto configuration */
Yanray Wangb153aae2023-09-06 12:32:10 +080015#define MBEDTLS_PSA_CRYPTO_CONFIG_FILE "../configs/ext/crypto_config_profile_medium.h"
Yanray Wang0c98f9f2023-09-06 15:47:49 +080016
Gilles Peskinee23fa412023-09-06 17:16:36 +020017/***********************************************************/
18/* Tweak the configuration to remove dependencies on TF-M. */
19/***********************************************************/
Yanray Wang0c98f9f2023-09-06 15:47:49 +080020
Gilles Peskinee23fa412023-09-06 17:16:36 +020021/* MBEDTLS_PSA_CRYPTO_SPM needs third-party files, so disable it. */
Yanray Wang0c98f9f2023-09-06 15:47:49 +080022#undef MBEDTLS_PSA_CRYPTO_SPM
Gilles Peskinee23fa412023-09-06 17:16:36 +020023
24/* TF-M provides its own dummy implementations to save code size.
25 * We don't have any way to disable the tests that need these feature,
Yanray Wang4419d382023-09-07 11:28:27 +080026 * so we just keep AES decryption enabled. We will resolve this through
Gilles Peskinee23fa412023-09-06 17:16:36 +020027 * an official way to disable AES decryption, then this deviation
28 * will no longer be needed:
29 * https://github.com/Mbed-TLS/mbedtls/issues/7368
30 */
Yanray Wang0c98f9f2023-09-06 15:47:49 +080031#undef MBEDTLS_AES_SETKEY_DEC_ALT
32#undef MBEDTLS_AES_DECRYPT_ALT
Yanray Wang0c98f9f2023-09-06 15:47:49 +080033
Gilles Peskinee23fa412023-09-06 17:16:36 +020034/* Use built-in platform entropy functions (TF-M provides its own). */
Yanray Wang0c98f9f2023-09-06 15:47:49 +080035#undef MBEDTLS_NO_PLATFORM_ENTROPY
Gilles Peskinee23fa412023-09-06 17:16:36 +020036
37/* Disable buffer-based memory allocator. This isn't strictly required,
38 * but using the native allocator is faster and works better with
39 * memory management analysis frameworks such as ASan. */
Yanray Wang0c98f9f2023-09-06 15:47:49 +080040#undef MBEDTLS_MEMORY_BUFFER_ALLOC_C