blob: c345245ab7b3d9b21e271a3321e5788c0acec037 [file] [log] [blame]
Tamas Banf70ef8c2017-12-19 15:35:09 +00001/*
2 * Minimal configuration for using TLS in the bootloader
3 *
Balint Matyi5c476312020-03-31 13:15:39 +01004 * Copyright (C) 2006-2020, 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:
26 * https://github.com/JuulLabs-OSS/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
David Vinczecea8b592019-10-29 16:09:51 +010036#ifndef MCUBOOT_MBEDTLS_CONFIG_RSA
37#define MCUBOOT_MBEDTLS_CONFIG_RSA
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
Balint Matyi5c476312020-03-31 13:15:39 +010059#define MBEDTLS_AES_C
Tamas Banf70ef8c2017-12-19 15:35:09 +000060
61/* Save RAM by adjusting to our exact needs */
Tamas Ban81daed02019-05-20 15:05:22 +010062#if MCUBOOT_SIGN_RSA_LEN == 3072
Raef Coles0e82adc2019-10-17 15:06:26 +010063#define MBEDTLS_MPI_MAX_SIZE 384
Tamas Ban81daed02019-05-20 15:05:22 +010064#else /* RSA2048 */
Raef Coles0e82adc2019-10-17 15:06:26 +010065#define MBEDTLS_MPI_MAX_SIZE 256
Tamas Banf70ef8c2017-12-19 15:35:09 +000066#endif
67
68#define MBEDTLS_SSL_MAX_CONTENT_LEN 1024
69
70/* Save ROM and a few bytes of RAM by specifying our own ciphersuite list */
71#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8
72
Tamas Banf824e742019-10-25 21:22:26 +010073#ifdef CRYPTO_HW_ACCELERATOR_OTP_PROVISIONING
74#define MBEDTLS_CIPHER_C
Tamas Banf824e742019-10-25 21:22:26 +010075#define MBEDTLS_CCM_C
Xu Yong9830d482019-11-01 14:28:34 +080076#define MBEDTLS_ECDSA_C
77#define MBEDTLS_ECP_C
78#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
79#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
Tamas Banf824e742019-10-25 21:22:26 +010080#endif /* CRYPTO_HW_ACCELERATOR_OTP_PROVISIONING */
81
Raef Coles0e82adc2019-10-17 15:06:26 +010082#ifdef CRYPTO_HW_ACCELERATOR
83#include "mbedtls_accelerator_config.h"
84#endif
85
Tamas Banf70ef8c2017-12-19 15:35:09 +000086#include "mbedtls/check_config.h"
87
David Vinczecea8b592019-10-29 16:09:51 +010088#endif /* MCUBOOT_MBEDTLS_CONFIG_RSA */