1/*
2 * Copyright (c) 2018 Open Source Foundries Limited
3 * Copyright (c) 2019-2024 Arm Limited
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/*
9 * Original code taken from mcuboot project at:
10 * https://github.com/mcu-tools/mcuboot
11 * Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a
12 */
13
14#ifndef __MCUBOOT_CONFIG_H__
15#define __MCUBOOT_CONFIG_H__
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*
22 * This file is also included by the simulator, but we don't want to
23 * define anything here in simulator builds.
24 *
25 * Instead of using mcuboot_config.h, the simulator adds MCUBOOT_xxx
26 * configuration flags to the compiler command lines based on the
27 * values of environment variables. However, the file still must
28 * exist, or bootutil won't build.
29 */
30#ifndef __BOOTSIM__
31
32#define MCUBOOT_VALIDATE_PRIMARY_SLOT
33#define MCUBOOT_USE_FLASH_AREA_GET_SECTORS
34#define MCUBOOT_TARGET_CONFIG "flash_layout.h"
35
36#cmakedefine MCUBOOT_HW_ROLLBACK_PROT
37#cmakedefine MCUBOOT_MEASURED_BOOT
38#cmakedefine MCUBOOT_DATA_SHARING
39
40#cmakedefine MCUBOOT_BOOTSTRAP
41/*
42 * Maximum size of the measured boot record.
43 *
44 * Its size can be calculated based on the following aspects:
45 *     - There are 5 allowed software component claims
46 *       (SW type, version, signer ID, measurement description and value),
47 *     - SHA256/SHA384 is used as the measurement method meaning that the
48 *       measurement value and signer ID are 32/48 bytes long,
49 * Considering these aspects and the fact that the string-like claim values
50 * vary in length but have a maximum value, the maximum size of a boot record
51 * can be calculated.
52 */
53#ifdef MCUBOOT_SIGN_EC384
54#define MAX_BOOT_RECORD_SZ  (164u)
55#else
56#define MAX_BOOT_RECORD_SZ  (132u)
57#endif /* MCUBOOT_SIGN_EC384 */
58
59#cmakedefine MCUBOOT_ENC_IMAGES
60#cmakedefine MCUBOOT_ENCRYPT_RSA
61
62#ifdef MCUBOOT_ENC_IMAGES
63#define MCUBOOT_AES_@MCUBOOT_ENC_KEY_LEN@
64#endif /* MCUBOOT_ENC_IMAGES */
65
66#define MCUBOOT_BOOT_MAX_ALIGN @MCUBOOT_BOOT_MAX_ALIGN@
67
68/*
69 * Cryptographic settings
70 */
71/* MCUboot and TF-M also supports the usage of PSA Crypto API along with
72 * Mbed TLS as the source of cryptographic primitives. However, the support for
73 * MCUBOOT_USE_PSA_CRYPTO is still limited and it doesn't cover all the
74 * crypto abstractions of MCUboot. For this reason it's allowed to have both
75 * of them defined, in which case MCUBOOT_USE_PSA_CRYPTO will take precedence.
76 */
77#define MCUBOOT_USE_MBED_TLS
78
79/*
80 * Logging
81 */
82#define MCUBOOT_HAVE_LOGGING    1
83#define MCUBOOT_LOG_LEVEL       @LOG_LEVEL_ID@
84
85#endif /* !__BOOTSIM__ */
86
87/*
88 * Watchdog feeding
89 */
90#define MCUBOOT_WATCHDOG_FEED()     \
91    do {                            \
92        /* Do nothing. */           \
93    } while (0)
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif /* __MCUBOOT_CONFIG_H__ */
100