blob: 22e75742a34a11794f013dc9fa1a9fe722e1009f [file] [log] [blame]
Juan Castillo7d37aa12015-04-02 15:44:20 +01001/*
dp-arm66b4c162017-03-07 10:08:42 +00002 * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
Juan Castillo7d37aa12015-04-02 15:44:20 +01003 *
dp-arm82cb2c12017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Juan Castillo7d37aa12015-04-02 15:44:20 +01005 */
6#ifndef __MBEDTLS_CONFIG_H__
7#define __MBEDTLS_CONFIG_H__
8
9/*
Juan Castillo649dbf62015-11-05 09:24:53 +000010 * Key algorithms currently supported on mbed TLS libraries
Juan Castillo7d37aa12015-04-02 15:44:20 +010011 */
David Cunadob1883512017-05-10 16:38:44 +010012#define TF_MBEDTLS_RSA 1
13#define TF_MBEDTLS_ECDSA 2
Juan Castillo7d37aa12015-04-02 15:44:20 +010014
15/*
Juan Castillo649dbf62015-11-05 09:24:53 +000016 * Configuration file to build mbed TLS with the required features for
Juan Castillo7d37aa12015-04-02 15:44:20 +010017 * Trusted Boot
18 */
19
Juan Castillo649dbf62015-11-05 09:24:53 +000020#define MBEDTLS_PLATFORM_MEMORY
21#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
Antonio Nino Diazab1794f2017-05-19 11:37:22 +010022/* Prevent mbed TLS from using snprintf so that it can use tf_snprintf. */
23#define MBEDTLS_PLATFORM_SNPRINTF_ALT
Juan Castillo7d37aa12015-04-02 15:44:20 +010024
Juan Castillo649dbf62015-11-05 09:24:53 +000025#define MBEDTLS_PKCS1_V15
26#define MBEDTLS_PKCS1_V21
Juan Castillo7d37aa12015-04-02 15:44:20 +010027
Juan Castillo649dbf62015-11-05 09:24:53 +000028#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
29#define MBEDTLS_X509_CHECK_KEY_USAGE
30#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
Juan Castillo7d37aa12015-04-02 15:44:20 +010031
Juan Castillo649dbf62015-11-05 09:24:53 +000032#define MBEDTLS_ASN1_PARSE_C
33#define MBEDTLS_ASN1_WRITE_C
Juan Castillo7d37aa12015-04-02 15:44:20 +010034
Juan Castillo649dbf62015-11-05 09:24:53 +000035#define MBEDTLS_BASE64_C
36#define MBEDTLS_BIGNUM_C
Juan Castillo7d37aa12015-04-02 15:44:20 +010037
Juan Castillo649dbf62015-11-05 09:24:53 +000038#define MBEDTLS_ERROR_C
39#define MBEDTLS_MD_C
Juan Castillo7d37aa12015-04-02 15:44:20 +010040
Juan Castillo649dbf62015-11-05 09:24:53 +000041#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
42#define MBEDTLS_OID_C
Juan Castillo7d37aa12015-04-02 15:44:20 +010043
Juan Castillo649dbf62015-11-05 09:24:53 +000044#define MBEDTLS_PK_C
45#define MBEDTLS_PK_PARSE_C
46#define MBEDTLS_PK_WRITE_C
Juan Castillo7d37aa12015-04-02 15:44:20 +010047
Juan Castillo649dbf62015-11-05 09:24:53 +000048#define MBEDTLS_PLATFORM_C
Juan Castillo7d37aa12015-04-02 15:44:20 +010049
David Cunadob1883512017-05-10 16:38:44 +010050#if (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_ECDSA)
Juan Castillo649dbf62015-11-05 09:24:53 +000051#define MBEDTLS_ECDSA_C
52#define MBEDTLS_ECP_C
53#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
David Cunadob1883512017-05-10 16:38:44 +010054#elif (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_RSA)
Juan Castillo649dbf62015-11-05 09:24:53 +000055#define MBEDTLS_RSA_C
Juan Castillo7d37aa12015-04-02 15:44:20 +010056#endif
57
Juan Castillo649dbf62015-11-05 09:24:53 +000058#define MBEDTLS_SHA256_C
Juan Castillo7d37aa12015-04-02 15:44:20 +010059
Juan Castillo649dbf62015-11-05 09:24:53 +000060#define MBEDTLS_VERSION_C
Juan Castillo7d37aa12015-04-02 15:44:20 +010061
Juan Castillo649dbf62015-11-05 09:24:53 +000062#define MBEDTLS_X509_USE_C
63#define MBEDTLS_X509_CRT_PARSE_C
Juan Castillo7d37aa12015-04-02 15:44:20 +010064
65/* MPI / BIGNUM options */
Juan Castillo649dbf62015-11-05 09:24:53 +000066#define MBEDTLS_MPI_WINDOW_SIZE 2
67#define MBEDTLS_MPI_MAX_SIZE 256
Juan Castillo7d37aa12015-04-02 15:44:20 +010068
69/* Memory buffer allocator options */
Juan Castillo649dbf62015-11-05 09:24:53 +000070#define MBEDTLS_MEMORY_ALIGN_MULTIPLE 8
Juan Castillo7d37aa12015-04-02 15:44:20 +010071
Juan Castillo649dbf62015-11-05 09:24:53 +000072#include "mbedtls/check_config.h"
Juan Castillo7d37aa12015-04-02 15:44:20 +010073
Juan Castillo649dbf62015-11-05 09:24:53 +000074/* System headers required to build mbed TLS with the current configuration */
Juan Castillo7d37aa12015-04-02 15:44:20 +010075#include <stdlib.h>
76
77#endif /* __MBEDTLS_CONFIG_H__ */