1 #include "manifest12_decode.h"
2 #include "main_entry.h"
3
fuzz_one_input(const uint8_t * data,size_t size)4 bool fuzz_one_input(const uint8_t *data, size_t size)
5 {
6 size_t payload_len_out = 0;
7 struct SUIT_Envelope result;
8 struct SUIT_Envelope result2;
9 struct SUIT_Command_Sequence command_seq;
10
11 bool ret = cbor_decode_SUIT_Envelope_Tagged(data, size,
12 &result,
13 &payload_len_out);
14 if (!ret) {
15 return ret;
16 }
17
18 for (int i = 0; i < result.SUIT_Envelope_suit_integrated_dependency_key_count; i++) {
19 ret = cbor_decode_SUIT_Envelope(
20 result.SUIT_Envelope_suit_integrated_dependency_key[i].SUIT_Envelope_suit_integrated_dependency_key.value,
21 result.SUIT_Envelope_suit_integrated_dependency_key[i].SUIT_Envelope_suit_integrated_dependency_key.len,
22 &result2, &payload_len_out);
23 if (!ret) {
24 return ret;
25 }
26 }
27
28 if (result.SUIT_Envelope_suit_manifest_cbor
29 .SUIT_Manifest_SUIT_Severable_Manifest_Members_m
30 .SUIT_Severable_Manifest_Members_suit_dependency_resolution_present) {
31 ret = cbor_decode_SUIT_Command_Sequence(
32 result.SUIT_Envelope_suit_manifest_cbor
33 .SUIT_Manifest_SUIT_Severable_Manifest_Members_m
34 .SUIT_Severable_Manifest_Members_suit_dependency_resolution
35 .SUIT_Severable_Manifest_Members_suit_dependency_resolution.value,
36 result.SUIT_Envelope_suit_manifest_cbor
37 .SUIT_Manifest_SUIT_Severable_Manifest_Members_m
38 .SUIT_Severable_Manifest_Members_suit_dependency_resolution
39 .SUIT_Severable_Manifest_Members_suit_dependency_resolution.len,
40 &command_seq, &payload_len_out);
41 if (!ret) {
42 return ret;
43 }
44 }
45
46 if (result.SUIT_Envelope_suit_manifest_cbor
47 .SUIT_Manifest_SUIT_Severable_Manifest_Members_m
48 .SUIT_Severable_Manifest_Members_suit_payload_fetch_present) {
49 ret = cbor_decode_SUIT_Command_Sequence(
50 result.SUIT_Envelope_suit_manifest_cbor
51 .SUIT_Manifest_SUIT_Severable_Manifest_Members_m
52 .SUIT_Severable_Manifest_Members_suit_payload_fetch
53 .SUIT_Severable_Manifest_Members_suit_payload_fetch.value,
54 result.SUIT_Envelope_suit_manifest_cbor
55 .SUIT_Manifest_SUIT_Severable_Manifest_Members_m
56 .SUIT_Severable_Manifest_Members_suit_payload_fetch
57 .SUIT_Severable_Manifest_Members_suit_payload_fetch.len,
58 &command_seq, &payload_len_out);
59 if (!ret) {
60 return ret;
61 }
62 }
63
64 if (result.SUIT_Envelope_suit_manifest_cbor
65 .SUIT_Manifest_SUIT_Severable_Manifest_Members_m
66 .SUIT_Severable_Manifest_Members_suit_install_present) {
67 ret = cbor_decode_SUIT_Command_Sequence(
68 result.SUIT_Envelope_suit_manifest_cbor
69 .SUIT_Manifest_SUIT_Severable_Manifest_Members_m
70 .SUIT_Severable_Manifest_Members_suit_install
71 .SUIT_Severable_Manifest_Members_suit_install.value,
72 result.SUIT_Envelope_suit_manifest_cbor
73 .SUIT_Manifest_SUIT_Severable_Manifest_Members_m
74 .SUIT_Severable_Manifest_Members_suit_install
75 .SUIT_Severable_Manifest_Members_suit_install.len,
76 &command_seq, &payload_len_out);
77 if (!ret) {
78 return ret;
79 }
80 }
81
82 if (result.SUIT_Envelope_suit_manifest_cbor
83 .SUIT_Manifest_SUIT_Unseverable_Members_m
84 .SUIT_Unseverable_Members_suit_validate_present) {
85 ret = cbor_decode_SUIT_Command_Sequence(
86 result.SUIT_Envelope_suit_manifest_cbor
87 .SUIT_Manifest_SUIT_Unseverable_Members_m
88 .SUIT_Unseverable_Members_suit_validate
89 .SUIT_Unseverable_Members_suit_validate.value,
90 result.SUIT_Envelope_suit_manifest_cbor
91 .SUIT_Manifest_SUIT_Unseverable_Members_m
92 .SUIT_Unseverable_Members_suit_validate
93 .SUIT_Unseverable_Members_suit_validate.len,
94 &command_seq, &payload_len_out);
95 if (!ret) {
96 return ret;
97 }
98 }
99
100 if (result.SUIT_Envelope_suit_manifest_cbor
101 .SUIT_Manifest_SUIT_Unseverable_Members_m
102 .SUIT_Unseverable_Members_suit_load_present) {
103 ret = cbor_decode_SUIT_Command_Sequence(
104 result.SUIT_Envelope_suit_manifest_cbor
105 .SUIT_Manifest_SUIT_Unseverable_Members_m
106 .SUIT_Unseverable_Members_suit_load
107 .SUIT_Unseverable_Members_suit_load.value,
108 result.SUIT_Envelope_suit_manifest_cbor
109 .SUIT_Manifest_SUIT_Unseverable_Members_m
110 .SUIT_Unseverable_Members_suit_load
111 .SUIT_Unseverable_Members_suit_load.len,
112 &command_seq, &payload_len_out);
113 if (!ret) {
114 return ret;
115 }
116 }
117
118 if (result.SUIT_Envelope_suit_manifest_cbor
119 .SUIT_Manifest_SUIT_Unseverable_Members_m
120 .SUIT_Unseverable_Members_suit_run_present) {
121 ret = cbor_decode_SUIT_Command_Sequence(
122 result.SUIT_Envelope_suit_manifest_cbor
123 .SUIT_Manifest_SUIT_Unseverable_Members_m
124 .SUIT_Unseverable_Members_suit_run
125 .SUIT_Unseverable_Members_suit_run.value,
126 result.SUIT_Envelope_suit_manifest_cbor
127 .SUIT_Manifest_SUIT_Unseverable_Members_m
128 .SUIT_Unseverable_Members_suit_run
129 .SUIT_Unseverable_Members_suit_run.len,
130 &command_seq, &payload_len_out);
131 if (!ret) {
132 return ret;
133 }
134 }
135 return ret;
136 }
137