36 #include "cose/sign.h" 
   37 #include "nanocbor/nanocbor.h" 
   47 #ifndef SUIT_COSE_BUF_SIZE 
   48 #define SUIT_COSE_BUF_SIZE                  (180U) 
   54 #ifndef CONFIG_SUIT_COMPONENT_MAX 
   55 #define CONFIG_SUIT_COMPONENT_MAX                  (1U) 
   61 #ifndef CONFIG_SUIT_COMPONENT_MAX_NAME_LEN 
   62 #define CONFIG_SUIT_COMPONENT_MAX_NAME_LEN          (32U) 
   71 #define SUIT_VERSION                        (1) 
   82 #define SUIT_STATE_HAVE_COMPONENTS          (1 << 0) 
   87 #define SUIT_STATE_COSE_AUTHENTICATED       (1 << 1) 
   92 #define SUIT_STATE_FULLY_AUTHENTICATED      (1 << 2) 
  158     SUIT_PARAMETER_VENDOR_IDENTIFIER = 1,
 
  159     SUIT_PARAMETER_CLASS_IDENTIFIER  = 2,
 
  160     SUIT_PARAMETER_IMAGE_DIGEST      = 3,
 
  161     SUIT_PARAMETER_USE_BEFORE        = 4,
 
  162     SUIT_PARAMETER_COMPONENT_OFFSET  = 5,
 
  163     SUIT_PARAMETER_STRICT_ORDER      = 12,
 
  164     SUIT_PARAMETER_SOFT_FAILURE      = 13,
 
  165     SUIT_PARAMETER_IMAGE_SIZE        = 14,
 
  166     SUIT_PARAMETER_ENCRYPTION_INFO   = 18,
 
  167     SUIT_PARAMETER_COMPRESSION_INFO  = 19,
 
  168     SUIT_PARAMETER_UNPACK_INFO       = 20,
 
  169     SUIT_PARAMETER_URI               = 21,
 
  170     SUIT_PARAMETER_SOURCE_COMPONENT  = 22,
 
  171     SUIT_PARAMETER_RUN_ARGS          = 23,
 
  172     SUIT_PARAMETER_DEVICE_IDENTIFIER = 24,
 
  173     SUIT_PARAMETER_MINIMUM_BATTERY   = 26,
 
  174     SUIT_PARAMETER_UPDATE_PRIORITY   = 27,
 
  175     SUIT_PARAMETER_VERSION           = 28,
 
  176     SUIT_PARAMETER_WAIT_INFO         = 29,
 
  177     SUIT_PARAMETER_URI_LIST          = 30,
 
  196 #define SUIT_COMPONENT_STATE_FETCHED       (1 << 0)  
  197 #define SUIT_COMPONENT_STATE_FETCH_FAILED  (1 << 1)  
  198 #define SUIT_COMPONENT_STATE_VERIFIED      (1 << 2)  
  199 #define SUIT_COMPONENT_STATE_INSTALLED     (1 << 3)  
  200 #define SUIT_COMPONENT_STATE_FINALIZED     (1 << 4)  
  257 #define SUIT_MANIFEST_COMPONENT_ALL     (UINT8_MAX) 
  264 #define SUIT_MANIFEST_COMPONENT_NONE    (SUIT_MANIFEST_COMPONENT_ALL - 1) 
  300     component->
state |= flag;
 
  314     return (component->
state & flag);
 
  327                                   char separator, 
char *buf, 
size_t buf_len);
 
#define SUIT_COSE_BUF_SIZE
Buffer size used for Cose.
 
#define CONFIG_SUIT_COMPONENT_MAX
Maximum number of components supported in a SUIT manifest.
 
suit_error_t
SUIT error codes.
 
suit_digest_type_t
SUIT payload digest types.
 
int suit_parse(suit_manifest_t *manifest, const uint8_t *buf, size_t len)
Parse a manifest.
 
static void suit_component_set_flag(suit_component_t *component, uint16_t flag)
Set a component flag.
 
bool suit_get_public_key(uint8_t idx, cose_key_t *key)
Get public key accepted by SUIT.
 
suit_digest_t
SUIT payload digest algorithms.
 
int suit_policy_check(suit_manifest_t *manifest)
Check a manifest policy.
 
static bool suit_component_check_flag(suit_component_t *component, uint16_t flag)
Check a component flag.
 
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.
 
@ SUIT_COMPONENT_IDENTIFIER
Identifier component.
 
@ SUIT_COMPONENT_SIZE
Size component.
 
@ SUIT_COMPONENT_DIGEST
Digest component.
 
@ SUIT_ERR_INVALID_MANIFEST
Unexpected CBOR structure detected.
 
@ SUIT_ERR_NO_MEM
Out of memory condition.
 
@ SUIT_ERR_STORAGE_UNAVAILABLE
Backend location not available.
 
@ SUIT_ERR_COND
Conditionals evaluate to false.
 
@ SUIT_ERR_UNSUPPORTED
Unsupported SUIT feature detected.
 
@ SUIT_ERR_DIGEST_MISMATCH
Digest mismatch with COSE and SUIT.
 
@ SUIT_ERR_STORAGE
Backend returned an error.
 
@ SUIT_OK
Manifest parsed and validated.
 
@ SUIT_ERR_NOT_SUPPORTED
Unsupported features detected.
 
@ SUIT_ERR_STORAGE_EXCEEDED
Backend out of space.
 
@ SUIT_ERR_SIGNATURE
Unable to verify signature.
 
@ SUIT_ERR_POLICY_FORBIDDEN
Denied because of policy mismatch.
 
@ SUIT_ERR_SEQUENCE_NUMBER
Sequence number less or equal to current sequence number.
 
@ SUIT_DIGEST_TYPE_CIPHERTEXT
Ciphertext digest.
 
@ SUIT_DIGEST_TYPE_INSTALLED
Installed firmware digest.
 
@ SUIT_DIGEST_TYPE_PREIMAGE
Pre-image digest.
 
@ SUIT_DIGEST_TYPE_RAW
Raw payload digest.
 
@ SUIT_DIGEST_SHA256
SHA256.
 
@ SUIT_DIGEST_NONE
No digest algo supplied.
 
@ SUIT_DIGEST_SHA512
SHA512.
 
@ SUIT_DIGEST_SHA384
SHA384.
 
SUIT component struct as decoded from the manifest.
 
suit_param_ref_t param_size
Payload size.
 
suit_param_ref_t param_class_id
Class ID.
 
suit_param_ref_t param_uri
Payload fetch URI.
 
suit_param_ref_t param_digest
Payload verification digest.
 
suit_storage_ref_t * storage_backend
Storage backend used.
 
suit_param_ref_t param_vendor_id
Vendor ID.
 
suit_param_ref_t identifier
Component identifier.
 
uint16_t state
Component status flags.
 
suit_param_ref_t param_component_offset
Component offset inside the device memory.
 
size_t len
length of the manifest
 
char * urlbuf
Buffer containing the manifest url.
 
uint32_t state
bitfield holding state information
 
const uint8_t * buf
ptr to the buffer of the manifest
 
uint32_t validated
bitfield of validated policies
 
size_t cose_payload_len
length of the COSE payload
 
const uint8_t * cose_payload
ptr to the payload of the COSE sign
 
size_t urlbuf_len
Length of the manifest url.
 
uint32_t seq_number
Set sequence number.
 
uint8_t component_current
Current component index.
 
unsigned components_len
Current number of components.
 
SUIT parameter reference.
 
uint16_t offset
offset to the start of the content
 
Generic storage backend state.