SUIT manifest handling. More...
SUIT manifest handling.
Handler functions for SUIT manifests
Modules | |
SUIT firmware CoAP transport | |
SUIT secure firmware updates over CoAP. | |
SUIT secure firmware OTA mock transport | |
SUIT firmware mock transport. | |
SUIT secure firmware OTA upgrade storage | |
infrastructure | |
Data Structures | |
struct | suit_param_ref_t |
SUIT parameter reference. More... | |
struct | suit_component_t |
SUIT component struct as decoded from the manifest. More... | |
struct | suit_manifest_t |
SUIT manifest struct. More... | |
Macros | |
#define | SUIT_COSE_BUF_SIZE (180U) |
Buffer size used for Cose. | |
#define | CONFIG_SUIT_COMPONENT_MAX (1U) |
Maximum number of components supported in a SUIT manifest. | |
#define | CONFIG_SUIT_COMPONENT_MAX_NAME_LEN (32U) |
Maximum name of component, includes separator. | |
#define | SUIT_VERSION (1) |
Current SUIT serialization format version. More... | |
#define | SUIT_MANIFEST_COMPONENT_ALL (UINT8_MAX) |
Component index representing all components. More... | |
#define | SUIT_MANIFEST_COMPONENT_NONE (SUIT_MANIFEST_COMPONENT_ALL - 1) |
Component index representing no components. More... | |
Typedefs | |
typedef struct suit_storage | suit_storage_ref_t |
Forward declaration for storage struct. More... | |
Enumerations | |
enum | suit_error_t { SUIT_OK = 0, SUIT_ERR_INVALID_MANIFEST = -1, SUIT_ERR_UNSUPPORTED = -2, SUIT_ERR_NOT_SUPPORTED = -3, SUIT_ERR_COND = -4, SUIT_ERR_SEQUENCE_NUMBER = -5, SUIT_ERR_SIGNATURE = -6, SUIT_ERR_DIGEST_MISMATCH = -7, SUIT_ERR_POLICY_FORBIDDEN = -8, SUIT_ERR_NO_MEM = -9, SUIT_ERR_STORAGE = -50, SUIT_ERR_STORAGE_EXCEEDED = -51, SUIT_ERR_STORAGE_UNAVAILABLE = -52 } |
SUIT error codes. More... | |
enum | suit_digest_t { SUIT_DIGEST_NONE = 0, SUIT_DIGEST_SHA256 = 1, SUIT_DIGEST_SHA384 = 2, SUIT_DIGEST_SHA512 = 3 } |
SUIT payload digest algorithms. More... | |
enum | suit_digest_type_t { SUIT_DIGEST_TYPE_RAW = 1, SUIT_DIGEST_TYPE_INSTALLED = 2, SUIT_DIGEST_TYPE_CIPHERTEXT = 3, SUIT_DIGEST_TYPE_PREIMAGE = 4 } |
SUIT payload digest types. More... | |
enum | { SUIT_COMPONENT_IDENTIFIER = 1, SUIT_COMPONENT_SIZE = 2, SUIT_COMPONENT_DIGEST = 3 } |
SUIT component types. More... | |
Functions | |
int | suit_parse (suit_manifest_t *manifest, const uint8_t *buf, size_t len) |
Parse a manifest. More... | |
int | suit_policy_check (suit_manifest_t *manifest) |
Check a manifest policy. More... | |
static void | suit_component_set_flag (suit_component_t *component, uint16_t flag) |
Set a component flag. More... | |
static bool | suit_component_check_flag (suit_component_t *component, uint16_t flag) |
Check a component flag. More... | |
int | suit_component_name_to_string (const suit_manifest_t *manifest, const suit_component_t *component, char separator, char *buf, size_t buf_len) |
Convert a component name to a string. More... | |
int | suit_storage_helper (void *arg, size_t offset, uint8_t *buf, size_t len, int more) |
Helper function for writing bytes on flash a specified offset. More... | |
enum | { SUIT_COND_VENDOR_ID = 1, SUIT_COND_CLASS_ID = 2, SUIT_COND_DEV_ID = 3, SUIT_COND_BEST_BEFORE = 4 } |
SUIT conditionals. | |
void | suit_init_conditions (void) |
Initialize boot-time conditions for SUIT manifests. More... | |
uuid_t * | suit_get_vendor_id (void) |
Retrieve the generated vendor ID. More... | |
uuid_t * | suit_get_class_id (void) |
Retrieve the generated class ID. More... | |
uuid_t * | suit_get_device_id (void) |
Retrieve the generated device ID. More... | |
#define | SUIT_VENDOR_DOMAIN "riot-os.org" |
SUIT conditions. More... | |
#define | SUIT_CLASS_ID RIOT_BOARD |
The SUIT class ID source. More... | |
SUIT manifest status flags | |
#define | SUIT_STATE_HAVE_COMPONENTS (1 << 0) |
Bit flags used to determine if SUIT manifest contains components. | |
#define | SUIT_STATE_COSE_AUTHENTICATED (1 << 1) |
COSE signature OK. | |
#define | SUIT_STATE_FULLY_AUTHENTICATED (1 << 2) |
COSE payload matches SUIT manifest digest. | |
SUIT component flags. | |
These state flags apply to individual components inside a manifest. | |
#define | SUIT_COMPONENT_STATE_FETCHED (1 << 0) |
Component is fetched. | |
#define | SUIT_COMPONENT_STATE_FETCH_FAILED (1 << 1) |
Component fetched but failed. | |
#define | SUIT_COMPONENT_STATE_VERIFIED (1 << 2) |
Component is verified. | |
#define | SUIT_COMPONENT_STATE_FINALIZED (1 << 3) |
Component successfully installed. | |
#define SUIT_CLASS_ID RIOT_BOARD |
The SUIT class ID source.
By default the RIOT_VERSION define is used for this
Definition at line 49 of file conditions.h.
#define SUIT_MANIFEST_COMPONENT_ALL (UINT8_MAX) |
#define SUIT_MANIFEST_COMPONENT_NONE (SUIT_MANIFEST_COMPONENT_ALL - 1) |
#define SUIT_VENDOR_DOMAIN "riot-os.org" |
SUIT conditions.
SUIT conditions API
The SUIT vendor ID source
The basis of the UUID must be the vendor domain, please change this when using this module in a product Device vendor domain
Definition at line 40 of file conditions.h.
#define SUIT_VERSION (1) |
Current SUIT serialization format version.
see https://tools.ietf.org/html/draft-ietf-suit-manifest-03#section-7 for details
typedef struct suit_storage suit_storage_ref_t |
anonymous enum |
SUIT component types.
Unofficial list from suit-manifest-generator
Enumerator | |
---|---|
SUIT_COMPONENT_IDENTIFIER | Identifier component. |
SUIT_COMPONENT_SIZE | Size component. |
SUIT_COMPONENT_DIGEST | Digest component. |
enum suit_digest_t |
SUIT payload digest algorithms.
Unofficial list from suit-manifest-generator
Enumerator | |
---|---|
SUIT_DIGEST_NONE | No digest algo supplied. |
SUIT_DIGEST_SHA256 | SHA256. |
SUIT_DIGEST_SHA384 | SHA384. |
SUIT_DIGEST_SHA512 | SHA512. |
enum suit_digest_type_t |
SUIT payload digest types.
Unofficial list from suit-manifest-generator
Enumerator | |
---|---|
SUIT_DIGEST_TYPE_RAW | Raw payload digest. |
SUIT_DIGEST_TYPE_INSTALLED | Installed firmware digest. |
SUIT_DIGEST_TYPE_CIPHERTEXT | Ciphertext digest. |
SUIT_DIGEST_TYPE_PREIMAGE | Pre-image digest. |
enum suit_error_t |
SUIT error codes.
|
inlinestatic |
int suit_component_name_to_string | ( | const suit_manifest_t * | manifest, |
const suit_component_t * | component, | ||
char | separator, | ||
char * | buf, | ||
size_t | buf_len | ||
) |
Convert a component name to a string.
Each component part is prefixed with separator
|
inlinestatic |
uuid_t* suit_get_class_id | ( | void | ) |
Retrieve the generated class ID.
uuid_t* suit_get_device_id | ( | void | ) |
Retrieve the generated device ID.
uuid_t* suit_get_vendor_id | ( | void | ) |
Retrieve the generated vendor ID.
void suit_init_conditions | ( | void | ) |
Initialize boot-time conditions for SUIT manifests.
This initializes the device-based conditions for validating manifest preconditions
Vendor url as UUID: UUID5(DNS_PREFIX, SUIT_VENDOR_DOMAIN) Device class UUID: UUID5(vendor, SUIT_CLASS_ID) Device specific UUID: UUID5(vendor, Device ID)
int suit_parse | ( | suit_manifest_t * | manifest, |
const uint8_t * | buf, | ||
size_t | len | ||
) |
Parse a manifest.
manifest
is used[in] | manifest | manifest context to store information in |
[in] | buf | buffer to parse the manifest from |
[in] | len | length of the manifest data in the buffer |
int suit_policy_check | ( | suit_manifest_t * | manifest | ) |
Check a manifest policy.
[in] | manifest | manifest context to check the policy for |
int suit_storage_helper | ( | void * | arg, |
size_t | offset, | ||
uint8_t * | buf, | ||
size_t | len, | ||
int | more | ||
) |
Helper function for writing bytes on flash a specified offset.
[in] | arg | ptr to the SUIT manifest |
[in] | offset | offset to write to on flash |
[in] | buf | bytes to write |
[in] | len | length of bytes to write |
[in] | more | whether more data is coming |