• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 #ifndef __MBEDTLS_CONFIG_H__
7 #define __MBEDTLS_CONFIG_H__
8 
9 /*
10  * Key algorithms currently supported on mbed TLS libraries
11  */
12 #define TF_MBEDTLS_RSA			1
13 #define TF_MBEDTLS_ECDSA		2
14 #define TF_MBEDTLS_RSA_AND_ECDSA	3
15 
16 /*
17  * Configuration file to build mbed TLS with the required features for
18  * Trusted Boot
19  */
20 
21 #define MBEDTLS_PLATFORM_MEMORY
22 #define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
23 /* Prevent mbed TLS from using snprintf so that it can use tf_snprintf. */
24 #define MBEDTLS_PLATFORM_SNPRINTF_ALT
25 
26 #if !ERROR_DEPRECATED
27 #define MBEDTLS_PKCS1_V15
28 #endif
29 #define MBEDTLS_PKCS1_V21
30 
31 #define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
32 #define MBEDTLS_X509_CHECK_KEY_USAGE
33 #define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
34 
35 #define MBEDTLS_ASN1_PARSE_C
36 #define MBEDTLS_ASN1_WRITE_C
37 
38 #define MBEDTLS_BASE64_C
39 #define MBEDTLS_BIGNUM_C
40 
41 #define MBEDTLS_ERROR_C
42 #define MBEDTLS_MD_C
43 
44 #define MBEDTLS_MEMORY_BUFFER_ALLOC_C
45 #define MBEDTLS_OID_C
46 
47 #define MBEDTLS_PK_C
48 #define MBEDTLS_PK_PARSE_C
49 #define MBEDTLS_PK_WRITE_C
50 
51 #define MBEDTLS_PLATFORM_C
52 
53 #if (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_ECDSA)
54 #define MBEDTLS_ECDSA_C
55 #define MBEDTLS_ECP_C
56 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
57 #elif (TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_RSA)
58 #define MBEDTLS_RSA_C
59 #define MBEDTLS_X509_RSASSA_PSS_SUPPORT
60 #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
66 #endif
67 
68 #define MBEDTLS_SHA256_C
69 
70 #define MBEDTLS_VERSION_C
71 
72 #define MBEDTLS_X509_USE_C
73 #define MBEDTLS_X509_CRT_PARSE_C
74 
75 /* MPI / BIGNUM options */
76 #define MBEDTLS_MPI_WINDOW_SIZE              2
77 #define MBEDTLS_MPI_MAX_SIZE               256
78 
79 /* Memory buffer allocator options */
80 #define MBEDTLS_MEMORY_ALIGN_MULTIPLE        8
81 
82 #ifndef __ASSEMBLY__
83 /* System headers required to build mbed TLS with the current configuration */
84 #include <stdlib.h>
85 #include "mbedtls/check_config.h"
86 #endif
87 
88 #endif /* __MBEDTLS_CONFIG_H__ */
89