mbedtls_config.h 2.33 KB
Newer Older
1
/*
dp-arm's avatar
dp-arm committed
2
 * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
7
8
9
 */
#ifndef __MBEDTLS_CONFIG_H__
#define __MBEDTLS_CONFIG_H__

/*
Juan Castillo's avatar
Juan Castillo committed
10
 * Key algorithms currently supported on mbed TLS libraries
11
 */
12
13
#define TF_MBEDTLS_RSA			1
#define TF_MBEDTLS_ECDSA		2
Qixiang Xu's avatar
Qixiang Xu committed
14
#define TF_MBEDTLS_RSA_AND_ECDSA	3
15

16
17
18
19
20
21
22
/*
 * Hash algorithms currently supported on mbed TLS libraries
 */
#define TF_MBEDTLS_SHA256		1
#define TF_MBEDTLS_SHA384		2
#define TF_MBEDTLS_SHA512		3

23
/*
Juan Castillo's avatar
Juan Castillo committed
24
 * Configuration file to build mbed TLS with the required features for
25
26
27
 * Trusted Boot
 */

Juan Castillo's avatar
Juan Castillo committed
28
29
#define MBEDTLS_PLATFORM_MEMORY
#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
30
31
/* Prevent mbed TLS from using snprintf so that it can use tf_snprintf. */
#define MBEDTLS_PLATFORM_SNPRINTF_ALT
32

33
#if !ERROR_DEPRECATED
Juan Castillo's avatar
Juan Castillo committed
34
#define MBEDTLS_PKCS1_V15
35
#endif
Juan Castillo's avatar
Juan Castillo committed
36
#define MBEDTLS_PKCS1_V21
37

Juan Castillo's avatar
Juan Castillo committed
38
39
40
#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
#define MBEDTLS_X509_CHECK_KEY_USAGE
#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
41

Juan Castillo's avatar
Juan Castillo committed
42
43
#define MBEDTLS_ASN1_PARSE_C
#define MBEDTLS_ASN1_WRITE_C
44

Juan Castillo's avatar
Juan Castillo committed
45
46
#define MBEDTLS_BASE64_C
#define MBEDTLS_BIGNUM_C
47

Juan Castillo's avatar
Juan Castillo committed
48
49
#define MBEDTLS_ERROR_C
#define MBEDTLS_MD_C
50

Juan Castillo's avatar
Juan Castillo committed
51
52
#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
#define MBEDTLS_OID_C
53

Juan Castillo's avatar
Juan Castillo committed
54
55
56
#define MBEDTLS_PK_C
#define MBEDTLS_PK_PARSE_C
#define MBEDTLS_PK_WRITE_C
57

Juan Castillo's avatar
Juan Castillo committed
58
#define MBEDTLS_PLATFORM_C
59

60
#if (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_ECDSA)
Juan Castillo's avatar
Juan Castillo committed
61
62
63
#define MBEDTLS_ECDSA_C
#define MBEDTLS_ECP_C
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
64
#elif (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_RSA)
Juan Castillo's avatar
Juan Castillo committed
65
#define MBEDTLS_RSA_C
66
#define MBEDTLS_X509_RSASSA_PSS_SUPPORT
Qixiang Xu's avatar
Qixiang Xu committed
67
68
69
70
71
72
#elif (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_RSA_AND_ECDSA)
#define MBEDTLS_RSA_C
#define MBEDTLS_X509_RSASSA_PSS_SUPPORT
#define MBEDTLS_ECDSA_C
#define MBEDTLS_ECP_C
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
73
74
#endif

Juan Castillo's avatar
Juan Castillo committed
75
#define MBEDTLS_SHA256_C
76
77
78
#if (TF_MBEDTLS_HASH_ALG_ID != TF_MBEDTLS_SHA256)
#define MBEDTLS_SHA512_C
#endif
79

Juan Castillo's avatar
Juan Castillo committed
80
#define MBEDTLS_VERSION_C
81

Juan Castillo's avatar
Juan Castillo committed
82
83
#define MBEDTLS_X509_USE_C
#define MBEDTLS_X509_CRT_PARSE_C
84
85

/* MPI / BIGNUM options */
Juan Castillo's avatar
Juan Castillo committed
86
87
#define MBEDTLS_MPI_WINDOW_SIZE              2
#define MBEDTLS_MPI_MAX_SIZE               256
88
89

/* Memory buffer allocator options */
Juan Castillo's avatar
Juan Castillo committed
90
#define MBEDTLS_MEMORY_ALIGN_MULTIPLE        8
91

92
93
94
#ifndef __ASSEMBLY__
/* System headers required to build mbed TLS with the current configuration */
#include <stdlib.h>
Juan Castillo's avatar
Juan Castillo committed
95
#include "mbedtls/check_config.h"
96
#endif
97
98

#endif /* __MBEDTLS_CONFIG_H__ */