2020-02-26 14:48:24 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Freie Universität Berlin
|
|
|
|
* Copyright (C) 2019 Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
* 2020 Inria
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @ingroup sys_suit
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
2020-02-26 14:49:35 +01:00
|
|
|
* @brief SUIT secure OTA firmware upgrade implementation for
|
2020-02-26 14:48:24 +01:00
|
|
|
* CBOR based manifests
|
|
|
|
*
|
|
|
|
* @author Koen Zandberg <koen@bergzand.net>
|
|
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
*
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <nanocbor/nanocbor.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
#include "suit/handlers.h"
|
|
|
|
#include "suit/policy.h"
|
|
|
|
#include "suit.h"
|
|
|
|
|
2020-10-22 11:35:22 +02:00
|
|
|
#define ENABLE_DEBUG 0
|
2020-02-26 14:48:24 +01:00
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
int suit_parse(suit_manifest_t *manifest, const uint8_t *buf,
|
|
|
|
size_t len)
|
|
|
|
{
|
|
|
|
nanocbor_value_t it;
|
|
|
|
|
|
|
|
manifest->buf = buf;
|
|
|
|
manifest->len = len;
|
|
|
|
nanocbor_decoder_init(&it, buf, len);
|
2020-03-23 10:07:28 +01:00
|
|
|
LOG_DEBUG("Starting envelope sequence handler\n");
|
2020-02-26 14:48:24 +01:00
|
|
|
return suit_handle_manifest_structure(manifest, &it,
|
2020-03-23 10:07:28 +01:00
|
|
|
suit_envelope_handlers,
|
|
|
|
suit_envelope_handlers_len);
|
2020-02-26 14:48:24 +01:00
|
|
|
}
|