1 /*
2  * Automatically generated by asn1_compiler.  Do not edit
3  *
4  * ASN.1 parser for pkcs7
5  */
6 #include <linux/asn1_ber_bytecode.h>
7 #include "pkcs7.asn1.h"
8 
9 enum pkcs7_actions {
10 	ACT_pkcs7_check_content_type = 0,
11 	ACT_pkcs7_extract_cert = 1,
12 	ACT_pkcs7_note_OID = 2,
13 	ACT_pkcs7_note_certificate_list = 3,
14 	ACT_pkcs7_note_content = 4,
15 	ACT_pkcs7_note_data = 5,
16 	ACT_pkcs7_note_signed_info = 6,
17 	ACT_pkcs7_note_signeddata_version = 7,
18 	ACT_pkcs7_note_signerinfo_version = 8,
19 	ACT_pkcs7_sig_note_authenticated_attr = 9,
20 	ACT_pkcs7_sig_note_digest_algo = 10,
21 	ACT_pkcs7_sig_note_issuer = 11,
22 	ACT_pkcs7_sig_note_pkey_algo = 12,
23 	ACT_pkcs7_sig_note_serial = 13,
24 	ACT_pkcs7_sig_note_set_of_authattrs = 14,
25 	ACT_pkcs7_sig_note_signature = 15,
26 	ACT_pkcs7_sig_note_skid = 16,
27 	NR__pkcs7_actions = 17
28 };
29 
30 static const asn1_action_t pkcs7_action_table[NR__pkcs7_actions] = {
31 	[   0] = pkcs7_check_content_type,
32 	[   1] = pkcs7_extract_cert,
33 	[   2] = pkcs7_note_OID,
34 	[   3] = pkcs7_note_certificate_list,
35 	[   4] = pkcs7_note_content,
36 	[   5] = pkcs7_note_data,
37 	[   6] = pkcs7_note_signed_info,
38 	[   7] = pkcs7_note_signeddata_version,
39 	[   8] = pkcs7_note_signerinfo_version,
40 	[   9] = pkcs7_sig_note_authenticated_attr,
41 	[  10] = pkcs7_sig_note_digest_algo,
42 	[  11] = pkcs7_sig_note_issuer,
43 	[  12] = pkcs7_sig_note_pkey_algo,
44 	[  13] = pkcs7_sig_note_serial,
45 	[  14] = pkcs7_sig_note_set_of_authattrs,
46 	[  15] = pkcs7_sig_note_signature,
47 	[  16] = pkcs7_sig_note_skid,
48 };
49 
50 static const unsigned char pkcs7_machine[] = {
51 	// PKCS7ContentInfo
52 	[   0] = ASN1_OP_MATCH,
53 	[   1] = _tag(UNIV, CONS, SEQ),
54 	// ContentType
55 	[   2] =  ASN1_OP_MATCH_ACT,
56 	[   3] =  _tag(UNIV, PRIM, OID),
57 	[   4] =  _action(ACT_pkcs7_note_OID),
58 	[   5] =  ASN1_OP_ACT,
59 	[   6] =  _action(ACT_pkcs7_check_content_type),
60 	[   7] =  ASN1_OP_MATCH_JUMP_OR_SKIP,		// content
61 	[   8] =  _tagn(CONT, CONS,  0),
62 	[   9] =  _jump_target(12),
63 	[  10] = ASN1_OP_END_SEQ,
64 	[  11] = ASN1_OP_COMPLETE,
65 
66 	// SignedData
67 	[  12] =  ASN1_OP_MATCH,
68 	[  13] =  _tag(UNIV, CONS, SEQ),
69 	[  14] =   ASN1_OP_MATCH_ACT,		// version
70 	[  15] =   _tag(UNIV, PRIM, INT),
71 	[  16] =   _action(ACT_pkcs7_note_signeddata_version),
72 	// DigestAlgorithmIdentifiers
73 	[  17] =   ASN1_OP_MATCH_JUMP_OR_SKIP,		// daSet
74 	[  18] =   _tag(UNIV, CONS, SET),
75 	[  19] =   _jump_target(61),
76 	[  20] =   ASN1_OP_COND_MATCH_JUMP_OR_SKIP,		// daSequence
77 	[  21] =   _tag(UNIV, CONS, SEQ),
78 	[  22] =   _jump_target(67),
79 	[  23] =   ASN1_OP_COND_FAIL,
80 	// ContentInfo
81 	[  24] =   ASN1_OP_MATCH,
82 	[  25] =   _tag(UNIV, CONS, SEQ),
83 	// ContentType
84 	[  26] =    ASN1_OP_MATCH_ACT,
85 	[  27] =    _tag(UNIV, PRIM, OID),
86 	[  28] =    _action(ACT_pkcs7_note_OID),
87 	[  29] =    ASN1_OP_ACT,
88 	[  30] =    _action(ACT_pkcs7_note_OID),
89 	[  31] =    ASN1_OP_MATCH_JUMP_OR_SKIP,		// content
90 	[  32] =    _tagn(CONT, CONS,  0),
91 	[  33] =    _jump_target(73),
92 	[  34] =   ASN1_OP_END_SEQ,
93 	[  35] =   ASN1_OP_ACT,
94 	[  36] =   _action(ACT_pkcs7_note_content),
95 	// ExtendedCertificatesAndCertificates
96 	[  37] =   ASN1_OP_MATCH_JUMP_OR_SKIP,		// certSet
97 	[  38] =   _tagn(CONT, CONS,  0),
98 	[  39] =   _jump_target(77),		// --> ExtendedCertificatesAndCertificates
99 	// Certificates
100 	[  40] =   ASN1_OP_COND_MATCH_JUMP_OR_SKIP,		// certSequence
101 	[  41] =   _tagn(CONT, CONS,  2),
102 	[  42] =   _jump_target(85),		// --> Certificates
103 	[  43] =   ASN1_OP_ACT,
104 	[  44] =   _action(ACT_pkcs7_note_certificate_list),
105 	// CertificateRevocationLists
106 	[  45] =   ASN1_OP_MATCH_JUMP_OR_SKIP,		// crlSet
107 	[  46] =   _tagn(CONT, CONS,  1),
108 	[  47] =   _jump_target(90),		// --> CertificateRevocationLists
109 	// CRLSequence
110 	[  48] =   ASN1_OP_COND_MATCH_JUMP_OR_SKIP,		// crlSequence
111 	[  49] =   _tagn(CONT, CONS,  3),
112 	[  50] =   _jump_target(96),		// --> CRLSequence
113 	// SignerInfos
114 	[  51] =   ASN1_OP_MATCH_JUMP_OR_SKIP,		// siSet
115 	[  52] =   _tag(UNIV, CONS, SET),
116 	[  53] =   _jump_target(102),
117 	[  54] =   ASN1_OP_COND_MATCH_JUMP_OR_SKIP,		// siSequence
118 	[  55] =   _tag(UNIV, CONS, SEQ),
119 	[  56] =   _jump_target(108),
120 	[  57] =   ASN1_OP_COND_FAIL,
121 	[  58] =  ASN1_OP_END_SEQ,
122 	[  59] = ASN1_OP_END_SEQ,
123 	[  60] = ASN1_OP_RETURN,
124 
125 	// DigestAlgorithmIdentifier
126 	[  61] =  ASN1_OP_MATCH_JUMP,
127 	[  62] =  _tag(UNIV, CONS, SEQ),
128 	[  63] =  _jump_target(114),		// --> DigestAlgorithmIdentifier
129 	[  64] = ASN1_OP_END_SET_OF,
130 	[  65] = _jump_target(61),
131 	[  66] = ASN1_OP_RETURN,
132 
133 	// DigestAlgorithmIdentifier
134 	[  67] =  ASN1_OP_MATCH_JUMP,
135 	[  68] =  _tag(UNIV, CONS, SEQ),
136 	[  69] =  _jump_target(114),		// --> DigestAlgorithmIdentifier
137 	[  70] = ASN1_OP_END_SEQ_OF,
138 	[  71] = _jump_target(67),
139 	[  72] = ASN1_OP_RETURN,
140 
141 	// Data
142 	[  73] =  ASN1_OP_MATCH_ANY_ACT,
143 	[  74] =  _action(ACT_pkcs7_note_data),
144 	[  75] = ASN1_OP_END_SEQ,
145 	[  76] = ASN1_OP_RETURN,
146 
147 	// ExtendedCertificateOrCertificate
148 	// Certificate
149 	[  77] =  ASN1_OP_MATCH_ANY_ACT_OR_SKIP,
150 	[  78] =  _action(ACT_pkcs7_extract_cert),
151 	// ExtendedCertificate
152 	// Certificate
153 	[  79] =  ASN1_OP_COND_MATCH_ANY_ACT_OR_SKIP,
154 	[  80] =  _action(ACT_pkcs7_extract_cert),
155 	[  81] =  ASN1_OP_COND_FAIL,
156 	[  82] = ASN1_OP_END_SET_OF,
157 	[  83] = _jump_target(77),
158 	[  84] = ASN1_OP_RETURN,
159 
160 	// Certificate
161 	[  85] =  ASN1_OP_MATCH_ANY_ACT,
162 	[  86] =  _action(ACT_pkcs7_extract_cert),
163 	[  87] = ASN1_OP_END_SEQ_OF,
164 	[  88] = _jump_target(85),
165 	[  89] = ASN1_OP_RETURN,
166 
167 	// CertificateList
168 	[  90] =  ASN1_OP_MATCH_JUMP,
169 	[  91] =  _tag(UNIV, CONS, SEQ),
170 	[  92] =  _jump_target(120),		// --> CertificateList
171 	[  93] = ASN1_OP_END_SET_OF,
172 	[  94] = _jump_target(90),
173 	[  95] = ASN1_OP_RETURN,
174 
175 	// CertificateList
176 	[  96] =  ASN1_OP_MATCH_JUMP,
177 	[  97] =  _tag(UNIV, CONS, SEQ),
178 	[  98] =  _jump_target(120),		// --> CertificateList
179 	[  99] = ASN1_OP_END_SEQ_OF,
180 	[ 100] = _jump_target(96),
181 	[ 101] = ASN1_OP_RETURN,
182 
183 	// SignerInfo
184 	[ 102] =  ASN1_OP_MATCH_JUMP,
185 	[ 103] =  _tag(UNIV, CONS, SEQ),
186 	[ 104] =  _jump_target(125),		// --> SignerInfo
187 	[ 105] = ASN1_OP_END_SET_OF,
188 	[ 106] = _jump_target(102),
189 	[ 107] = ASN1_OP_RETURN,
190 
191 	// SignerInfo
192 	[ 108] =  ASN1_OP_MATCH_JUMP,
193 	[ 109] =  _tag(UNIV, CONS, SEQ),
194 	[ 110] =  _jump_target(125),		// --> SignerInfo
195 	[ 111] = ASN1_OP_END_SEQ_OF,
196 	[ 112] = _jump_target(108),
197 	[ 113] = ASN1_OP_RETURN,
198 
199 	[ 114] =  ASN1_OP_MATCH_ACT,		// algorithm
200 	[ 115] =  _tag(UNIV, PRIM, OID),
201 	[ 116] =  _action(ACT_pkcs7_note_OID),
202 	[ 117] =  ASN1_OP_MATCH_ANY_OR_SKIP,		// parameters
203 	[ 118] = ASN1_OP_END_SEQ,
204 	[ 119] = ASN1_OP_RETURN,
205 
206 	// Certificate
207 	[ 120] =  ASN1_OP_MATCH_ANY_ACT,
208 	[ 121] =  _action(ACT_pkcs7_extract_cert),
209 	[ 122] = ASN1_OP_END_SEQ_OF,
210 	[ 123] = _jump_target(120),
211 	[ 124] = ASN1_OP_RETURN,
212 
213 	[ 125] =  ASN1_OP_MATCH_ACT,		// version
214 	[ 126] =  _tag(UNIV, PRIM, INT),
215 	[ 127] =  _action(ACT_pkcs7_note_signerinfo_version),
216 	// SignerIdentifier
217 	// IssuerAndSerialNumber
218 	[ 128] =  ASN1_OP_MATCH_JUMP_OR_SKIP,		// issuerAndSerialNumber
219 	[ 129] =  _tag(UNIV, CONS, SEQ),
220 	[ 130] =  _jump_target(169),		// --> IssuerAndSerialNumber
221 	// SubjectKeyIdentifier
222 	[ 131] =  ASN1_OP_COND_MATCH_ACT_OR_SKIP,		// subjectKeyIdentifier
223 	[ 132] =  _tagn(CONT, PRIM,  0),
224 	[ 133] =  _action(ACT_pkcs7_sig_note_skid),
225 	[ 134] =  ASN1_OP_COND_FAIL,
226 	// DigestAlgorithmIdentifier
227 	[ 135] =  ASN1_OP_MATCH_JUMP,
228 	[ 136] =  _tag(UNIV, CONS, SEQ),
229 	[ 137] =  _jump_target(114),		// --> DigestAlgorithmIdentifier
230 	[ 138] =  ASN1_OP_ACT,
231 	[ 139] =  _action(ACT_pkcs7_sig_note_digest_algo),
232 	// SetOfAuthenticatedAttribute
233 	[ 140] =  ASN1_OP_MATCH_JUMP_OR_SKIP,		// aaSet
234 	[ 141] =  _tagn(CONT, CONS,  0),
235 	[ 142] =  _jump_target(192),		// --> SetOfAuthenticatedAttribute
236 	[ 143] =  ASN1_OP_MAYBE_ACT,
237 	[ 144] =  _action(ACT_pkcs7_sig_note_set_of_authattrs),
238 	[ 145] =  ASN1_OP_COND_MATCH_JUMP_OR_SKIP,		// aaSequence
239 	[ 146] =  _tagn(CONT, CONS,  2),
240 	[ 147] =  _jump_target(198),
241 	// DigestEncryptionAlgorithmIdentifier
242 	[ 148] =  ASN1_OP_MATCH,
243 	[ 149] =  _tag(UNIV, CONS, SEQ),
244 	[ 150] =   ASN1_OP_MATCH_ACT,		// algorithm
245 	[ 151] =   _tag(UNIV, PRIM, OID),
246 	[ 152] =   _action(ACT_pkcs7_note_OID),
247 	[ 153] =   ASN1_OP_MATCH_ANY_OR_SKIP,		// parameters
248 	[ 154] =  ASN1_OP_END_SEQ,
249 	[ 155] =  ASN1_OP_ACT,
250 	[ 156] =  _action(ACT_pkcs7_sig_note_pkey_algo),
251 	// EncryptedDigest
252 	[ 157] =  ASN1_OP_MATCH_ACT,
253 	[ 158] =  _tag(UNIV, PRIM, OTS),
254 	[ 159] =  _action(ACT_pkcs7_sig_note_signature),
255 	[ 160] =  ASN1_OP_MATCH_JUMP_OR_SKIP,		// uaSet
256 	[ 161] =  _tagn(CONT, CONS,  1),
257 	[ 162] =  _jump_target(207),
258 	[ 163] =  ASN1_OP_COND_MATCH_JUMP_OR_SKIP,		// uaSequence
259 	[ 164] =  _tagn(CONT, CONS,  3),
260 	[ 165] =  _jump_target(213),
261 	[ 166] = ASN1_OP_END_SEQ_ACT,
262 	[ 167] = _action(ACT_pkcs7_note_signed_info),
263 	[ 168] = ASN1_OP_RETURN,
264 
265 	// Name
266 	[ 169] =  ASN1_OP_MATCH,
267 	[ 170] =  _tag(UNIV, CONS, SEQ),
268 	// RelativeDistinguishedName
269 	[ 171] =   ASN1_OP_MATCH,
270 	[ 172] =   _tag(UNIV, CONS, SET),
271 	// AttributeValueAssertion
272 	[ 173] =    ASN1_OP_MATCH,
273 	[ 174] =    _tag(UNIV, CONS, SEQ),
274 	[ 175] =     ASN1_OP_MATCH_ACT,		// attributeType
275 	[ 176] =     _tag(UNIV, PRIM, OID),
276 	[ 177] =     _action(ACT_pkcs7_note_OID),
277 	[ 178] =     ASN1_OP_MATCH_ANY,		// attributeValue
278 	[ 179] =    ASN1_OP_END_SEQ,
279 	[ 180] =   ASN1_OP_END_SET_OF,
280 	[ 181] =   _jump_target(173),
281 	[ 182] =  ASN1_OP_END_SEQ_OF,
282 	[ 183] =  _jump_target(171),
283 	[ 184] =  ASN1_OP_ACT,
284 	[ 185] =  _action(ACT_pkcs7_sig_note_issuer),
285 	// CertificateSerialNumber
286 	[ 186] =  ASN1_OP_MATCH,
287 	[ 187] =  _tag(UNIV, PRIM, INT),
288 	[ 188] =  ASN1_OP_ACT,
289 	[ 189] =  _action(ACT_pkcs7_sig_note_serial),
290 	[ 190] = ASN1_OP_END_SEQ,
291 	[ 191] = ASN1_OP_RETURN,
292 
293 	// AuthenticatedAttribute
294 	[ 192] =  ASN1_OP_MATCH_JUMP,
295 	[ 193] =  _tag(UNIV, CONS, SEQ),
296 	[ 194] =  _jump_target(219),		// --> AuthenticatedAttribute
297 	[ 195] = ASN1_OP_END_SET_OF,
298 	[ 196] = _jump_target(192),
299 	[ 197] = ASN1_OP_RETURN,
300 
301 	[ 198] =  ASN1_OP_MATCH,		// aaSequence
302 	[ 199] =  _tag(UNIV, CONS, SEQ),
303 	// AuthenticatedAttribute
304 	[ 200] =   ASN1_OP_MATCH_JUMP,
305 	[ 201] =   _tag(UNIV, CONS, SEQ),
306 	[ 202] =   _jump_target(219),		// --> AuthenticatedAttribute
307 	[ 203] =  ASN1_OP_END_SEQ_OF,
308 	[ 204] =  _jump_target(200),
309 	[ 205] = ASN1_OP_END_SEQ,
310 	[ 206] = ASN1_OP_RETURN,
311 
312 	// UnauthenticatedAttribute
313 	[ 207] =  ASN1_OP_MATCH_JUMP,
314 	[ 208] =  _tag(UNIV, CONS, SEQ),
315 	[ 209] =  _jump_target(230),		// --> UnauthenticatedAttribute
316 	[ 210] = ASN1_OP_END_SET_OF,
317 	[ 211] = _jump_target(207),
318 	[ 212] = ASN1_OP_RETURN,
319 
320 	// UnauthenticatedAttribute
321 	[ 213] =  ASN1_OP_MATCH_JUMP,
322 	[ 214] =  _tag(UNIV, CONS, SEQ),
323 	[ 215] =  _jump_target(230),		// --> UnauthenticatedAttribute
324 	[ 216] = ASN1_OP_END_SEQ_OF,
325 	[ 217] = _jump_target(213),
326 	[ 218] = ASN1_OP_RETURN,
327 
328 	[ 219] =  ASN1_OP_MATCH_ACT,		// type
329 	[ 220] =  _tag(UNIV, PRIM, OID),
330 	[ 221] =  _action(ACT_pkcs7_note_OID),
331 	[ 222] =  ASN1_OP_MATCH,		// values
332 	[ 223] =  _tag(UNIV, CONS, SET),
333 	[ 224] =   ASN1_OP_MATCH_ANY_ACT,
334 	[ 225] =   _action(ACT_pkcs7_sig_note_authenticated_attr),
335 	[ 226] =  ASN1_OP_END_SET_OF,
336 	[ 227] =  _jump_target(224),
337 	[ 228] = ASN1_OP_END_SEQ,
338 	[ 229] = ASN1_OP_RETURN,
339 
340 	[ 230] =  ASN1_OP_MATCH,		// type
341 	[ 231] =  _tag(UNIV, PRIM, OID),
342 	[ 232] =  ASN1_OP_MATCH,		// values
343 	[ 233] =  _tag(UNIV, CONS, SET),
344 	[ 234] =   ASN1_OP_MATCH_ANY,
345 	[ 235] =  ASN1_OP_END_SET_OF,
346 	[ 236] =  _jump_target(234),
347 	[ 237] = ASN1_OP_END_SEQ,
348 	[ 238] = ASN1_OP_RETURN,
349 };
350 
351 const struct asn1_decoder pkcs7_decoder = {
352 	.machine = pkcs7_machine,
353 	.machlen = sizeof(pkcs7_machine),
354 	.actions = pkcs7_action_table,
355 };
356