diff --git a/sys/include/suit.h b/sys/include/suit.h index 84f1f633cc94..d003b6d0cc6e 100644 --- a/sys/include/suit.h +++ b/sys/include/suit.h @@ -196,7 +196,8 @@ typedef struct { #define SUIT_COMPONENT_STATE_FETCHED (1 << 0) /**< Component is fetched */ #define SUIT_COMPONENT_STATE_FETCH_FAILED (1 << 1) /**< Component fetched but failed */ #define SUIT_COMPONENT_STATE_VERIFIED (1 << 2) /**< Component is verified */ -#define SUIT_COMPONENT_STATE_FINALIZED (1 << 3) /**< Component successfully installed */ +#define SUIT_COMPONENT_STATE_INSTALLED (1 << 3) /**< Component is installed, but has not been verified */ +#define SUIT_COMPONENT_STATE_FINALIZED (1 << 4) /**< Component successfully installed */ /** @} */ /** diff --git a/sys/suit/handlers_command_seq.c b/sys/suit/handlers_command_seq.c index 1b4d56104ceb..234dc466fcb6 100644 --- a/sys/suit/handlers_command_seq.c +++ b/sys/suit/handlers_command_seq.c @@ -488,8 +488,14 @@ static int _dtv_verify_image_match(suit_manifest_t *manifest, int key, LOG_INFO("Starting digest verification against image\n"); res = _validate_payload(comp, digest, img_size); if (res == SUIT_OK) { - LOG_INFO("Install correct payload\n"); - suit_storage_install(comp->storage_backend, manifest); + if (!suit_component_check_flag(comp, SUIT_COMPONENT_STATE_INSTALLED)) { + LOG_INFO("Install correct payload\n"); + suit_storage_install(comp->storage_backend, manifest); + suit_component_set_flag(comp, SUIT_COMPONENT_STATE_INSTALLED); + } + if (suit_component_check_flag(comp, SUIT_COMPONENT_STATE_INSTALLED)) { + LOG_INFO("Verified installed payload\n"); + } } else { LOG_INFO("Erasing bad payload\n");