From c43d437433c1276ac31c3b29866b2e0de2e5ddbe Mon Sep 17 00:00:00 2001 From: Ken Takayama Date: Fri, 22 Nov 2024 04:55:50 +0000 Subject: [PATCH] add: U2 and U3 exmaples --- Makefile.parser | 2 +- testfiles/suit_manifest_expU2.cbor | Bin 0 -> 310 bytes testfiles/suit_manifest_expU2.md | 80 +++++++++++++++++++++++ testfiles/suit_manifest_expU3.cbor | Bin 0 -> 398 bytes testfiles/suit_manifest_expU3.md | 101 +++++++++++++++++++++++++++++ 5 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 testfiles/suit_manifest_expU2.cbor create mode 100644 testfiles/suit_manifest_expU2.md create mode 100644 testfiles/suit_manifest_expU3.cbor create mode 100644 testfiles/suit_manifest_expU3.md diff --git a/Makefile.parser b/Makefile.parser index 1cc811b..d151dbc 100644 --- a/Makefile.parser +++ b/Makefile.parser @@ -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 diff --git a/testfiles/suit_manifest_expU2.cbor b/testfiles/suit_manifest_expU2.cbor new file mode 100644 index 0000000000000000000000000000000000000000..b3b1982379857c17bd60e514b218ca77a6034a63 GIT binary patch literal 310 zcmV-60m=T@YoY>JbAnhTf-hJgnG)KSF4Kk4C-Ek6&-=x11s^$VTi*(mVdulrXB~J- zSW41_L!kjCp!Qfm=8|7SU$foL$hX7E-z{%v#mpjF=E7j~)UXj96y!;${Q~y?VvEm2 zn#38g0wbUK>=`D?uFS(PY5(!@p@gSP16aDH0RaL416XUK0)c@-FfasIVTcr^0Z{sD zN>kOXU*Eo+=40g4AN~SR6q2tLC23wrze1ZWQSz%r16U-2FIXTpk`##kW`J=ob50TU zjfd{GZA&4jp{+DQ1_%_|7S#_97#4UKVrgy|8Wb2CAQ&A(p#lLI9RL^_ I4;2Cf51H$F_W%F@ literal 0 HcmV?d00001 diff --git a/testfiles/suit_manifest_expU2.md b/testfiles/suit_manifest_expU2.md new file mode 100644 index 0000000..ab1ee57 --- /dev/null +++ b/testfiles/suit_manifest_expU2.md @@ -0,0 +1,80 @@ + + +## 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 +~~~~ diff --git a/testfiles/suit_manifest_expU3.cbor b/testfiles/suit_manifest_expU3.cbor new file mode 100644 index 0000000000000000000000000000000000000000..1b8e7ae9e263817e37ce65a4d439625acb7fbe04 GIT binary patch literal 398 zcmcbSy@)BIxG6%VNk2m2(XPAl$-4`-R8;K|GJ1VC-fv0sbkUXj4qXUp-@CtI(w+#f zOD)a|8Pyhii*Pvp?$Ju^CFTe7JMX9Xgat3pPJU`~ue$s6+Sa>FXz_1H<)!zR(AIN*|~mt{H3(vk(&iz<{0w literal 0 HcmV?d00001 diff --git a/testfiles/suit_manifest_expU3.md b/testfiles/suit_manifest_expU3.md new file mode 100644 index 0000000..039646f --- /dev/null +++ b/testfiles/suit_manifest_expU3.md @@ -0,0 +1,101 @@ + + +## 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 +~~~~