-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuit-mainfest.cddl
267 lines (216 loc) · 8.11 KB
/
suit-mainfest.cddl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
;refer to A Concise Binary Object Representation (CBOR)-based Serialization Format for the Software Updates for Internet of Things (SUIT) Manifest
SUIT_Envelope_Tagged = #6.107(SUIT_Envelope)
SUIT_Envelope = {
? suit-delegation => bstr .cbor SUIT_Delegation,
suit-authentication-wrapper => bstr .cbor SUIT_Authentication,
suit-manifest => bstr .cbor SUIT_Manifest,
SUIT_Severable_Manifest_Members,
* SUIT_Integrated_Payload,
* $$SUIT_Envelope_Extensions,
* (int => bstr)
}
SUIT_Authentication = [
bstr .cbor SUIT_Digest,
* bstr .cbor SUIT_Authentication_Block
]
SUIT_Digest = [
suit-digest-algorithm-id : suit-cose-hash-algs,
suit-digest-bytes : bstr,
* $$SUIT_Digest-extensions
]
SUIT_Authentication_Block /= COSE_Mac_Tagged
SUIT_Authentication_Block /= COSE_Sign_Tagged
SUIT_Authentication_Block /= COSE_Mac0_Tagged
SUIT_Authentication_Block /= COSE_Sign1_Tagged
SUIT_Severable_Manifest_Members = (
? suit-payload-fetch => bstr .cbor SUIT_Command_Sequence,
? suit-install => bstr .cbor SUIT_Command_Sequence,
? suit-text => bstr .cbor SUIT_Text_Map,
* $$SUIT_severable-members-extensions,
)
SUIT_Integrated_Payload = (suit-integrated-payload-key => bstr)
suit-integrated-payload-key = tstr
SUIT_Manifest_Tagged = #6.1070(SUIT_Manifest)
SUIT_Manifest = {
suit-manifest-version => 1,
suit-manifest-sequence-number => uint,
suit-common => bstr .cbor SUIT_Common,
? suit-reference-uri => tstr,
SUIT_Severable_Members_Choice,
SUIT_Unseverable_Members,
* $$SUIT_Manifest_Extensions,
}
SUIT_Unseverable_Members = (
? suit-validate => bstr .cbor SUIT_Command_Sequence,
? suit-load => bstr .cbor SUIT_Command_Sequence,
? suit-run => bstr .cbor SUIT_Command_Sequence,
* $$unseverable-manifest-member-extensions,
)
SUIT_Severable_Members_Choice = (
? suit-payload-fetch => \
bstr .cbor SUIT_Command_Sequence / SUIT_Digest,
? suit-install => bstr .cbor SUIT_Command_Sequence / SUIT_Digest,
? suit-text => bstr .cbor SUIT_Command_Sequence / SUIT_Digest,
* $$severable-manifest-members-choice-extensions
)
SUIT_Common = {
? suit-components => SUIT_Components,
? suit-common-sequence => bstr .cbor SUIT_Common_Sequence,
* $$SUIT_Common-extensions,
}
SUIT_Components = [ + SUIT_Component_Identifier ]
SUIT_Dependency = {
suit-dependency-digest => SUIT_Digest,
? suit-dependency-prefix => SUIT_Component_Identifier,
* $$SUIT_Dependency-extensions,
}
;REQUIRED to implement:
suit-cose-hash-algs /= cose-alg-sha-256
;OPTIONAL to implement:
suit-cose-hash-algs /= cose-alg-shake128
suit-cose-hash-algs /= cose-alg-sha-384
suit-cose-hash-algs /= cose-alg-sha-512
suit-cose-hash-algs /= cose-alg-shake256
SUIT_Component_Identifier = [* bstr]
SUIT_Common_Sequence = [
+ ( SUIT_Condition // SUIT_Common_Commands )
]
SUIT_Common_Commands //= (suit-directive-set-component-index, IndexArg)
SUIT_Common_Commands //= (suit-directive-run-sequence,
bstr .cbor SUIT_Command_Sequence)
SUIT_Common_Commands //= (suit-directive-try-each,
SUIT_Directive_Try_Each_Argument)
SUIT_Common_Commands //= (suit-directive-override-parameters,
{+ SUIT_Parameters})
IndexArg /= uint
IndexArg /= bool
IndexArg /= [+uint]
SUIT_Command_Sequence = [ + (
SUIT_Condition // SUIT_Directive // SUIT_Command_Custom
) ]
SUIT_Command_Custom = (suit-command-custom, bstr/tstr/int/nil)
SUIT_Condition //= (suit-condition-vendor-identifier, SUIT_Rep_Policy)
SUIT_Condition //= (suit-condition-class-identifier, SUIT_Rep_Policy)
SUIT_Condition //= (suit-condition-device-identifier, SUIT_Rep_Policy)
SUIT_Condition //= (suit-condition-image-match, SUIT_Rep_Policy)
SUIT_Condition //= (suit-condition-component-slot, SUIT_Rep_Policy)
SUIT_Condition //= (suit-condition-abort, SUIT_Rep_Policy)
SUIT_Directive //= (suit-directive-set-component-index, IndexArg)
SUIT_Directive //= (suit-directive-run-sequence,
bstr .cbor SUIT_Command_Sequence)
SUIT_Directive //= (suit-directive-try-each,
SUIT_Directive_Try_Each_Argument)
SUIT_Directive //= (suit-directive-process-dependency, SUIT_Rep_Policy)
SUIT_Directive //= (suit-directive-override-parameters,
{+ SUIT_Parameters})
SUIT_Directive //= (suit-directive-fetch, SUIT_Rep_Policy)
SUIT_Directive //= (suit-directive-copy, SUIT_Rep_Policy)
SUIT_Directive //= (suit-directive-swap, SUIT_Rep_Policy)
SUIT_Directive //= (suit-directive-run, SUIT_Rep_Policy)
SUIT_Directive_Try_Each_Argument = [
2* bstr .cbor SUIT_Command_Sequence,
?nil
]
SUIT_Rep_Policy = uint .bits suit-reporting-bits
suit-reporting-bits = &(
suit-send-record-success : 0,
suit-send-record-failure : 1,
suit-send-sysinfo-success : 2,
suit-send-sysinfo-failure : 3
)
SUIT_Parameters //= (suit-parameter-vendor-identifier =>
(RFC4122_UUID / cbor-pen))
cbor-pen = #6.112(bstr)
SUIT_Parameters //= (suit-parameter-class-identifier => RFC4122_UUID)
SUIT_Parameters //= (suit-parameter-image-digest
=> bstr .cbor SUIT_Digest)
SUIT_Parameters //= (suit-parameter-image-size => uint)
SUIT_Parameters //= (suit-parameter-component-slot => uint)
SUIT_Parameters //= (suit-parameter-uri => tstr)
SUIT_Parameters //= (suit-parameter-source-component => uint)
SUIT_Parameters //= (suit-parameter-run-args => bstr)
SUIT_Parameters //= (suit-parameter-device-identifier => RFC4122_UUID)
SUIT_Parameters //= (suit-parameter-custom => int/bool/tstr/bstr)
SUIT_Parameters //= (suit-parameter-strict-order => bool)
SUIT_Parameters //= (suit-parameter-soft-failure => bool)
RFC4122_UUID = bstr .size 16
SUIT_Text_Map = {
SUIT_Text_Keys,
* SUIT_Component_Identifier => {
SUIT_Text_Component_Keys
}
}
SUIT_Text_Component_Keys = (
? suit-text-vendor-name => tstr,
? suit-text-model-name => tstr,
? suit-text-vendor-domain => tstr,
? suit-text-model-info => tstr,
? suit-text-component-description => tstr,
? suit-text-component-version => tstr,
* $$suit-text-component-key-extensions
)
SUIT_Text_Keys = (
? suit-text-manifest-description => tstr,
? suit-text-update-description => tstr,
? suit-text-manifest-json-source => tstr,
? suit-text-manifest-yaml-source => tstr,
* $$suit-text-key-extensions
)
suit-authentication-wrapper = 2
suit-manifest = 3
;REQUIRED to implement:
cose-alg-sha-256 = -16
;OPTIONAL to implement:
cose-alg-shake128 = -18
cose-alg-sha-384 = -43
cose-alg-sha-512 = -44
cose-alg-shake256 = -45
suit-manifest-version = 1
suit-manifest-sequence-number = 2
suit-common = 3
suit-reference-uri = 4
suit-payload-fetch = 8
suit-install = 9
suit-validate = 10
suit-load = 11
suit-run = 12
suit-text = 13
suit-components = 2
suit-common-sequence = 4
suit-command-custom = nint
suit-condition-vendor-identifier = 1
suit-condition-class-identifier = 2
suit-condition-image-match = 3
suit-condition-component-slot = 5
suit-condition-abort = 14
suit-condition-device-identifier = 24
suit-directive-set-component-index = 12
suit-directive-try-each = 15
suit-directive-override-parameters = 20
suit-directive-fetch = 21
suit-directive-copy = 22
suit-directive-run = 23
suit-directive-swap = 31
suit-directive-run-sequence = 32
suit-parameter-vendor-identifier = 1
suit-parameter-class-identifier = 2
suit-parameter-image-digest = 3
suit-parameter-component-slot = 5
suit-parameter-strict-order = 12
suit-parameter-soft-failure = 13
suit-parameter-image-size = 14
suit-parameter-uri = 21
suit-parameter-source-component = 22
suit-parameter-run-args = 23
suit-parameter-device-identifier = 24
suit-parameter-custom = nint
suit-text-manifest-description = 1
suit-text-update-description = 2
suit-text-manifest-json-source = 3
suit-text-manifest-yaml-source = 4
suit-text-vendor-name = 1
suit-text-model-name = 2
suit-text-vendor-domain = 3
suit-text-model-info = 4
suit-text-component-description = 5
suit-text-component-version = 6