mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-29 00:11:16 +01:00
tests/suit_manifest: Adapt to mock transport and ram storage
This commit is contained in:
parent
b72d510690
commit
17a676d0c5
@ -1,6 +1,7 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += suit
|
||||
USEMODULE += suit suit_storage_ram
|
||||
USEMODULE += suit_transport_mock
|
||||
USEMODULE += riotboot_hdr
|
||||
USEMODULE += embunit
|
||||
|
||||
@ -19,7 +20,8 @@ BLOBS += $(MANIFEST_DIR)/manifest2.bin
|
||||
BLOBS += $(MANIFEST_DIR)/manifest3.bin
|
||||
BLOBS += $(MANIFEST_DIR)/manifest4.bin
|
||||
|
||||
USEMODULE += suit_transport_mock
|
||||
BLOBS += $(MANIFEST_DIR)/file1.bin
|
||||
BLOBS += $(MANIFEST_DIR)/file2.bin
|
||||
|
||||
CFLAGS += -DCONFIG_SUIT_COMPONENT_MAX=2
|
||||
|
||||
|
||||
@ -39,13 +39,13 @@ gen_manifest "${MANIFEST_DIR}/manifest0.bin" 1 "${MANIFEST_DIR}/file1.bin:$((0x1
|
||||
# manifest with invalid seqnr
|
||||
sign_manifest "${MANIFEST_DIR}/manifest0.bin" "${MANIFEST_DIR}/manifest1.bin"
|
||||
|
||||
(BOARD=invalid gen_manifest "${MANIFEST_DIR}/manifest2.bin".unsigned 2 "${MANIFEST_DIR}/file1.bin:$((0x1000))" "${MANIFEST_DIR}/file2.bin:$((0x2000))")
|
||||
(BOARD=invalid gen_manifest "${MANIFEST_DIR}/manifest2.bin".unsigned 2 "${MANIFEST_DIR}/file1.bin:$((0x1000)):ram:0" "${MANIFEST_DIR}/file2.bin:$((0x2000)):ram:0")
|
||||
sign_manifest "${MANIFEST_DIR}/manifest2.bin".unsigned "${MANIFEST_DIR}/manifest2.bin"
|
||||
|
||||
# valid manifest, valid seqnr, signed
|
||||
gen_manifest "${MANIFEST_DIR}/manifest3.bin".unsigned 2 "${MANIFEST_DIR}/file1.bin:$((0x1000))" "${MANIFEST_DIR}/file2.bin:$((0x2000))"
|
||||
gen_manifest "${MANIFEST_DIR}/manifest3.bin".unsigned 2 "${MANIFEST_DIR}/file1.bin:0:ram:0"
|
||||
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" "${MANIFEST_DIR}/file2.bin"
|
||||
gen_manifest "${MANIFEST_DIR}/manifest4.bin".unsigned 2 "${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"
|
||||
|
||||
@ -36,6 +36,14 @@ static inline int riotboot_flashwrite_init(riotboot_flashwrite_t *state,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline riotboot_flashwrite_verify_sha256(digest,
|
||||
img_size,
|
||||
target_slot) {
|
||||
(void)digest;
|
||||
(void)img_size;
|
||||
(void)target_slot;
|
||||
return 0;
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -22,6 +22,8 @@
|
||||
#include "log.h"
|
||||
|
||||
#include "suit.h"
|
||||
#include "suit/storage.h"
|
||||
#include "suit/transport/mock.h"
|
||||
#include "embUnit.h"
|
||||
|
||||
#define TEST_MANIFEST_INCLUDE(file) <blob/bin/BOARD_NAME_UNQ/manifests/file>
|
||||
@ -34,6 +36,8 @@
|
||||
#include TEST_MANIFEST_INCLUDE(manifest3.bin.h)
|
||||
#include TEST_MANIFEST_INCLUDE(manifest4.bin.h)
|
||||
|
||||
#include TEST_MANIFEST_INCLUDE(file1.bin.h)
|
||||
#include TEST_MANIFEST_INCLUDE(file2.bin.h)
|
||||
#define SUIT_URL_MAX 128
|
||||
|
||||
typedef struct {
|
||||
@ -53,17 +57,28 @@ const manifest_blob_t manifest_blobs[] = {
|
||||
|
||||
const unsigned manifest_blobs_numof = ARRAY_SIZE(manifest_blobs);
|
||||
|
||||
const suit_transport_mock_payload_t payloads[] = {
|
||||
{
|
||||
.buf = file1_bin,
|
||||
.len = sizeof(file1_bin),
|
||||
},
|
||||
{
|
||||
.buf = file2_bin,
|
||||
.len = sizeof(file2_bin),
|
||||
}
|
||||
};
|
||||
|
||||
const size_t num_payloads = ARRAY_SIZE(payloads);
|
||||
|
||||
static int test_suit_manifest(const unsigned char *manifest_bin,
|
||||
size_t manifest_bin_len)
|
||||
{
|
||||
char _url[SUIT_URL_MAX];
|
||||
suit_manifest_t manifest;
|
||||
riotboot_flashwrite_t writer;
|
||||
|
||||
|
||||
memset(&manifest, 0, sizeof(manifest));
|
||||
memset(&writer, 0, sizeof(writer));
|
||||
|
||||
manifest.writer = &writer;
|
||||
manifest.urlbuf = _url;
|
||||
manifest.urlbuf_len = SUIT_URL_MAX;
|
||||
|
||||
@ -79,6 +94,7 @@ static int test_suit_manifest(const unsigned char *manifest_bin,
|
||||
|
||||
static void test_suit_manifest_01_manifests(void)
|
||||
{
|
||||
suit_storage_set_seq_no_all(1);
|
||||
for (unsigned i = 0; i < manifest_blobs_numof; i++) {
|
||||
printf("\n--- testing manifest %u\n", i);
|
||||
int res = \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user