blob: 3ae9149dad66d8aa28e832f0630224940f35a99d [file] [log] [blame]
Gilles Peskine8c5c2932022-02-25 19:28:00 +01001/**
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
Dave Rodgman7ff79652023-11-03 12:04:52 +00008 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Gilles Peskine8c5c2932022-02-25 19:28:00 +01009 */
10/*
11 * Minimal configuration for DTLS 1.2 with PSK and AES-CCM ciphersuites
12 *
13 * Distinguishing features:
Gilles Peskinee719d172022-04-05 21:52:14 +020014 * - Optimized for small code size, low bandwidth (on an unreliable transport),
Gilles Peskine8c5c2932022-02-25 19:28:00 +010015 * 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
Gilles Peskine9220fee2022-04-13 14:20:19 +020052#define MBEDTLS_SSL_DTLS_BADMAC_LIMIT
Gilles Peskine8c5c2932022-02-25 19:28:00 +010053#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 \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010063 MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8, \
64 MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8
Gilles Peskine8c5c2932022-02-25 19:28:00 +010065
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
Gilles Peskine83f71082022-04-08 16:18:14 +020081 * 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.
Gilles Peskine8c5c2932022-02-25 19:28:00 +010083 */
Gilles Peskine83f71082022-04-08 16:18:14 +020084#define MBEDTLS_ENTROPY_MAX_SOURCES 3
Gilles Peskine8c5c2932022-02-25 19:28:00 +010085
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
Gilles Peskinedcb13af2022-02-25 21:00:16 +010091/* 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
Gilles Peskine8c5c2932022-02-25 19:28:00 +010096#include "mbedtls/check_config.h"
97
98#endif /* MBEDTLS_CONFIG_H */