From 91df9cae87ff86f7c7d7fbf63e70c79f4d755ba9 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Sat, 26 Sep 2020 12:28:38 +0200 Subject: [PATCH] suit: Finalize image after digest verification --- sys/suit/handlers_command_seq.c | 1 + sys/suit/transport/coap.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/suit/handlers_command_seq.c b/sys/suit/handlers_command_seq.c index 3883460f79..7683433915 100644 --- a/sys/suit/handlers_command_seq.c +++ b/sys/suit/handlers_command_seq.c @@ -375,6 +375,7 @@ static int _dtv_verify_image_match(suit_manifest_t *manifest, int key, if (res != 0) { return SUIT_ERR_COND; } + riotboot_flashwrite_finish(manifest->writer); return SUIT_OK; } diff --git a/sys/suit/transport/coap.c b/sys/suit/transport/coap.c index 6b159d2e8e..12657ee061 100644 --- a/sys/suit/transport/coap.c +++ b/sys/suit/transport/coap.c @@ -348,8 +348,8 @@ static void _suit_handle_url(const char *url) if (size >= 0) { LOG_INFO("suit_coap: got manifest with size %u\n", (unsigned)size); - riotboot_flashwrite_t writer; #ifdef MODULE_SUIT + riotboot_flashwrite_t writer; suit_manifest_t manifest; memset(&manifest, 0, sizeof(manifest)); @@ -376,9 +376,6 @@ static void _suit_handle_url(const char *url) #endif if (res == 0) { - LOG_INFO("suit_coap: finalizing image flash\n"); - riotboot_flashwrite_finish(&writer); - const riotboot_hdr_t *hdr = riotboot_slot_get_hdr( riotboot_slot_other()); riotboot_hdr_print(hdr);