1 /*
2  * Copyright (c) 2022-2024, Arm Ltd. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef PLAT_TC_MBEDTLS_CONFIG_H
8 #define PLAT_TC_MBEDTLS_CONFIG_H
9 
10 #include <export/lib/utils_def_exp.h>
11 #include <mbedtls_config-3.h>
12 
13 #ifndef TF_MBEDTLS_HEAP_SIZE
14 #error TF_MBEDTLS_HEAP_SIZE is not defined
15 #else
16 #define PLATFORM_TEST_MIN_MBEDTLS_HEAP_SIZE	(8 * 1024)
17 /* Only change heap size if it is less then the minimum required. */
18 #if TF_MBEDTLS_HEAP_SIZE < PLATFORM_TEST_MIN_MBEDTLS_HEAP_SIZE
19 #undef TF_MBEDTLS_HEAP_SIZE
20 #define TF_MBEDTLS_HEAP_SIZE	PLATFORM_TEST_MIN_MBEDTLS_HEAP_SIZE
21 #endif
22 #endif /* TF_MBEDTLS_HEAP_SIZE */
23 
24 /**
25  * On Arm TC platforms, the ROTPK is always hashed using the SHA-256
26  * algorithm.
27  * TODO: Update to hash the ROTPK with the selected HASH_ALG to avoid
28  * the need for explicitly enabling the SHA-256 configuration in mbedTLS.
29  */
30 #define MBEDTLS_SHA256_C
31 
32 /*
33  * Use an implementation of SHA-256 with a smaller memory footprint
34  * but reduced speed.
35  */
36 #define MBEDTLS_SHA256_SMALLER
37 
38 #define MBEDTLS_PSA_CRYPTO_C
39 #define MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
40 #define MBEDTLS_ECP_C
41 #define MBEDTLS_ECP_DP_SECP384R1_ENABLED
42 #define MBEDTLS_ECP_NO_INTERNAL_RNG
43 
44 #endif /* PLAT_TC_MBEDTLS_CONFIG_H */
45