Skip to content

Commit

Permalink
Merge pull request #17939 from fjmolinas/pr_suit_manifest_ram_seq_no
Browse files Browse the repository at this point in the history
sys/suit: save seq_number when parsing manifest
  • Loading branch information
benpicco authored Apr 15, 2022
2 parents 0a83d5e + ebf0992 commit c610b1f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions sys/include/suit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
1 change: 1 addition & 0 deletions sys/suit/handlers_global.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 2 additions & 4 deletions sys/suit/storage/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/suit_manifest/create_test_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit c610b1f

Please sign in to comment.