blob: d987b6331323ad23a2911f5e7e19f9853082b820 [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
Gilles Peskinee23fa412023-09-06 17:16:36 +020024/* Use built-in platform entropy functions (TF-M provides its own). */
Yanray Wang0c98f9f2023-09-06 15:47:49 +080025#undef MBEDTLS_NO_PLATFORM_ENTROPY
Gilles Peskinee23fa412023-09-06 17:16:36 +020026
27/* Disable buffer-based memory allocator. This isn't strictly required,
28 * but using the native allocator is faster and works better with
29 * memory management analysis frameworks such as ASan. */
Yanray Wang0c98f9f2023-09-06 15:47:49 +080030#undef MBEDTLS_MEMORY_BUFFER_ALLOC_C
Dave Rodgman4edcf692023-11-15 12:23:29 +000031
32// This macro is enabled in TFM Medium but is disabled here because it is
33// incompatible with baremetal builds in Mbed TLS.
34#undef MBEDTLS_PSA_CRYPTO_STORAGE_C
35
36// This macro is enabled in TFM Medium but is disabled here because it is
37// incompatible with baremetal builds in Mbed TLS.
38#undef MBEDTLS_ENTROPY_NV_SEED
39
40// These platform-related TF-M settings are not useful here.
41#undef MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
42#undef MBEDTLS_PLATFORM_STD_MEM_HDR
43#undef MBEDTLS_PLATFORM_SNPRINTF_MACRO
44#undef MBEDTLS_PLATFORM_PRINTF_ALT
45#undef MBEDTLS_PLATFORM_STD_EXIT_SUCCESS
46#undef MBEDTLS_PLATFORM_STD_EXIT_FAILURE
47
48// We expect TF-M to pick this up soon
49#define MBEDTLS_BLOCK_CIPHER_NO_DECRYPT
50
51/***********************************************************************
52 * Local changes to crypto config below this delimiter
53 **********************************************************************/
54
55/* Between Mbed TLS 3.4 and 3.5, the PSA_WANT_KEY_TYPE_RSA_KEY_PAIR macro
56 * (commented-out above) has been replaced with the following new macros: */
57//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
58//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
59//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
60//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1
61//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE 1 /* Not supported */
62
63/* Between Mbed TLS 3.4 and 3.5, the following macros have been added: */
64//#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC 1
65//#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
66//#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
67//#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE 1
68//#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_DERIVE 1 // Not supported