From 7abfe4fa51a9f9f342f241502e66ae556b6e2b9a Mon Sep 17 00:00:00 2001 From: Jerzy Kasenberg Date: Fri, 7 Jul 2023 10:12:32 +0200 Subject: [PATCH] boot: mynewt: Add build version comparison For downgrade prevention it's possible to use build number for grater control. So far only Zephyr has this option in Kconfig now option is also available in mynewt. Signed-off-by: Jerzy Kasenberg --- .../include/mcuboot_config/mcuboot_config.h | 3 +++ boot/mynewt/mcuboot_config/syscfg.yml | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h b/boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h index c7a267149..4de915cb5 100644 --- a/boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h +++ b/boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h @@ -26,6 +26,9 @@ #else #define MCUBOOT_IMAGE_NUMBER 1 #endif +#if MYNEWT_VAL(BOOTUTIL_VERSION_CMP_USE_BUILD_NUMBER) +#define MCUBOOT_VERSION_CMP_USE_BUILD_NUMBER +#endif #if MYNEWT_VAL(BOOT_SERIAL) #define MCUBOOT_SERIAL 1 #endif diff --git a/boot/mynewt/mcuboot_config/syscfg.yml b/boot/mynewt/mcuboot_config/syscfg.yml index a6c9714ae..50761c7c9 100644 --- a/boot/mynewt/mcuboot_config/syscfg.yml +++ b/boot/mynewt/mcuboot_config/syscfg.yml @@ -94,6 +94,14 @@ syscfg.defs: - version - security_counter value: none + BOOTUTIL_VERSION_CMP_USE_BUILD_NUMBER: + description: > + Use build number while comparing image version. + By default, the image version comparison relies only on version major, + minor and revision. Enable this option to take into account the build + number as well. + This only affect builds with BOOTUTIL_DOWNGRADE_PREVENTION set to version. + value: 0 BOOTUTIL_HW_ROLLBACK_PROT: description: > Prevent undesirable/malicious software downgrades. When this option is