1 /* 2 * Copyright (c) 2018 Open Source Foundries Limited 3 * Copyright (c) 2019-2020 Arm Limited 4 * Copyright (c) 2019-2020 Linaro Limited 5 * Copyright (c) 2020 Embedded Planet 6 * 7 * SPDX-License-Identifier: Apache-2.0 8 */ 9 10 #ifndef __MCUBOOT_CONFIG_H__ 11 #define __MCUBOOT_CONFIG_H__ 12 13 /* 14 * For available configurations and their explanations, 15 * see mbed_lib.json. 16 */ 17 18 #define SIGNATURE_TYPE_RSA 0 19 #define SIGNATURE_TYPE_EC256 1 20 #define SIGNATURE_TYPE_ED25519 2 21 #define SIGNATURE_TYPE_NONE 3 22 23 /* 24 * Signature algorithm 25 */ 26 #if (MCUBOOT_SIGNATURE_ALGORITHM == SIGNATURE_TYPE_RSA) 27 #define MCUBOOT_SIGN_RSA 28 # if (MCUBOOT_RSA_SIGNATURE_LENGTH != 2048 && \ 29 MCUBOOT_RSA_SIGNATURE_LENGTH != 3072) 30 # error "Invalid RSA key size (must be 2048 or 3072)" 31 # else 32 # define MCUBOOT_SIGN_RSA_LEN MCUBOOT_RSA_SIGNATURE_LENGTH 33 # endif 34 #elif (MCUBOOT_SIGNATURE_ALGORITHM == SIGNATURE_TYPE_EC256) 35 #define MCUBOOT_SIGN_EC256 36 #elif (MCUBOOT_SIGNATURE_ALGORITHM == SIGNATURE_TYPE_ED25519) 37 #define MCUBOOT_SIGN_ED25519 38 #endif 39 40 /* 41 * Crypto backend 42 */ 43 #define MBEDTLS 0 44 #define TINYCRYPT 1 45 46 #if (MCUBOOT_CRYPTO_BACKEND == MBEDTLS) 47 #define MCUBOOT_USE_MBED_TLS 48 #elif (MCUBOOT_CRYPTO_BACKEND == TINYCRYPT) 49 /** 50 * XXX TinyCrypt is currently not supported by Mbed-OS due to build conflicts. 51 * See https://github.com/AGlass0fMilk/mbed-mcuboot-blinky/issues/2 52 */ 53 #error TinyCrypt is currently not supported by Mbed-OS due to build conflicts. 54 #define MCUBOOT_USE_TINYCRYPT 55 #endif 56 57 /* 58 * Only one image (two slots) supported for now 59 */ 60 #define MCUBOOT_IMAGE_NUMBER 1 61 62 /* 63 * Currently there is no configuration option, for this platform, 64 * that enables the system specific mcumgr commands in mcuboot 65 */ 66 #define MCUBOOT_PERUSER_MGMT_GROUP_ENABLED 0 67 68 /* 69 * Encrypted Images 70 */ 71 #if defined(MCUBOOT_ENCRYPT_RSA) || defined(MCUBOOT_ENCRYPT_EC256) || defined(MCUBOOT_ENCRYPT_X25519) 72 #define MCUBOOT_ENC_IMAGES 73 #endif 74 75 /* 76 * Enabling this option uses newer flash map APIs. This saves RAM and 77 * avoids deprecated API usage. 78 */ 79 #define MCUBOOT_USE_FLASH_AREA_GET_SECTORS 80 81 /* 82 * No watchdog integration for now 83 */ 84 #define MCUBOOT_WATCHDOG_FEED() \ 85 do { \ 86 } while (0) 87 88 /* 89 * No direct idle call implemented 90 */ 91 #define MCUBOOT_CPU_IDLE() \ 92 do { \ 93 } while (0) 94 95 #endif /* __MCUBOOT_CONFIG_H__ */ 96