Skip to content

Commit

Permalink
add: U2 and U3 exmaples
Browse files Browse the repository at this point in the history
  • Loading branch information
kentakayama committed Nov 22, 2024
1 parent ff92f36 commit c43d437
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile.parser
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ $(TARGET): $(OBJS) | ./bin
./obj/%.o: %.c | ./obj/src ./obj/examples
$(CC) $(CFLAGS) $(INC) -o $@ -c $<

TEST_NUM := 0 1 2A 2B 3 4 5 U I D AF AW EW ED S0 S2 S3 S4 U0 U1
TEST_NUM := 0 1 2A 2B 3 4 5 U I D AF AW EW ED S0 S2 S3 S4 U0 U1 U2 U3
EXPS := $(foreach num,$(TEST_NUM),./testfiles/suit_manifest_exp$(num).cbor)
define test-one
$(TARGET) $1 2 || exit 1
Expand Down
Binary file added testfiles/suit_manifest_expU2.cbor
Binary file not shown.
80 changes: 80 additions & 0 deletions testfiles/suit_manifest_expU2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!--
Copyright (c) 2020-2024 SECOM CO., LTD. All Rights reserved.
SPDX-License-Identifier: BSD-2-Clause
-->

## Example 2: Wait and Condition Example
{: numbered='no'}

### CBOR Diagnostic Notation of SUIT Manifest
{: numbered='no'}
NOTE: only SUIT_Manifest part is displayed here.

~~~~
<< {
e'suit-manifest-version': 1,
e'suit-manifest-sequence-number': 0,
e'suit-common': << {
e'suit-components': [
['00']
],
e'suit-shared-sequence': << [
e'suit-directive-override-parameters', {
e'suit-parameter-vendor-identifier': h'fa6b4a53d5ad5fdfbe9de663e4d41ffe',
e'suit-parameter-class-identifier': h'1492af1425695e48bf429b2d51f2ab45',
e'suit-parameter-image-digest': << [
/ algorithm-id: / e'cose-alg-sha-256',
/ digest-bytes: / ref'update.digest.hdiag'
] >>,
e'suit-parameter-image-size': ref'update.size.gdiag',
e'suit-parameter-version': << [
/ comparison-type: / e'suit-condition-version-comparison-lesser',
/ comparison-value: / [1, 0, 0]
] >>
},
e'suit-condition-version', 15,
e'suit-condition-vendor-identifier', 15,
e'suit-condition-class-identifier', 15
] >>
} >>,
e'suit-validate': << [
e'suit-directive-override-parameters', {
e'suit-parameter-use-before': dt'2016-06-14T23:59:59Z'
},
e'suit-condition-image-match', 15
] >>,
e'suit-payload-fetch': << [
e'suit-directive-override-parameters', {
e'suit-parameter-uri': "http://example.com/file.bin",
e'suit-parameter-minimum-battery': 20,
e'suit-parameter-update-priority': -1 / e.g. security update /,
e'suit-parameter-wait-info': << {
e'suit-wait-event-power': 1 / e.g. external power available /
} >>
},
e'suit-directive-wait', 0,
e'suit-condition-minimum-battery', 15,
e'suit-directive-fetch', 2,
e'suit-condition-image-match', 15
] >>
} >>
~~~~


### CBOR Binary in Hex
{: numbered='no'}

~~~~
D86BA2025873825824822F58209912DA952ED385D127F12671CFFBC56F05
1F396C5BDF0A9561E7C3D2671D784A584AD28443A10126A0F65840E6925F
435FB3DDCEC8B7C3C9DF2D6F67C5CC225AE6C260F4D4B0111D14E449A8FD
02F6FF628BCF449AC419B102239FF9EC1926CAAECCC32F69FFF1F1A184A7
4B0358BAA50101020003586BA20281814230300458618814A50150FA6B4A
53D5AD5FDFBE9DE663E4D41FFE02501492AF1425695E48BF429B2D51F2AB
45035824822F582036921488FE6680712F734E11F58D87EEB66D4B21A8A1
AD3441060814DA16D50F0E181E181C46820583010000181C0F010F020F07
4B8414A1041A57609A7F030F1058378A14A415781B687474703A2F2F6578
616D706C652E636F6D2F66696C652E62696E181A14181B20181D43A10201
181D00181A0F1502030F
~~~~
Binary file added testfiles/suit_manifest_expU3.cbor
Binary file not shown.
101 changes: 101 additions & 0 deletions testfiles/suit_manifest_expU3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<!--
Copyright (c) 2020-2024 SECOM CO., LTD. All Rights reserved.
SPDX-License-Identifier: BSD-2-Clause
-->

## Example 3: Component Metadata Example
{: numbered='no'}

### CBOR Diagnostic Notation of SUIT Manifest
{: numbered='no'}
NOTE: only SUIT_Manifest part is displayed here.

~~~~
<< {
e'suit-manifest-version': 1,
e'suit-manifest-sequence-number': 0,
e'suit-common': << {
e'suit-components': [
['usr', 'bin', 'example'],
['usr', 'local', 'bin'],
['usr', 'local', 'bin', 'example3']
],
e'suit-shared-sequence': << [
e'suit-directive-override-parameters', {
e'suit-parameter-vendor-identifier': h'fa6b4a53d5ad5fdfbe9de663e4d41ffe',
e'suit-parameter-class-identifier': h'1492af1425695e48bf429b2d51f2ab45',
e'suit-parameter-image-digest': << [
/ algorithm-id: / e'cose-alg-sha-256',
/ digest-bytes: / ref'comp-meta.digest.hdiag'
] >>,
e'suit-parameter-image-size': ref'comp-meta.size.gdiag'
}
] >>
} >>,
e'suit-payload-fetch': << [
/ create a directory /
e'suit-directive-set-component-index',
1 / ['usr', 'local', 'bin'] /,
e'suit-directive-override-parameters', {
e'suit-parameter-content': h'',
e'suit-parameter-component-metadata': << {
e'suit-meta-file-type': e'suit-filetype-directory'
} >>
},
e'suit-directive-write', 2,
/ fetch the binary /
e'suit-directive-set-component-index',
2 / ['usr', 'local', 'bin', 'example3'] /,
e'suit-directive-override-parameters', {
e'suit-parameter-uri': "https://cdn.example/example3.bin",
e'suit-parameter-component-metadata': << {
e'suit-meta-default-permissions': 0b100 / r-- /,
e'suit-meta-user-permissions': {
/ default user / 1000: 0b110 / rw- /
},
e'suit-meta-group-permissions': {
/ default group / 1000: 0b100 / r-- /
},
e'suit-meta-file-type': e'suit-filetype-regular'
} >>
},
e'suit-directive-fetch', 2,
e'suit-condition-image-match', 15
] >>,
e'suit-install': << [
/ create a symbolic link /
e'suit-directive-set-component-index',
0 / ['usr', 'bin', 'example'] /,
e'suit-directive-override-parameters', {
e'suit-parameter-content': '/usr/local/bin/example3',
e'suit-parameter-component-metadata': << {
e'suit-meta-file-type': e'suit-filetype-symlink'
} >>
},
e'suit-directive-write', 2
] >>
} >>
~~~~


### CBOR Binary in Hex
{: numbered='no'}

~~~~
D86BA2025873825824822F5820E2BADD1F63BB70B4787ABC1232EBDD5F4E
A4839715A9BEC2D05287BDBF8092BC584AD28443A10126A0F65840C7EEE2
A92BA437C16F89DF644C5653A76B63E534DE7B8BCBAD85DD315DBBE59FA5
89A09E4066D1C3C53593C7A5BFC750024D3A4625B68162C0BDFECE6B8DBC
E103590111A50101020003588FA2028383437573724362696E476578616D
706C658343757372456C6F63616C4362696E8443757372456C6F63616C43
62696E486578616D706C65330458518214A40150FA6B4A53D5AD5FDFBE9D
E663E4D41FFE02501492AF1425695E48BF429B2D51F2AB45035824822F58
2036921488FE6680712F734E11F58D87EEB66D4B21A8A1AD3441060814DA
16D50F0E181E10584E8E0C0114A21240181E43A1050212020C0214A21578
2068747470733A2F2F63646E2E6578616D706C652F6578616D706C65332E
62696E181E51A4010402A11903E80603A11903E80405011502030F145826
860C0014A212572F7573722F6C6F63616C2F62696E2F6578616D706C6533
181E43A105031202
~~~~

0 comments on commit c43d437

Please sign in to comment.