• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * \file config-ccm-psk-tls1_2.h
3  *
4  * \brief Minimal configuration for TLS 1.2 with PSK and AES-CCM ciphersuites
5  */
6 /*
7  *  Copyright The Mbed TLS Contributors
8  *  SPDX-License-Identifier: Apache-2.0
9  *
10  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
11  *  not use this file except in compliance with the License.
12  *  You may obtain a copy of the License at
13  *
14  *  http://www.apache.org/licenses/LICENSE-2.0
15  *
16  *  Unless required by applicable law or agreed to in writing, software
17  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  *  See the License for the specific language governing permissions and
20  *  limitations under the License.
21  */
22 /*
23  * Minimal configuration for TLS 1.2 with PSK and AES-CCM ciphersuites
24  * Distinguishing features:
25  * - no bignum, no PK, no X509
26  * - fully modern and secure (provided the pre-shared keys have high entropy)
27  * - very low record overhead with CCM-8
28  * - optimized for low RAM usage
29  *
30  * See README.txt for usage instructions.
31  */
32 
33 /* System support */
34 //#define MBEDTLS_HAVE_TIME /* Optionally used in Hello messages */
35 /* Other MBEDTLS_HAVE_XXX flags irrelevant for this configuration */
36 
37 /* mbed TLS feature support */
38 #define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
39 #define MBEDTLS_SSL_PROTO_TLS1_2
40 
41 /* mbed TLS modules */
42 #define MBEDTLS_AES_C
43 #define MBEDTLS_CCM_C
44 #define MBEDTLS_CIPHER_C
45 #define MBEDTLS_CTR_DRBG_C
46 #define MBEDTLS_ENTROPY_C
47 #define MBEDTLS_MD_C
48 #define MBEDTLS_NET_C
49 /* The library does not currently support enabling SHA-224 without SHA-256.
50  * A future version of the library will have this option disabled
51  * by default. */
52 #define MBEDTLS_SHA224_C
53 #define MBEDTLS_SHA256_C
54 #define MBEDTLS_SSL_CLI_C
55 #define MBEDTLS_SSL_SRV_C
56 #define MBEDTLS_SSL_TLS_C
57 
58 /* Save RAM at the expense of ROM */
59 #define MBEDTLS_AES_ROM_TABLES
60 
61 /* Save some RAM by adjusting to your exact needs */
62 #define MBEDTLS_PSK_MAX_LEN    16 /* 128-bits keys are generally enough */
63 
64 /*
65  * You should adjust this to the exact number of sources you're using: default
66  * is the "platform_entropy_poll" source, but you may want to add other ones
67  * Minimum is 2 for the entropy test suite.
68  */
69 #define MBEDTLS_ENTROPY_MAX_SOURCES 2
70 
71 /*
72  * Use only CCM_8 ciphersuites, and
73  * save ROM and a few bytes of RAM by specifying our own ciphersuite list
74  */
75 #define MBEDTLS_SSL_CIPHERSUITES                        \
76         MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8,             \
77         MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8
78 
79 /*
80  * Save RAM at the expense of interoperability: do this only if you control
81  * both ends of the connection!  (See comments in "mbedtls/ssl.h".)
82  * The optimal size here depends on the typical size of records.
83  */
84 #define MBEDTLS_SSL_IN_CONTENT_LEN             1024
85 #define MBEDTLS_SSL_OUT_CONTENT_LEN             1024
86