• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * \file config-ccm-psk-dtls1_2.h
3  *
4  * \brief Small configuration for DTLS 1.2 with PSK and AES-CCM ciphersuites
5  */
6 /*
7  *  Copyright The Mbed TLS Contributors
8  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9  */
10 /*
11  * Minimal configuration for DTLS 1.2 with PSK and AES-CCM ciphersuites
12  *
13  * Distinguishing features:
14  * - Optimized for small code size, low bandwidth (on an unreliable transport),
15  *   and low RAM usage.
16  * - No asymmetric cryptography (no certificates, no Diffie-Hellman key
17  *   exchange).
18  * - Fully modern and secure (provided the pre-shared keys are generated and
19  *   stored securely).
20  * - Very low record overhead with CCM-8.
21  * - Includes several optional DTLS features typically used in IoT.
22  *
23  * See README.txt for usage instructions.
24  */
25 #ifndef MBEDTLS_CONFIG_H
26 #define MBEDTLS_CONFIG_H
27 
28 /* System support */
29 //#define MBEDTLS_HAVE_TIME /* Optionally used in Hello messages */
30 /* Other MBEDTLS_HAVE_XXX flags irrelevant for this configuration */
31 
32 /* Mbed TLS modules */
33 #define MBEDTLS_AES_C
34 #define MBEDTLS_CCM_C
35 #define MBEDTLS_CIPHER_C
36 #define MBEDTLS_CTR_DRBG_C
37 #define MBEDTLS_ENTROPY_C
38 #define MBEDTLS_MD_C
39 #define MBEDTLS_NET_C
40 #define MBEDTLS_SHA256_C
41 #define MBEDTLS_SSL_CLI_C
42 #define MBEDTLS_SSL_COOKIE_C
43 #define MBEDTLS_SSL_SRV_C
44 #define MBEDTLS_SSL_TLS_C
45 #define MBEDTLS_TIMING_C
46 
47 /* TLS protocol feature support */
48 #define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
49 #define MBEDTLS_SSL_PROTO_TLS1_2
50 #define MBEDTLS_SSL_PROTO_DTLS
51 #define MBEDTLS_SSL_DTLS_ANTI_REPLAY
52 #define MBEDTLS_SSL_DTLS_BADMAC_LIMIT
53 #define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
54 #define MBEDTLS_SSL_DTLS_CONNECTION_ID
55 #define MBEDTLS_SSL_DTLS_HELLO_VERIFY
56 #define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
57 
58 /*
59  * Use only CCM_8 ciphersuites, and
60  * save ROM and a few bytes of RAM by specifying our own ciphersuite list
61  */
62 #define MBEDTLS_SSL_CIPHERSUITES                        \
63     MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8,             \
64     MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8
65 
66 /*
67  * Save RAM at the expense of interoperability: do this only if you control
68  * both ends of the connection!  (See comments in "mbedtls/ssl.h".)
69  * The optimal size here depends on the typical size of records.
70  */
71 #define MBEDTLS_SSL_MAX_CONTENT_LEN             256
72 
73 /* Save RAM at the expense of ROM */
74 #define MBEDTLS_AES_ROM_TABLES
75 
76 /* Save some RAM by adjusting to your exact needs */
77 #define MBEDTLS_PSK_MAX_LEN    16 /* 128-bits keys are generally enough */
78 
79 /*
80  * You should adjust this to the exact number of sources you're using: default
81  * is the "platform_entropy_poll" source plus a weak clock source, but you may
82  * want to add other ones. Minimum is 3 for the entropy test suite.
83  */
84 #define MBEDTLS_ENTROPY_MAX_SOURCES 3
85 
86 /* These defines are present so that the config modifying scripts can enable
87  * them during tests/scripts/test-ref-configs.pl */
88 //#define MBEDTLS_USE_PSA_CRYPTO
89 //#define MBEDTLS_PSA_CRYPTO_C
90 
91 /* Error messages and TLS debugging traces
92  * (huge code size increase, needed for tests/ssl-opt.sh) */
93 //#define MBEDTLS_DEBUG_C
94 //#define MBEDTLS_ERROR_C
95 
96 #include "mbedtls/check_config.h"
97 
98 #endif /* MBEDTLS_CONFIG_H */
99