blob: 96587acae2101d0bbda34d16eb819fceb6367f98 [file] [log] [blame]
Juan Castilloa57a4d52015-04-02 15:44:20 +01001/*
dp-arm52b1fe52017-03-07 10:08:42 +00002 * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
Juan Castilloa57a4d52015-04-02 15:44:20 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Juan Castilloa57a4d52015-04-02 15:44:20 +01005 */
6#ifndef __MBEDTLS_CONFIG_H__
7#define __MBEDTLS_CONFIG_H__
8
9/*
Juan Castillobae6b2a2015-11-05 09:24:53 +000010 * Key algorithms currently supported on mbed TLS libraries
Juan Castilloa57a4d52015-04-02 15:44:20 +010011 */
Qixiang Xu1c2aef12017-08-24 15:12:20 +080012#define TF_MBEDTLS_RSA 1
13#define TF_MBEDTLS_ECDSA 2
Qixiang Xuaa05eea2017-08-24 15:26:39 +080014#define TF_MBEDTLS_RSA_AND_ECDSA 3
Juan Castilloa57a4d52015-04-02 15:44:20 +010015
16/*
Juan Castillobae6b2a2015-11-05 09:24:53 +000017 * Configuration file to build mbed TLS with the required features for
Juan Castilloa57a4d52015-04-02 15:44:20 +010018 * Trusted Boot
19 */
20
Juan Castillobae6b2a2015-11-05 09:24:53 +000021#define MBEDTLS_PLATFORM_MEMORY
22#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
Antonio Nino Diaz6b90f5e2017-05-19 11:37:22 +010023/* Prevent mbed TLS from using snprintf so that it can use tf_snprintf. */
24#define MBEDTLS_PLATFORM_SNPRINTF_ALT
Juan Castilloa57a4d52015-04-02 15:44:20 +010025
Soby Mathew0a68d132017-05-31 10:35:27 +010026#if !ERROR_DEPRECATED
Juan Castillobae6b2a2015-11-05 09:24:53 +000027#define MBEDTLS_PKCS1_V15
Soby Mathew0a68d132017-05-31 10:35:27 +010028#endif
Juan Castillobae6b2a2015-11-05 09:24:53 +000029#define MBEDTLS_PKCS1_V21
Juan Castilloa57a4d52015-04-02 15:44:20 +010030
Juan Castillobae6b2a2015-11-05 09:24:53 +000031#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
32#define MBEDTLS_X509_CHECK_KEY_USAGE
33#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
Juan Castilloa57a4d52015-04-02 15:44:20 +010034
Juan Castillobae6b2a2015-11-05 09:24:53 +000035#define MBEDTLS_ASN1_PARSE_C
36#define MBEDTLS_ASN1_WRITE_C
Juan Castilloa57a4d52015-04-02 15:44:20 +010037
Juan Castillobae6b2a2015-11-05 09:24:53 +000038#define MBEDTLS_BASE64_C
39#define MBEDTLS_BIGNUM_C
Juan Castilloa57a4d52015-04-02 15:44:20 +010040
Juan Castillobae6b2a2015-11-05 09:24:53 +000041#define MBEDTLS_ERROR_C
42#define MBEDTLS_MD_C
Juan Castilloa57a4d52015-04-02 15:44:20 +010043
Juan Castillobae6b2a2015-11-05 09:24:53 +000044#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
45#define MBEDTLS_OID_C
Juan Castilloa57a4d52015-04-02 15:44:20 +010046
Juan Castillobae6b2a2015-11-05 09:24:53 +000047#define MBEDTLS_PK_C
48#define MBEDTLS_PK_PARSE_C
49#define MBEDTLS_PK_WRITE_C
Juan Castilloa57a4d52015-04-02 15:44:20 +010050
Juan Castillobae6b2a2015-11-05 09:24:53 +000051#define MBEDTLS_PLATFORM_C
Juan Castilloa57a4d52015-04-02 15:44:20 +010052
David Cunadoc7a1b192017-05-10 16:38:44 +010053#if (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_ECDSA)
Juan Castillobae6b2a2015-11-05 09:24:53 +000054#define MBEDTLS_ECDSA_C
55#define MBEDTLS_ECP_C
56#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
David Cunadoc7a1b192017-05-10 16:38:44 +010057#elif (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_RSA)
Juan Castillobae6b2a2015-11-05 09:24:53 +000058#define MBEDTLS_RSA_C
Qixiang Xu1c2aef12017-08-24 15:12:20 +080059#define MBEDTLS_X509_RSASSA_PSS_SUPPORT
Qixiang Xuaa05eea2017-08-24 15:26:39 +080060#elif (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_RSA_AND_ECDSA)
61#define MBEDTLS_RSA_C
62#define MBEDTLS_X509_RSASSA_PSS_SUPPORT
63#define MBEDTLS_ECDSA_C
64#define MBEDTLS_ECP_C
65#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
Juan Castilloa57a4d52015-04-02 15:44:20 +010066#endif
67
Juan Castillobae6b2a2015-11-05 09:24:53 +000068#define MBEDTLS_SHA256_C
Juan Castilloa57a4d52015-04-02 15:44:20 +010069
Juan Castillobae6b2a2015-11-05 09:24:53 +000070#define MBEDTLS_VERSION_C
Juan Castilloa57a4d52015-04-02 15:44:20 +010071
Juan Castillobae6b2a2015-11-05 09:24:53 +000072#define MBEDTLS_X509_USE_C
73#define MBEDTLS_X509_CRT_PARSE_C
Juan Castilloa57a4d52015-04-02 15:44:20 +010074
75/* MPI / BIGNUM options */
Juan Castillobae6b2a2015-11-05 09:24:53 +000076#define MBEDTLS_MPI_WINDOW_SIZE 2
77#define MBEDTLS_MPI_MAX_SIZE 256
Juan Castilloa57a4d52015-04-02 15:44:20 +010078
79/* Memory buffer allocator options */
Juan Castillobae6b2a2015-11-05 09:24:53 +000080#define MBEDTLS_MEMORY_ALIGN_MULTIPLE 8
Juan Castilloa57a4d52015-04-02 15:44:20 +010081
Qixiang Xude431b12017-10-13 09:23:42 +080082#ifndef __ASSEMBLY__
83/* System headers required to build mbed TLS with the current configuration */
84#include <stdlib.h>
Juan Castillobae6b2a2015-11-05 09:24:53 +000085#include "mbedtls/check_config.h"
Qixiang Xude431b12017-10-13 09:23:42 +080086#endif
Juan Castilloa57a4d52015-04-02 15:44:20 +010087
Juan Castilloa57a4d52015-04-02 15:44:20 +010088#endif /* __MBEDTLS_CONFIG_H__ */