blob: 5d7e663d650c16bf333e91aa6298f9cd47985868 [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
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 DTLS 1.2 with PSK and AES-CCM ciphersuites
24 *
25 * Distinguishing features:
Gilles Peskinee719d172022-04-05 21:52:14 +020026 * - Optimized for small code size, low bandwidth (on an unreliable transport),
Gilles Peskine8c5c2932022-02-25 19:28:00 +010027 * and low RAM usage.
28 * - No asymmetric cryptography (no certificates, no Diffie-Hellman key
29 * exchange).
30 * - Fully modern and secure (provided the pre-shared keys are generated and
31 * stored securely).
32 * - Very low record overhead with CCM-8.
33 * - Includes several optional DTLS features typically used in IoT.
34 *
35 * See README.txt for usage instructions.
36 */
37#ifndef MBEDTLS_CONFIG_H
38#define MBEDTLS_CONFIG_H
39
40/* System support */
41//#define MBEDTLS_HAVE_TIME /* Optionally used in Hello messages */
42/* Other MBEDTLS_HAVE_XXX flags irrelevant for this configuration */
43
44/* Mbed TLS modules */
45#define MBEDTLS_AES_C
46#define MBEDTLS_CCM_C
47#define MBEDTLS_CIPHER_C
48#define MBEDTLS_CTR_DRBG_C
49#define MBEDTLS_ENTROPY_C
50#define MBEDTLS_MD_C
51#define MBEDTLS_NET_C
52#define MBEDTLS_SHA256_C
53#define MBEDTLS_SSL_CLI_C
54#define MBEDTLS_SSL_COOKIE_C
55#define MBEDTLS_SSL_SRV_C
56#define MBEDTLS_SSL_TLS_C
57#define MBEDTLS_TIMING_C
58
59/* TLS protocol feature support */
60#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
61#define MBEDTLS_SSL_PROTO_TLS1_2
62#define MBEDTLS_SSL_PROTO_DTLS
63#define MBEDTLS_SSL_DTLS_ANTI_REPLAY
Gilles Peskine9220fee2022-04-13 14:20:19 +020064#define MBEDTLS_SSL_DTLS_BADMAC_LIMIT
Gilles Peskine8c5c2932022-02-25 19:28:00 +010065#define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
66#define MBEDTLS_SSL_DTLS_CONNECTION_ID
67#define MBEDTLS_SSL_DTLS_HELLO_VERIFY
68#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
69
70/*
71 * Use only CCM_8 ciphersuites, and
72 * save ROM and a few bytes of RAM by specifying our own ciphersuite list
73 */
74#define MBEDTLS_SSL_CIPHERSUITES \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010075 MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8, \
76 MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8
Gilles Peskine8c5c2932022-02-25 19:28:00 +010077
78/*
79 * Save RAM at the expense of interoperability: do this only if you control
80 * both ends of the connection! (See comments in "mbedtls/ssl.h".)
81 * The optimal size here depends on the typical size of records.
82 */
83#define MBEDTLS_SSL_MAX_CONTENT_LEN 256
84
85/* Save RAM at the expense of ROM */
86#define MBEDTLS_AES_ROM_TABLES
87
88/* Save some RAM by adjusting to your exact needs */
89#define MBEDTLS_PSK_MAX_LEN 16 /* 128-bits keys are generally enough */
90
91/*
92 * You should adjust this to the exact number of sources you're using: default
Gilles Peskine83f71082022-04-08 16:18:14 +020093 * is the "platform_entropy_poll" source plus a weak clock source, but you may
94 * want to add other ones. Minimum is 3 for the entropy test suite.
Gilles Peskine8c5c2932022-02-25 19:28:00 +010095 */
Gilles Peskine83f71082022-04-08 16:18:14 +020096#define MBEDTLS_ENTROPY_MAX_SOURCES 3
Gilles Peskine8c5c2932022-02-25 19:28:00 +010097
98/* These defines are present so that the config modifying scripts can enable
99 * them during tests/scripts/test-ref-configs.pl */
100//#define MBEDTLS_USE_PSA_CRYPTO
101//#define MBEDTLS_PSA_CRYPTO_C
102
Gilles Peskinedcb13af2022-02-25 21:00:16 +0100103/* Error messages and TLS debugging traces
104 * (huge code size increase, needed for tests/ssl-opt.sh) */
105//#define MBEDTLS_DEBUG_C
106//#define MBEDTLS_ERROR_C
107
Gilles Peskine8c5c2932022-02-25 19:28:00 +0100108#include "mbedtls/check_config.h"
109
110#endif /* MBEDTLS_CONFIG_H */