Skip to content

Commit e39d2f6

Browse files
committed
Add pelion configuration to the tls-client copy
1 parent c5f03f3 commit e39d2f6

File tree

2 files changed

+284
-1
lines changed

2 files changed

+284
-1
lines changed

Diff for: tls-client-pelion/mbed_app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"macros": [
33
"MBED_CONF_APP_MAIN_STACK_SIZE=4096",
4-
"MBEDTLS_USER_CONFIG_FILE=\"mbedtls_entropy_config.h\""
4+
"MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbedos_pelion_config.h\""
55
],
66
"config": {
77
"network-interface":{

Diff for: tls-client-pelion/mbedtls_mbedos_pelion_config.h

+283
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
//----------------------------------------------------------------------------
2+
// The confidential and proprietary information contained in this file may
3+
// only be used by a person authorised under and to the extent permitted
4+
// by a subsisting licensing agreement from ARM Limited or its affiliates.
5+
//
6+
// (C) COPYRIGHT 2016 ARM Limited or its affiliates.
7+
// ALL RIGHTS RESERVED
8+
//
9+
// This entire notice must be reproduced on all copies of this file
10+
// and copies of this file may only be made by a person if such person is
11+
// permitted to do so under the terms of a subsisting license agreement
12+
// from ARM Limited or its affiliates.
13+
//----------------------------------------------------------------------------
14+
15+
#ifndef PAL_MBEDTLS_USER_CONFIG_H
16+
#define PAL_MBEDTLS_USER_CONFIG_H
17+
18+
19+
/*! All of the following definitions are mandatory requirements for correct
20+
* functionality of PAL TLS and Crypto components.
21+
* Please do not disable them.
22+
*/
23+
24+
/* Platform has time function to provide time for certificates verifications */
25+
#if 1 //Please set to 1 if you are using secure time
26+
#ifndef MBEDTLS_HAVE_TIME
27+
#define MBEDTLS_HAVE_TIME
28+
#endif //MBEDTLS_HAVE_TIME
29+
30+
#ifndef MBEDTLS_HAVE_TIME_DATE
31+
#define MBEDTLS_HAVE_TIME_DATE
32+
#endif //MBEDTLS_HAVE_TIME_DATE
33+
34+
#ifndef MBEDTLS_PLATFORM_TIME_ALT
35+
#define MBEDTLS_PLATFORM_TIME_ALT
36+
#endif //MBEDTLS_PLATFORM_TIME_ALT
37+
38+
/* System support */
39+
#ifndef MBEDTLS_HAVE_ASM
40+
#define MBEDTLS_HAVE_ASM
41+
#endif //MBEDTLS_HAVE_ASM
42+
#endif
43+
/* mbed TLS feature support */
44+
#ifndef MBEDTLS_ECP_DP_SECP256R1_ENABLED
45+
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
46+
#endif //MBEDTLS_ECP_DP_SECP256R1_ENABLED
47+
48+
#ifndef MBEDTLS_ECP_NIST_OPTIM
49+
#define MBEDTLS_ECP_NIST_OPTIM
50+
#endif //MBEDTLS_ECP_NIST_OPTIM
51+
52+
#ifndef MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
53+
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
54+
#endif //MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
55+
56+
#ifndef MBEDTLS_SSL_PROTO_TLS1_2
57+
#define MBEDTLS_SSL_PROTO_TLS1_2
58+
#endif //MBEDTLS_SSL_PROTO_TLS1_2
59+
60+
#ifndef MBEDTLS_SSL_PROTO_DTLS
61+
#define MBEDTLS_SSL_PROTO_DTLS
62+
#endif //MBEDTLS_SSL_PROTO_DTLS
63+
64+
#ifndef MBEDTLS_SSL_DTLS_ANTI_REPLAY
65+
#define MBEDTLS_SSL_DTLS_ANTI_REPLAY
66+
#endif //MBEDTLS_SSL_DTLS_ANTI_REPLAY
67+
68+
#ifndef MBEDTLS_SSL_DTLS_HELLO_VERIFY
69+
#define MBEDTLS_SSL_DTLS_HELLO_VERIFY
70+
#endif //MBEDTLS_SSL_DTLS_HELLO_VERIFY
71+
72+
#ifndef MBEDTLS_SSL_EXPORT_KEYS
73+
#define MBEDTLS_SSL_EXPORT_KEYS
74+
#endif //MBEDTLS_SSL_EXPORT_KEYS
75+
76+
/* mbed TLS modules */
77+
#ifndef MBEDTLS_AES_C
78+
#define MBEDTLS_AES_C
79+
#endif //MBEDTLS_AES_C
80+
81+
/* Disable some of the speed optimizations on AES code to save
82+
* ~6200 bytes of ROM. According to comments on the mbedtls PR 394,
83+
* the speed on Cortex M4 is not even reduced by this. */
84+
#ifndef MBEDTLS_AES_FEWER_TABLES
85+
#define MBEDTLS_AES_FEWER_TABLES
86+
#endif // MBEDTLS_AES_FEWER_TABLES
87+
88+
#ifndef MBEDTLS_ASN1_PARSE_C
89+
#define MBEDTLS_ASN1_PARSE_C
90+
#endif //MBEDTLS_ASN1_PARSE_C
91+
92+
#ifndef MBEDTLS_ASN1_WRITE_C
93+
#define MBEDTLS_ASN1_WRITE_C
94+
#endif //MBEDTLS_ASN1_WRITE_C
95+
96+
#ifndef MBEDTLS_BIGNUM_C
97+
#define MBEDTLS_BIGNUM_C
98+
#endif //MBEDTLS_BIGNUM_C
99+
100+
#ifndef MBEDTLS_CIPHER_C
101+
#define MBEDTLS_CIPHER_C
102+
#endif //MBEDTLS_CIPHER_C
103+
104+
#ifndef MBEDTLS_CTR_DRBG_C
105+
#define MBEDTLS_CTR_DRBG_C
106+
#endif //MBEDTLS_CTR_DRBG_C
107+
108+
#ifndef MBEDTLS_ECP_C
109+
#define MBEDTLS_ECP_C
110+
#endif //MBEDTLS_ECP_C
111+
112+
#ifndef MBEDTLS_ENTROPY_C
113+
#define MBEDTLS_ENTROPY_C
114+
#endif //MBEDTLS_ENTROPY_C
115+
116+
#ifndef MBEDTLS_MD_C
117+
#define MBEDTLS_MD_C
118+
#endif //MBEDTLS_MD_C
119+
120+
#ifndef MBEDTLS_OID_C
121+
#define MBEDTLS_OID_C
122+
#endif //MBEDTLS_OID_C
123+
124+
#ifndef MBEDTLS_PK_C
125+
#define MBEDTLS_PK_C
126+
#endif //MBEDTLS_PK_C
127+
128+
#ifndef MBEDTLS_PK_PARSE_C
129+
#define MBEDTLS_PK_PARSE_C
130+
#endif //MBEDTLS_PK_PARSE_C
131+
132+
#ifndef MBEDTLS_SHA256_C
133+
#define MBEDTLS_SHA256_C
134+
#endif //MBEDTLS_SHA256_C
135+
136+
// Disable the speed optimizations of SHA256, makes binary size smaller
137+
// on Cortex-M by 1800B with ARMCC5 and 1384B with GCC 6.3.
138+
#ifndef MBEDTLS_SHA256_SMALLER
139+
#define MBEDTLS_SHA256_SMALLER
140+
#endif // MBEDTLS_SHA256_SMALLER
141+
142+
#ifndef MBEDTLS_SSL_COOKIE_C
143+
#define MBEDTLS_SSL_COOKIE_C
144+
#endif //MBEDTLS_SSL_COOKIE_C
145+
146+
#ifndef MBEDTLS_SSL_CLI_C
147+
#define MBEDTLS_SSL_CLI_C
148+
#endif //MBEDTLS_SSL_CLI_C
149+
150+
#ifndef MBEDTLS_SSL_TLS_C
151+
#define MBEDTLS_SSL_TLS_C
152+
#endif //MBEDTLS_SSL_TLS_C
153+
// XXX mbedclient needs these: mbedtls_x509_crt_free, mbedtls_x509_crt_init, mbedtls_x509_crt_parse
154+
#ifndef MBEDTLS_X509_USE_C
155+
#define MBEDTLS_X509_USE_C
156+
#endif //MBEDTLS_X509_USE_C
157+
158+
#ifndef MBEDTLS_X509_CRT_PARSE_C
159+
#define MBEDTLS_X509_CRT_PARSE_C
160+
#endif //MBEDTLS_X509_CRT_PARSE_C
161+
// a bit wrong way to get mbedtls_ssl_conf_psk:
162+
#ifndef MBEDTLS_CMAC_C
163+
#define MBEDTLS_CMAC_C
164+
#endif //MBEDTLS_CMAC_C
165+
166+
#ifndef MBEDTLS_ECDH_C
167+
#define MBEDTLS_ECDH_C
168+
#endif //MBEDTLS_ECDH_C
169+
170+
#ifndef MBEDTLS_ECDSA_C
171+
#define MBEDTLS_ECDSA_C
172+
#endif //MBEDTLS_ECDSA_C
173+
174+
#ifndef MBEDTLS_GCM_C
175+
#define MBEDTLS_GCM_C
176+
#endif //MBEDTLS_GCM_C
177+
178+
#ifndef MBEDTLS_X509_CRT_PARSE_C
179+
#define MBEDTLS_X509_CRT_PARSE_C
180+
#endif //MBEDTLS_X509_CRT_PARSE_C
181+
182+
#ifndef MBEDTLS_X509_CSR_PARSE_C
183+
#define MBEDTLS_X509_CSR_PARSE_C
184+
#endif //MBEDTLS_X509_CSR_PARSE_C
185+
186+
#ifndef MBEDTLS_X509_CREATE_C
187+
#define MBEDTLS_X509_CREATE_C
188+
#endif //MBEDTLS_X509_CREATE_C
189+
190+
#ifndef MBEDTLS_X509_CSR_WRITE_C
191+
#define MBEDTLS_X509_CSR_WRITE_C
192+
#endif //MBEDTLS_X509_CSR_WRITE_C
193+
194+
#ifndef MBEDTLS_CTR_DRBG_MAX_REQUEST
195+
#define MBEDTLS_CTR_DRBG_MAX_REQUEST 2048
196+
#endif //MBEDTLS_CTR_DRBG_MAX_REQUEST
197+
198+
// Needed by update
199+
#ifndef MBEDTLS_CIPHER_MODE_CTR
200+
#define MBEDTLS_CIPHER_MODE_CTR
201+
#endif //MBEDTLS_CIPHER_MODE_CTR
202+
203+
// Save ROM and a few bytes of RAM by specifying our own ciphersuite list
204+
#ifndef MBEDTLS_SSL_CIPHERSUITES
205+
#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8, \
206+
MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, \
207+
MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, \
208+
MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8, \
209+
MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8, \
210+
MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256
211+
#endif //MBEDTLS_SSL_CIPHERSUITES
212+
213+
/*! All of the following definitions are optimizations (reduce mbedTLS memory usage and size),
214+
* changing them is on the user responsibility since they can enlarge
215+
* the binary footprint and the memory usage
216+
*/
217+
218+
// define to save 8KB RAM at the expense of ROM
219+
#ifndef MBEDTLS_AES_ROM_TABLES
220+
#define MBEDTLS_AES_ROM_TABLES
221+
#endif //MBEDTLS_AES_ROM_TABLES
222+
223+
// Reduce IO buffer to save RAM, default is 16KB
224+
#ifndef MBEDTLS_SSL_MAX_CONTENT_LEN
225+
#define MBEDTLS_SSL_MAX_CONTENT_LEN 4096
226+
#endif //MBEDTLS_SSL_MAX_CONTENT_LEN
227+
228+
// needed for Base64 encoding Opaque data for
229+
// registration payload, adds 500 bytes to flash.
230+
#ifndef MBEDTLS_BASE64_C
231+
#define MBEDTLS_BASE64_C
232+
#endif // MBEDTLS_BASE64_C
233+
234+
// Needed by provisioning
235+
#undef MBEDTLS_PEM_WRITE_C
236+
237+
// Remove RSA, save 20KB at total
238+
#if !MBED_CONF_MBED_CLIENT_PAL_RSA_REQUIRED
239+
#undef MBEDTLS_RSA_C
240+
#undef MBEDTLS_PK_RSA_ALT_SUPPORT
241+
#undef MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
242+
#undef MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
243+
#undef MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
244+
#endif // MBED_CONF_MBED_CLIENT_PAL_RSA_REQUIRED
245+
246+
// Remove error messages, save 10KB of ROM
247+
#undef MBEDTLS_ERROR_C
248+
249+
// Remove selftesting and save 11KB of ROM
250+
#undef MBEDTLS_SELF_TEST
251+
252+
#undef MBEDTLS_CERTS_C
253+
254+
// Reduces ROM size by 30 kB
255+
#undef MBEDTLS_ERROR_STRERROR_DUMMY
256+
257+
#undef MBEDTLS_VERSION_FEATURES
258+
259+
#undef MBEDTLS_DEBUG_C
260+
261+
// needed for parsing the certificates
262+
#undef MBEDTLS_PEM_PARSE_C
263+
264+
#undef MBEDTLS_SHA512_C
265+
266+
#undef MBEDTLS_SSL_SRV_C
267+
268+
#undef MBEDTLS_ECP_DP_SECP192R1_ENABLED
269+
#undef MBEDTLS_ECP_DP_SECP224R1_ENABLED
270+
#undef MBEDTLS_ECP_DP_SECP384R1_ENABLED
271+
#undef MBEDTLS_ECP_DP_SECP521R1_ENABLED
272+
#undef MBEDTLS_ECP_DP_SECP192K1_ENABLED
273+
#undef MBEDTLS_ECP_DP_SECP224K1_ENABLED
274+
#undef MBEDTLS_ECP_DP_SECP256K1_ENABLED
275+
#undef MBEDTLS_ECP_DP_BP256R1_ENABLED
276+
#undef MBEDTLS_ECP_DP_BP384R1_ENABLED
277+
#undef MBEDTLS_ECP_DP_BP512R1_ENABLED
278+
#undef MBEDTLS_ECP_DP_CURVE25519_ENABLED
279+
280+
281+
#include "mbedtls/check_config.h"
282+
283+
#endif /* PAL_MBEDTLS_USER_CONFIG_H */

0 commit comments

Comments
 (0)