Gilles Peskine | 168f17c | 2022-02-25 19:28:00 +0100 | [diff] [blame] | 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 |
| 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 Peskine | d725bf7 | 2022-04-05 21:52:14 +0200 | [diff] [blame] | 26 | * - Optimized for small code size, low bandwidth (on an unreliable transport), |
Gilles Peskine | 168f17c | 2022-02-25 19:28:00 +0100 | [diff] [blame] | 27 | * 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 | |
| 38 | /* System support */ |
| 39 | //#define MBEDTLS_HAVE_TIME /* Optionally used in Hello messages */ |
| 40 | /* Other MBEDTLS_HAVE_XXX flags irrelevant for this configuration */ |
| 41 | |
| 42 | /* Mbed TLS modules */ |
| 43 | #define MBEDTLS_AES_C |
| 44 | #define MBEDTLS_CCM_C |
| 45 | #define MBEDTLS_CIPHER_C |
| 46 | #define MBEDTLS_CTR_DRBG_C |
| 47 | #define MBEDTLS_ENTROPY_C |
| 48 | #define MBEDTLS_MD_C |
| 49 | #define MBEDTLS_NET_C |
Gilles Peskine | 168f17c | 2022-02-25 19:28:00 +0100 | [diff] [blame] | 50 | #define MBEDTLS_SHA256_C |
| 51 | #define MBEDTLS_SSL_CLI_C |
| 52 | #define MBEDTLS_SSL_COOKIE_C |
| 53 | #define MBEDTLS_SSL_SRV_C |
| 54 | #define MBEDTLS_SSL_TLS_C |
| 55 | #define MBEDTLS_TIMING_C |
| 56 | |
| 57 | /* TLS protocol feature support */ |
| 58 | #define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED |
| 59 | #define MBEDTLS_SSL_PROTO_TLS1_2 |
| 60 | #define MBEDTLS_SSL_PROTO_DTLS |
| 61 | #define MBEDTLS_SSL_DTLS_ANTI_REPLAY |
| 62 | #define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE |
| 63 | #define MBEDTLS_SSL_DTLS_CONNECTION_ID |
| 64 | #define MBEDTLS_SSL_DTLS_HELLO_VERIFY |
| 65 | #define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 66 | |
| 67 | /* |
| 68 | * Use only CCM_8 ciphersuites, and |
| 69 | * save ROM and a few bytes of RAM by specifying our own ciphersuite list |
| 70 | */ |
| 71 | #define MBEDTLS_SSL_CIPHERSUITES \ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 72 | MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8, \ |
| 73 | MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8 |
Gilles Peskine | 168f17c | 2022-02-25 19:28:00 +0100 | [diff] [blame] | 74 | |
| 75 | /* |
| 76 | * Save RAM at the expense of interoperability: do this only if you control |
| 77 | * both ends of the connection! (See comments in "mbedtls/ssl.h".) |
| 78 | * The optimal size here depends on the typical size of records. |
| 79 | */ |
| 80 | #define MBEDTLS_SSL_IN_CONTENT_LEN 256 |
| 81 | #define MBEDTLS_SSL_OUT_CONTENT_LEN 256 |
| 82 | |
| 83 | /* Save RAM at the expense of ROM */ |
| 84 | #define MBEDTLS_AES_ROM_TABLES |
| 85 | |
| 86 | /* Save some RAM by adjusting to your exact needs */ |
| 87 | #define MBEDTLS_PSK_MAX_LEN 16 /* 128-bits keys are generally enough */ |
| 88 | |
| 89 | /* |
| 90 | * You should adjust this to the exact number of sources you're using: default |
| 91 | * is the "platform_entropy_poll" source, but you may want to add other ones |
| 92 | * Minimum is 2 for the entropy test suite. |
| 93 | */ |
| 94 | #define MBEDTLS_ENTROPY_MAX_SOURCES 2 |
| 95 | |
| 96 | /* These defines are present so that the config modifying scripts can enable |
| 97 | * them during tests/scripts/test-ref-configs.pl */ |
| 98 | //#define MBEDTLS_USE_PSA_CRYPTO |
| 99 | //#define MBEDTLS_PSA_CRYPTO_C |
Gilles Peskine | c6d197b | 2022-02-25 21:00:16 +0100 | [diff] [blame] | 100 | |
| 101 | /* Error messages and TLS debugging traces |
| 102 | * (huge code size increase, needed for tests/ssl-opt.sh) */ |
| 103 | //#define MBEDTLS_DEBUG_C |
| 104 | //#define MBEDTLS_ERROR_C |