diff --git a/sys/include/suit.h b/sys/include/suit.h index 942f7a38949c..84f1f633cc94 100644 --- a/sys/include/suit.h +++ b/sys/include/suit.h @@ -245,6 +245,7 @@ typedef struct { uint8_t validation_buf[SUIT_COSE_BUF_SIZE]; char *urlbuf; /**< Buffer containing the manifest url */ size_t urlbuf_len; /**< Length of the manifest url */ + uint32_t seq_number; /**< Set sequence number */ } suit_manifest_t; /** diff --git a/sys/suit/handlers_global.c b/sys/suit/handlers_global.c index 0ac4f488d71e..2e906e67e7de 100644 --- a/sys/suit/handlers_global.c +++ b/sys/suit/handlers_global.c @@ -76,6 +76,7 @@ static int _seq_no_handler(suit_manifest_t *manifest, int key, } LOG_INFO("suit: validated sequence number\n)"); + manifest->seq_number = seq_nr; manifest->validated |= SUIT_VALIDATED_SEQ_NR; return SUIT_OK; diff --git a/sys/suit/storage/ram.c b/sys/suit/storage/ram.c index af45c6ec3b7e..89a3d41d29b6 100644 --- a/sys/suit/storage/ram.c +++ b/sys/suit/storage/ram.c @@ -120,11 +120,9 @@ static int _ram_finish(suit_storage_t *storage, const suit_manifest_t *manifest) return SUIT_OK; } -static int _ram_install(suit_storage_t *storage, - const suit_manifest_t *manifest) +static int _ram_install(suit_storage_t *storage, const suit_manifest_t *manifest) { - (void)manifest; - (void)storage; + suit_storage_set_seq_no(storage, manifest->seq_number); return SUIT_OK; } diff --git a/tests/suit_manifest/create_test_data.sh b/tests/suit_manifest/create_test_data.sh index eec4245885cc..c0a035a6700b 100644 --- a/tests/suit_manifest/create_test_data.sh +++ b/tests/suit_manifest/create_test_data.sh @@ -47,5 +47,5 @@ gen_manifest "${MANIFEST_DIR}/manifest3.bin".unsigned 2 "${MANIFEST_DIR}/file1.b sign_manifest "${MANIFEST_DIR}/manifest3.bin".unsigned "${MANIFEST_DIR}/manifest3.bin" # valid manifest, valid seqnr, signed, 2 components -gen_manifest "${MANIFEST_DIR}/manifest4.bin".unsigned 2 "${MANIFEST_DIR}/file1.bin:0:ram:0" "${MANIFEST_DIR}/file2.bin:0:ram:1" +gen_manifest "${MANIFEST_DIR}/manifest4.bin".unsigned 3 "${MANIFEST_DIR}/file1.bin:0:ram:0" "${MANIFEST_DIR}/file2.bin:0:ram:1" sign_manifest "${MANIFEST_DIR}/manifest4.bin".unsigned "${MANIFEST_DIR}/manifest4.bin"