blob: 9c505e03300e25aa49d78ab9f324776f42aeb3a2 [file] [log] [blame]
Tamas Banf70ef8c2017-12-19 15:35:09 +00001/*
2 * Minimal configuration for using TLS in the bootloader
3 *
Sherry Zhangc7baf592021-07-15 14:54:17 +08004 * Copyright (C) 2006-2021, Arm Limited. All rights reserved.
Tamas Banf70ef8c2017-12-19 15:35:09 +00005 * Copyright (C) 2016, Linaro Ltd
Tamas Ban81daed02019-05-20 15:05:22 +01006 *
Tamas Banf70ef8c2017-12-19 15:35:09 +00007 * SPDX-License-Identifier: Apache-2.0
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 * not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 * This file is part of mbed TLS (https://tls.mbed.org)
22 */
23
24/*
David Vinczecea8b592019-10-29 16:09:51 +010025 * Original code taken from mcuboot project at:
Tamas Banc5b2f2b2020-11-12 09:47:05 +000026 * https://github.com/mcu-tools/mcuboot
David Vincze2ddc1372019-10-25 11:10:08 +020027 * Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a
David Vinczecea8b592019-10-29 16:09:51 +010028 */
29
30/*
Tamas Banf70ef8c2017-12-19 15:35:09 +000031 * Minimal configuration for using TLS in the bootloader
32 *
Tamas Ban581034a2017-12-19 19:54:37 +000033 * - RSA signature verification
Tamas Banf70ef8c2017-12-19 15:35:09 +000034 */
35
Balint Matyi69e2d2e2020-07-08 10:53:54 +010036#ifndef __MCUBOOT_MBEDTLS_CFG__
37#define __MCUBOOT_MBEDTLS_CFG__
Tamas Banf70ef8c2017-12-19 15:35:09 +000038
Tamas Banf70ef8c2017-12-19 15:35:09 +000039/* System support */
40#define MBEDTLS_PLATFORM_C
41#define MBEDTLS_PLATFORM_MEMORY
42#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
Tamas Banf70ef8c2017-12-19 15:35:09 +000043#define MBEDTLS_NO_PLATFORM_ENTROPY
44#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
Tamas Ban81daed02019-05-20 15:05:22 +010045
46#define MBEDTLS_PLATFORM_EXIT_ALT
Tamas Banf70ef8c2017-12-19 15:35:09 +000047#define MBEDTLS_PLATFORM_PRINTF_ALT
48
Tamas Banf70ef8c2017-12-19 15:35:09 +000049#define MBEDTLS_RSA_C
Balint Matyi5c476312020-03-31 13:15:39 +010050#define MBEDTLS_PKCS1_V21
Tamas Banf70ef8c2017-12-19 15:35:09 +000051
52/* mbed TLS modules */
53#define MBEDTLS_ASN1_PARSE_C
54#define MBEDTLS_ASN1_WRITE_C
55#define MBEDTLS_BIGNUM_C
56#define MBEDTLS_MD_C
57#define MBEDTLS_OID_C
58#define MBEDTLS_SHA256_C
Sherry Zhangc7baf592021-07-15 14:54:17 +080059#define MBEDTLS_SHA224_C
Balint Matyi5c476312020-03-31 13:15:39 +010060#define MBEDTLS_AES_C
Raef Coles95e527c2020-10-28 08:20:29 +000061#define MBEDTLS_CIPHER_MODE_CTR
Tamas Banf70ef8c2017-12-19 15:35:09 +000062
63/* Save RAM by adjusting to our exact needs */
Tamas Ban81daed02019-05-20 15:05:22 +010064#if MCUBOOT_SIGN_RSA_LEN == 3072
Raef Coles0e82adc2019-10-17 15:06:26 +010065#define MBEDTLS_MPI_MAX_SIZE 384
Tamas Ban81daed02019-05-20 15:05:22 +010066#else /* RSA2048 */
Raef Coles0e82adc2019-10-17 15:06:26 +010067#define MBEDTLS_MPI_MAX_SIZE 256
Tamas Banf70ef8c2017-12-19 15:35:09 +000068#endif
69
70#define MBEDTLS_SSL_MAX_CONTENT_LEN 1024
71
72/* Save ROM and a few bytes of RAM by specifying our own ciphersuite list */
73#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8
74
Tamas Banf824e742019-10-25 21:22:26 +010075#ifdef CRYPTO_HW_ACCELERATOR_OTP_PROVISIONING
76#define MBEDTLS_CIPHER_C
Tamas Banf824e742019-10-25 21:22:26 +010077#define MBEDTLS_CCM_C
Xu Yong9830d482019-11-01 14:28:34 +080078#define MBEDTLS_ECDSA_C
79#define MBEDTLS_ECP_C
80#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
81#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
Tamas Banf824e742019-10-25 21:22:26 +010082#endif /* CRYPTO_HW_ACCELERATOR_OTP_PROVISIONING */
83
Raef Coles0e82adc2019-10-17 15:06:26 +010084#ifdef CRYPTO_HW_ACCELERATOR
85#include "mbedtls_accelerator_config.h"
86#endif
87
Tamas Banf70ef8c2017-12-19 15:35:09 +000088#include "mbedtls/check_config.h"
89
Balint Matyi69e2d2e2020-07-08 10:53:54 +010090#endif /* __MCUBOOT_MBEDTLS_CFG__ */