From 3a098ea94f50e1e021dbed211de4d750b09aeab1 Mon Sep 17 00:00:00 2001 From: Ken Takayama Date: Tue, 26 Nov 2024 00:15:59 +0000 Subject: [PATCH] add: decode component metadata declarations --- inc/csuit/config.h | 5 +---- inc/csuit/suit_common.h | 4 ++++ inc/csuit/suit_manifest_decode.h | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/inc/csuit/config.h b/inc/csuit/config.h index 0b49ed5..4d24fd4 100644 --- a/inc/csuit/config.h +++ b/inc/csuit/config.h @@ -128,6 +128,7 @@ extern "C" { #define LIBCSUIT_DISABLE_CONDITION_MINIMUM_BATTERY #define LIBCSUIT_DISABLE_CONDITION_UPDATE_AUTHORIZED #define LIBCSUIT_DISABLE_CONDITION_VERSION +#define LIBCSUIT_DISABLE_PARAMETER_COMPONENT_METADATA #endif /* LIBCSUIT_DISABLE_UPDATE_MANAGEMENT */ #if defined(LIBCSUIT_DISABLE_ENCRYPTED_PAYLOAD) @@ -207,10 +208,6 @@ extern "C" { #define LIBCSUIT_DISABLE_DIRECTIVE_WAIT #endif -#if defined(LIBCSUIT_DISABLE_PARAMETER_COMPONENT_METADATA) -#define LIBCSUIT_DISABLE_COMPONENT_METADATA -#endif - #if defined(LIBCSUIT_DISABLE_PARAMETER_SOURCE_COMPONENT) #define LIBCSUIT_DISABLE_DIRECTIVE_COPY #define LIBCSUIT_DISABLE_DIRECTIVE_SWAP diff --git a/inc/csuit/suit_common.h b/inc/csuit/suit_common.h index 1f7bdb0..8ce47a5 100644 --- a/inc/csuit/suit_common.h +++ b/inc/csuit/suit_common.h @@ -366,6 +366,7 @@ typedef enum suit_parameter_key { #define SUIT_PARAMETER_CONTAINS_UPDATE_PRIORITY BIT(SUIT_PARAMETER_UPDATE_PRIORITY) #define SUIT_PARAMETER_CONTAINS_VERSION BIT(SUIT_PARAMETER_VERSION) #define SUIT_PARAMETER_CONTAINS_WAIT_INFO BIT(SUIT_PARAMETER_WAIT_INFO) +#define SUIT_PARAMETER_CONTAINS_COMPONENT_METADATA BIT(SUIT_PARAMETER_COMPONENT_METADATA) /* draft-suit-trust-domains */ #define SUIT_PARAMETER_CONTAINS_ENCRYPTION_INFO BIT(SUIT_PARAMETER_ENCRYPTION_INFO) @@ -1114,6 +1115,9 @@ typedef struct suit_parameter_args { /*! used in suit-directive-wait */ suit_wait_event_t wait_info; + /*! used in suit-directive-fetch, suit-directive-write, ... */ + suit_component_metadata_t component_metadata; + /* in draft-ietf-suit-trust-domains */ diff --git a/inc/csuit/suit_manifest_decode.h b/inc/csuit/suit_manifest_decode.h index 07d7a9a..5898482 100644 --- a/inc/csuit/suit_manifest_decode.h +++ b/inc/csuit/suit_manifest_decode.h @@ -75,8 +75,13 @@ suit_err_t suit_decode_version_match(const suit_buf_t *buf, suit_version_match_t *version_match); suit_err_t suit_decode_wait_event(const suit_buf_t *buf, suit_wait_event_t *wait_event); + suit_err_t suit_decode_component_metadata(const suit_buf_t *buf, suit_component_metadata_t *component_metadata); +suit_err_t suit_decode_component_metadata_from_item(QCBORDecodeContext *context, + QCBORItem *item, + bool next, + suit_component_metadata_t *component_metadata); #ifdef __cplusplus }