diff options
Diffstat (limited to 'src/lib/libcrypto/cms/cms_asn1.c')
-rw-r--r-- | src/lib/libcrypto/cms/cms_asn1.c | 1505 |
1 files changed, 0 insertions, 1505 deletions
diff --git a/src/lib/libcrypto/cms/cms_asn1.c b/src/lib/libcrypto/cms/cms_asn1.c deleted file mode 100644 index 02a594575d..0000000000 --- a/src/lib/libcrypto/cms/cms_asn1.c +++ /dev/null | |||
@@ -1,1505 +0,0 @@ | |||
1 | /* $OpenBSD: cms_asn1.c,v 1.6 2015/07/25 15:22:10 jsing Exp $ */ | ||
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
3 | * project. | ||
4 | */ | ||
5 | /* ==================================================================== | ||
6 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions | ||
10 | * are met: | ||
11 | * | ||
12 | * 1. Redistributions of source code must retain the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer. | ||
14 | * | ||
15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer in | ||
17 | * the documentation and/or other materials provided with the | ||
18 | * distribution. | ||
19 | * | ||
20 | * 3. All advertising materials mentioning features or use of this | ||
21 | * software must display the following acknowledgment: | ||
22 | * "This product includes software developed by the OpenSSL Project | ||
23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
24 | * | ||
25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
26 | * endorse or promote products derived from this software without | ||
27 | * prior written permission. For written permission, please contact | ||
28 | * licensing@OpenSSL.org. | ||
29 | * | ||
30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
31 | * nor may "OpenSSL" appear in their names without prior written | ||
32 | * permission of the OpenSSL Project. | ||
33 | * | ||
34 | * 6. Redistributions of any form whatsoever must retain the following | ||
35 | * acknowledgment: | ||
36 | * "This product includes software developed by the OpenSSL Project | ||
37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
38 | * | ||
39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | * ==================================================================== | ||
52 | */ | ||
53 | |||
54 | #include <openssl/asn1t.h> | ||
55 | #include <openssl/pem.h> | ||
56 | #include <openssl/x509v3.h> | ||
57 | #include "cms.h" | ||
58 | #include "cms_lcl.h" | ||
59 | |||
60 | static const ASN1_TEMPLATE CMS_IssuerAndSerialNumber_seq_tt[] = { | ||
61 | { | ||
62 | .flags = 0, | ||
63 | .tag = 0, | ||
64 | .offset = offsetof(CMS_IssuerAndSerialNumber, issuer), | ||
65 | .field_name = "issuer", | ||
66 | .item = &X509_NAME_it, | ||
67 | }, | ||
68 | { | ||
69 | .flags = 0, | ||
70 | .tag = 0, | ||
71 | .offset = offsetof(CMS_IssuerAndSerialNumber, serialNumber), | ||
72 | .field_name = "serialNumber", | ||
73 | .item = &ASN1_INTEGER_it, | ||
74 | }, | ||
75 | }; | ||
76 | |||
77 | const ASN1_ITEM CMS_IssuerAndSerialNumber_it = { | ||
78 | .itype = ASN1_ITYPE_SEQUENCE, | ||
79 | .utype = V_ASN1_SEQUENCE, | ||
80 | .templates = CMS_IssuerAndSerialNumber_seq_tt, | ||
81 | .tcount = sizeof(CMS_IssuerAndSerialNumber_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
82 | .funcs = NULL, | ||
83 | .size = sizeof(CMS_IssuerAndSerialNumber), | ||
84 | .sname = "CMS_IssuerAndSerialNumber", | ||
85 | }; | ||
86 | |||
87 | static const ASN1_TEMPLATE CMS_OtherCertificateFormat_seq_tt[] = { | ||
88 | { | ||
89 | .flags = 0, | ||
90 | .tag = 0, | ||
91 | .offset = offsetof(CMS_OtherCertificateFormat, otherCertFormat), | ||
92 | .field_name = "otherCertFormat", | ||
93 | .item = &ASN1_OBJECT_it, | ||
94 | }, | ||
95 | { | ||
96 | .flags = ASN1_TFLG_OPTIONAL, | ||
97 | .tag = 0, | ||
98 | .offset = offsetof(CMS_OtherCertificateFormat, otherCert), | ||
99 | .field_name = "otherCert", | ||
100 | .item = &ASN1_ANY_it, | ||
101 | }, | ||
102 | }; | ||
103 | |||
104 | const ASN1_ITEM CMS_OtherCertificateFormat_it = { | ||
105 | .itype = ASN1_ITYPE_SEQUENCE, | ||
106 | .utype = V_ASN1_SEQUENCE, | ||
107 | .templates = CMS_OtherCertificateFormat_seq_tt, | ||
108 | .tcount = sizeof(CMS_OtherCertificateFormat_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
109 | .funcs = NULL, | ||
110 | .size = sizeof(CMS_OtherCertificateFormat), | ||
111 | .sname = "CMS_OtherCertificateFormat", | ||
112 | }; | ||
113 | |||
114 | static const ASN1_TEMPLATE CMS_CertificateChoices_ch_tt[] = { | ||
115 | { | ||
116 | .flags = 0, | ||
117 | .tag = 0, | ||
118 | .offset = offsetof(CMS_CertificateChoices, d.certificate), | ||
119 | .field_name = "d.certificate", | ||
120 | .item = &X509_it, | ||
121 | }, | ||
122 | { | ||
123 | .flags = ASN1_TFLG_IMPLICIT, | ||
124 | .tag = 0, | ||
125 | .offset = offsetof(CMS_CertificateChoices, d.extendedCertificate), | ||
126 | .field_name = "d.extendedCertificate", | ||
127 | .item = &ASN1_SEQUENCE_it, | ||
128 | }, | ||
129 | { | ||
130 | .flags = ASN1_TFLG_IMPLICIT, | ||
131 | .tag = 1, | ||
132 | .offset = offsetof(CMS_CertificateChoices, d.v1AttrCert), | ||
133 | .field_name = "d.v1AttrCert", | ||
134 | .item = &ASN1_SEQUENCE_it, | ||
135 | }, | ||
136 | { | ||
137 | .flags = ASN1_TFLG_IMPLICIT, | ||
138 | .tag = 2, | ||
139 | .offset = offsetof(CMS_CertificateChoices, d.v2AttrCert), | ||
140 | .field_name = "d.v2AttrCert", | ||
141 | .item = &ASN1_SEQUENCE_it, | ||
142 | }, | ||
143 | { | ||
144 | .flags = ASN1_TFLG_IMPLICIT, | ||
145 | .tag = 3, | ||
146 | .offset = offsetof(CMS_CertificateChoices, d.other), | ||
147 | .field_name = "d.other", | ||
148 | .item = &CMS_OtherCertificateFormat_it, | ||
149 | }, | ||
150 | }; | ||
151 | |||
152 | const ASN1_ITEM CMS_CertificateChoices_it = { | ||
153 | .itype = ASN1_ITYPE_CHOICE, | ||
154 | .utype = offsetof(CMS_CertificateChoices, type), | ||
155 | .templates = CMS_CertificateChoices_ch_tt, | ||
156 | .tcount = sizeof(CMS_CertificateChoices_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
157 | .funcs = NULL, | ||
158 | .size = sizeof(CMS_CertificateChoices), | ||
159 | .sname = "CMS_CertificateChoices", | ||
160 | }; | ||
161 | |||
162 | static const ASN1_TEMPLATE CMS_SignerIdentifier_ch_tt[] = { | ||
163 | { | ||
164 | .flags = 0, | ||
165 | .tag = 0, | ||
166 | .offset = offsetof(CMS_SignerIdentifier, d.issuerAndSerialNumber), | ||
167 | .field_name = "d.issuerAndSerialNumber", | ||
168 | .item = &CMS_IssuerAndSerialNumber_it, | ||
169 | }, | ||
170 | { | ||
171 | .flags = ASN1_TFLG_IMPLICIT, | ||
172 | .tag = 0, | ||
173 | .offset = offsetof(CMS_SignerIdentifier, d.subjectKeyIdentifier), | ||
174 | .field_name = "d.subjectKeyIdentifier", | ||
175 | .item = &ASN1_OCTET_STRING_it, | ||
176 | }, | ||
177 | }; | ||
178 | |||
179 | const ASN1_ITEM CMS_SignerIdentifier_it = { | ||
180 | .itype = ASN1_ITYPE_CHOICE, | ||
181 | .utype = offsetof(CMS_SignerIdentifier, type), | ||
182 | .templates = CMS_SignerIdentifier_ch_tt, | ||
183 | .tcount = sizeof(CMS_SignerIdentifier_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
184 | .funcs = NULL, | ||
185 | .size = sizeof(CMS_SignerIdentifier), | ||
186 | .sname = "CMS_SignerIdentifier", | ||
187 | }; | ||
188 | |||
189 | static const ASN1_TEMPLATE CMS_EncapsulatedContentInfo_seq_tt[] = { | ||
190 | { | ||
191 | .flags = 0, | ||
192 | .tag = 0, | ||
193 | .offset = offsetof(CMS_EncapsulatedContentInfo, eContentType), | ||
194 | .field_name = "eContentType", | ||
195 | .item = &ASN1_OBJECT_it, | ||
196 | }, | ||
197 | { | ||
198 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_OPTIONAL | ASN1_TFLG_NDEF, | ||
199 | .tag = 0, | ||
200 | .offset = offsetof(CMS_EncapsulatedContentInfo, eContent), | ||
201 | .field_name = "eContent", | ||
202 | .item = &ASN1_OCTET_STRING_NDEF_it, | ||
203 | }, | ||
204 | }; | ||
205 | |||
206 | const ASN1_ITEM CMS_EncapsulatedContentInfo_it = { | ||
207 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, | ||
208 | .utype = V_ASN1_SEQUENCE, | ||
209 | .templates = CMS_EncapsulatedContentInfo_seq_tt, | ||
210 | .tcount = sizeof(CMS_EncapsulatedContentInfo_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
211 | .funcs = NULL, | ||
212 | .size = sizeof(CMS_EncapsulatedContentInfo), | ||
213 | .sname = "CMS_EncapsulatedContentInfo", | ||
214 | }; | ||
215 | |||
216 | /* Minor tweak to operation: free up signer key, cert */ | ||
217 | static int | ||
218 | cms_si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) | ||
219 | { | ||
220 | if (operation == ASN1_OP_FREE_POST) { | ||
221 | CMS_SignerInfo *si = (CMS_SignerInfo *)*pval; | ||
222 | EVP_PKEY_free(si->pkey); | ||
223 | if (si->signer) | ||
224 | X509_free(si->signer); | ||
225 | } | ||
226 | return 1; | ||
227 | } | ||
228 | |||
229 | static const ASN1_AUX CMS_SignerInfo_aux = { | ||
230 | .app_data = NULL, | ||
231 | .flags = 0, | ||
232 | .ref_offset = 0, | ||
233 | .ref_lock = 0, | ||
234 | .asn1_cb = cms_si_cb, | ||
235 | .enc_offset = 0, | ||
236 | }; | ||
237 | static const ASN1_TEMPLATE CMS_SignerInfo_seq_tt[] = { | ||
238 | { | ||
239 | .flags = 0, | ||
240 | .tag = 0, | ||
241 | .offset = offsetof(CMS_SignerInfo, version), | ||
242 | .field_name = "version", | ||
243 | .item = &LONG_it, | ||
244 | }, | ||
245 | { | ||
246 | .flags = 0, | ||
247 | .tag = 0, | ||
248 | .offset = offsetof(CMS_SignerInfo, sid), | ||
249 | .field_name = "sid", | ||
250 | .item = &CMS_SignerIdentifier_it, | ||
251 | }, | ||
252 | { | ||
253 | .flags = 0, | ||
254 | .tag = 0, | ||
255 | .offset = offsetof(CMS_SignerInfo, digestAlgorithm), | ||
256 | .field_name = "digestAlgorithm", | ||
257 | .item = &X509_ALGOR_it, | ||
258 | }, | ||
259 | { | ||
260 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, | ||
261 | .tag = 0, | ||
262 | .offset = offsetof(CMS_SignerInfo, signedAttrs), | ||
263 | .field_name = "signedAttrs", | ||
264 | .item = &X509_ATTRIBUTE_it, | ||
265 | }, | ||
266 | { | ||
267 | .flags = 0, | ||
268 | .tag = 0, | ||
269 | .offset = offsetof(CMS_SignerInfo, signatureAlgorithm), | ||
270 | .field_name = "signatureAlgorithm", | ||
271 | .item = &X509_ALGOR_it, | ||
272 | }, | ||
273 | { | ||
274 | .flags = 0, | ||
275 | .tag = 0, | ||
276 | .offset = offsetof(CMS_SignerInfo, signature), | ||
277 | .field_name = "signature", | ||
278 | .item = &ASN1_OCTET_STRING_it, | ||
279 | }, | ||
280 | { | ||
281 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, | ||
282 | .tag = 1, | ||
283 | .offset = offsetof(CMS_SignerInfo, unsignedAttrs), | ||
284 | .field_name = "unsignedAttrs", | ||
285 | .item = &X509_ATTRIBUTE_it, | ||
286 | }, | ||
287 | }; | ||
288 | |||
289 | const ASN1_ITEM CMS_SignerInfo_it = { | ||
290 | .itype = ASN1_ITYPE_SEQUENCE, | ||
291 | .utype = V_ASN1_SEQUENCE, | ||
292 | .templates = CMS_SignerInfo_seq_tt, | ||
293 | .tcount = sizeof(CMS_SignerInfo_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
294 | .funcs = &CMS_SignerInfo_aux, | ||
295 | .size = sizeof(CMS_SignerInfo), | ||
296 | .sname = "CMS_SignerInfo", | ||
297 | }; | ||
298 | |||
299 | static const ASN1_TEMPLATE CMS_OtherRevocationInfoFormat_seq_tt[] = { | ||
300 | { | ||
301 | .flags = 0, | ||
302 | .tag = 0, | ||
303 | .offset = offsetof(CMS_OtherRevocationInfoFormat, otherRevInfoFormat), | ||
304 | .field_name = "otherRevInfoFormat", | ||
305 | .item = &ASN1_OBJECT_it, | ||
306 | }, | ||
307 | { | ||
308 | .flags = ASN1_TFLG_OPTIONAL, | ||
309 | .tag = 0, | ||
310 | .offset = offsetof(CMS_OtherRevocationInfoFormat, otherRevInfo), | ||
311 | .field_name = "otherRevInfo", | ||
312 | .item = &ASN1_ANY_it, | ||
313 | }, | ||
314 | }; | ||
315 | |||
316 | const ASN1_ITEM CMS_OtherRevocationInfoFormat_it = { | ||
317 | .itype = ASN1_ITYPE_SEQUENCE, | ||
318 | .utype = V_ASN1_SEQUENCE, | ||
319 | .templates = CMS_OtherRevocationInfoFormat_seq_tt, | ||
320 | .tcount = sizeof(CMS_OtherRevocationInfoFormat_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
321 | .funcs = NULL, | ||
322 | .size = sizeof(CMS_OtherRevocationInfoFormat), | ||
323 | .sname = "CMS_OtherRevocationInfoFormat", | ||
324 | }; | ||
325 | |||
326 | static const ASN1_TEMPLATE CMS_RevocationInfoChoice_ch_tt[] = { | ||
327 | { | ||
328 | .flags = 0, | ||
329 | .tag = 0, | ||
330 | .offset = offsetof(CMS_RevocationInfoChoice, d.crl), | ||
331 | .field_name = "d.crl", | ||
332 | .item = &X509_CRL_it, | ||
333 | }, | ||
334 | { | ||
335 | .flags = ASN1_TFLG_IMPLICIT, | ||
336 | .tag = 1, | ||
337 | .offset = offsetof(CMS_RevocationInfoChoice, d.other), | ||
338 | .field_name = "d.other", | ||
339 | .item = &CMS_OtherRevocationInfoFormat_it, | ||
340 | }, | ||
341 | }; | ||
342 | |||
343 | const ASN1_ITEM CMS_RevocationInfoChoice_it = { | ||
344 | .itype = ASN1_ITYPE_CHOICE, | ||
345 | .utype = offsetof(CMS_RevocationInfoChoice, type), | ||
346 | .templates = CMS_RevocationInfoChoice_ch_tt, | ||
347 | .tcount = sizeof(CMS_RevocationInfoChoice_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
348 | .funcs = NULL, | ||
349 | .size = sizeof(CMS_RevocationInfoChoice), | ||
350 | .sname = "CMS_RevocationInfoChoice", | ||
351 | }; | ||
352 | |||
353 | static const ASN1_TEMPLATE CMS_SignedData_seq_tt[] = { | ||
354 | { | ||
355 | .flags = 0, | ||
356 | .tag = 0, | ||
357 | .offset = offsetof(CMS_SignedData, version), | ||
358 | .field_name = "version", | ||
359 | .item = &LONG_it, | ||
360 | }, | ||
361 | { | ||
362 | .flags = ASN1_TFLG_SET_OF, | ||
363 | .tag = 0, | ||
364 | .offset = offsetof(CMS_SignedData, digestAlgorithms), | ||
365 | .field_name = "digestAlgorithms", | ||
366 | .item = &X509_ALGOR_it, | ||
367 | }, | ||
368 | { | ||
369 | .flags = 0, | ||
370 | .tag = 0, | ||
371 | .offset = offsetof(CMS_SignedData, encapContentInfo), | ||
372 | .field_name = "encapContentInfo", | ||
373 | .item = &CMS_EncapsulatedContentInfo_it, | ||
374 | }, | ||
375 | { | ||
376 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, | ||
377 | .tag = 0, | ||
378 | .offset = offsetof(CMS_SignedData, certificates), | ||
379 | .field_name = "certificates", | ||
380 | .item = &CMS_CertificateChoices_it, | ||
381 | }, | ||
382 | { | ||
383 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, | ||
384 | .tag = 1, | ||
385 | .offset = offsetof(CMS_SignedData, crls), | ||
386 | .field_name = "crls", | ||
387 | .item = &CMS_RevocationInfoChoice_it, | ||
388 | }, | ||
389 | { | ||
390 | .flags = ASN1_TFLG_SET_OF, | ||
391 | .tag = 0, | ||
392 | .offset = offsetof(CMS_SignedData, signerInfos), | ||
393 | .field_name = "signerInfos", | ||
394 | .item = &CMS_SignerInfo_it, | ||
395 | }, | ||
396 | }; | ||
397 | |||
398 | const ASN1_ITEM CMS_SignedData_it = { | ||
399 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, | ||
400 | .utype = V_ASN1_SEQUENCE, | ||
401 | .templates = CMS_SignedData_seq_tt, | ||
402 | .tcount = sizeof(CMS_SignedData_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
403 | .funcs = NULL, | ||
404 | .size = sizeof(CMS_SignedData), | ||
405 | .sname = "CMS_SignedData", | ||
406 | }; | ||
407 | |||
408 | static const ASN1_TEMPLATE CMS_OriginatorInfo_seq_tt[] = { | ||
409 | { | ||
410 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, | ||
411 | .tag = 0, | ||
412 | .offset = offsetof(CMS_OriginatorInfo, certificates), | ||
413 | .field_name = "certificates", | ||
414 | .item = &CMS_CertificateChoices_it, | ||
415 | }, | ||
416 | { | ||
417 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, | ||
418 | .tag = 1, | ||
419 | .offset = offsetof(CMS_OriginatorInfo, crls), | ||
420 | .field_name = "crls", | ||
421 | .item = &CMS_RevocationInfoChoice_it, | ||
422 | }, | ||
423 | }; | ||
424 | |||
425 | const ASN1_ITEM CMS_OriginatorInfo_it = { | ||
426 | .itype = ASN1_ITYPE_SEQUENCE, | ||
427 | .utype = V_ASN1_SEQUENCE, | ||
428 | .templates = CMS_OriginatorInfo_seq_tt, | ||
429 | .tcount = sizeof(CMS_OriginatorInfo_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
430 | .funcs = NULL, | ||
431 | .size = sizeof(CMS_OriginatorInfo), | ||
432 | .sname = "CMS_OriginatorInfo", | ||
433 | }; | ||
434 | |||
435 | static const ASN1_TEMPLATE CMS_EncryptedContentInfo_seq_tt[] = { | ||
436 | { | ||
437 | .flags = 0, | ||
438 | .tag = 0, | ||
439 | .offset = offsetof(CMS_EncryptedContentInfo, contentType), | ||
440 | .field_name = "contentType", | ||
441 | .item = &ASN1_OBJECT_it, | ||
442 | }, | ||
443 | { | ||
444 | .flags = 0, | ||
445 | .tag = 0, | ||
446 | .offset = offsetof(CMS_EncryptedContentInfo, contentEncryptionAlgorithm), | ||
447 | .field_name = "contentEncryptionAlgorithm", | ||
448 | .item = &X509_ALGOR_it, | ||
449 | }, | ||
450 | { | ||
451 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_OPTIONAL, | ||
452 | .tag = 0, | ||
453 | .offset = offsetof(CMS_EncryptedContentInfo, encryptedContent), | ||
454 | .field_name = "encryptedContent", | ||
455 | .item = &ASN1_OCTET_STRING_NDEF_it, | ||
456 | }, | ||
457 | }; | ||
458 | |||
459 | const ASN1_ITEM CMS_EncryptedContentInfo_it = { | ||
460 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, | ||
461 | .utype = V_ASN1_SEQUENCE, | ||
462 | .templates = CMS_EncryptedContentInfo_seq_tt, | ||
463 | .tcount = sizeof(CMS_EncryptedContentInfo_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
464 | .funcs = NULL, | ||
465 | .size = sizeof(CMS_EncryptedContentInfo), | ||
466 | .sname = "CMS_EncryptedContentInfo", | ||
467 | }; | ||
468 | |||
469 | static const ASN1_TEMPLATE CMS_KeyTransRecipientInfo_seq_tt[] = { | ||
470 | { | ||
471 | .flags = 0, | ||
472 | .tag = 0, | ||
473 | .offset = offsetof(CMS_KeyTransRecipientInfo, version), | ||
474 | .field_name = "version", | ||
475 | .item = &LONG_it, | ||
476 | }, | ||
477 | { | ||
478 | .flags = 0, | ||
479 | .tag = 0, | ||
480 | .offset = offsetof(CMS_KeyTransRecipientInfo, rid), | ||
481 | .field_name = "rid", | ||
482 | .item = &CMS_SignerIdentifier_it, | ||
483 | }, | ||
484 | { | ||
485 | .flags = 0, | ||
486 | .tag = 0, | ||
487 | .offset = offsetof(CMS_KeyTransRecipientInfo, keyEncryptionAlgorithm), | ||
488 | .field_name = "keyEncryptionAlgorithm", | ||
489 | .item = &X509_ALGOR_it, | ||
490 | }, | ||
491 | { | ||
492 | .flags = 0, | ||
493 | .tag = 0, | ||
494 | .offset = offsetof(CMS_KeyTransRecipientInfo, encryptedKey), | ||
495 | .field_name = "encryptedKey", | ||
496 | .item = &ASN1_OCTET_STRING_it, | ||
497 | }, | ||
498 | }; | ||
499 | |||
500 | const ASN1_ITEM CMS_KeyTransRecipientInfo_it = { | ||
501 | .itype = ASN1_ITYPE_SEQUENCE, | ||
502 | .utype = V_ASN1_SEQUENCE, | ||
503 | .templates = CMS_KeyTransRecipientInfo_seq_tt, | ||
504 | .tcount = sizeof(CMS_KeyTransRecipientInfo_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
505 | .funcs = NULL, | ||
506 | .size = sizeof(CMS_KeyTransRecipientInfo), | ||
507 | .sname = "CMS_KeyTransRecipientInfo", | ||
508 | }; | ||
509 | |||
510 | static const ASN1_TEMPLATE CMS_OtherKeyAttribute_seq_tt[] = { | ||
511 | { | ||
512 | .flags = 0, | ||
513 | .tag = 0, | ||
514 | .offset = offsetof(CMS_OtherKeyAttribute, keyAttrId), | ||
515 | .field_name = "keyAttrId", | ||
516 | .item = &ASN1_OBJECT_it, | ||
517 | }, | ||
518 | { | ||
519 | .flags = ASN1_TFLG_OPTIONAL, | ||
520 | .tag = 0, | ||
521 | .offset = offsetof(CMS_OtherKeyAttribute, keyAttr), | ||
522 | .field_name = "keyAttr", | ||
523 | .item = &ASN1_ANY_it, | ||
524 | }, | ||
525 | }; | ||
526 | |||
527 | const ASN1_ITEM CMS_OtherKeyAttribute_it = { | ||
528 | .itype = ASN1_ITYPE_SEQUENCE, | ||
529 | .utype = V_ASN1_SEQUENCE, | ||
530 | .templates = CMS_OtherKeyAttribute_seq_tt, | ||
531 | .tcount = sizeof(CMS_OtherKeyAttribute_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
532 | .funcs = NULL, | ||
533 | .size = sizeof(CMS_OtherKeyAttribute), | ||
534 | .sname = "CMS_OtherKeyAttribute", | ||
535 | }; | ||
536 | |||
537 | static const ASN1_TEMPLATE CMS_RecipientKeyIdentifier_seq_tt[] = { | ||
538 | { | ||
539 | .flags = 0, | ||
540 | .tag = 0, | ||
541 | .offset = offsetof(CMS_RecipientKeyIdentifier, subjectKeyIdentifier), | ||
542 | .field_name = "subjectKeyIdentifier", | ||
543 | .item = &ASN1_OCTET_STRING_it, | ||
544 | }, | ||
545 | { | ||
546 | .flags = ASN1_TFLG_OPTIONAL, | ||
547 | .tag = 0, | ||
548 | .offset = offsetof(CMS_RecipientKeyIdentifier, date), | ||
549 | .field_name = "date", | ||
550 | .item = &ASN1_GENERALIZEDTIME_it, | ||
551 | }, | ||
552 | { | ||
553 | .flags = ASN1_TFLG_OPTIONAL, | ||
554 | .tag = 0, | ||
555 | .offset = offsetof(CMS_RecipientKeyIdentifier, other), | ||
556 | .field_name = "other", | ||
557 | .item = &CMS_OtherKeyAttribute_it, | ||
558 | }, | ||
559 | }; | ||
560 | |||
561 | const ASN1_ITEM CMS_RecipientKeyIdentifier_it = { | ||
562 | .itype = ASN1_ITYPE_SEQUENCE, | ||
563 | .utype = V_ASN1_SEQUENCE, | ||
564 | .templates = CMS_RecipientKeyIdentifier_seq_tt, | ||
565 | .tcount = sizeof(CMS_RecipientKeyIdentifier_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
566 | .funcs = NULL, | ||
567 | .size = sizeof(CMS_RecipientKeyIdentifier), | ||
568 | .sname = "CMS_RecipientKeyIdentifier", | ||
569 | }; | ||
570 | |||
571 | static const ASN1_TEMPLATE CMS_KeyAgreeRecipientIdentifier_ch_tt[] = { | ||
572 | { | ||
573 | .flags = 0, | ||
574 | .tag = 0, | ||
575 | .offset = offsetof(CMS_KeyAgreeRecipientIdentifier, d.issuerAndSerialNumber), | ||
576 | .field_name = "d.issuerAndSerialNumber", | ||
577 | .item = &CMS_IssuerAndSerialNumber_it, | ||
578 | }, | ||
579 | { | ||
580 | .flags = ASN1_TFLG_IMPLICIT, | ||
581 | .tag = 0, | ||
582 | .offset = offsetof(CMS_KeyAgreeRecipientIdentifier, d.rKeyId), | ||
583 | .field_name = "d.rKeyId", | ||
584 | .item = &CMS_RecipientKeyIdentifier_it, | ||
585 | }, | ||
586 | }; | ||
587 | |||
588 | const ASN1_ITEM CMS_KeyAgreeRecipientIdentifier_it = { | ||
589 | .itype = ASN1_ITYPE_CHOICE, | ||
590 | .utype = offsetof(CMS_KeyAgreeRecipientIdentifier, type), | ||
591 | .templates = CMS_KeyAgreeRecipientIdentifier_ch_tt, | ||
592 | .tcount = sizeof(CMS_KeyAgreeRecipientIdentifier_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
593 | .funcs = NULL, | ||
594 | .size = sizeof(CMS_KeyAgreeRecipientIdentifier), | ||
595 | .sname = "CMS_KeyAgreeRecipientIdentifier", | ||
596 | }; | ||
597 | |||
598 | static const ASN1_TEMPLATE CMS_RecipientEncryptedKey_seq_tt[] = { | ||
599 | { | ||
600 | .flags = 0, | ||
601 | .tag = 0, | ||
602 | .offset = offsetof(CMS_RecipientEncryptedKey, rid), | ||
603 | .field_name = "rid", | ||
604 | .item = &CMS_KeyAgreeRecipientIdentifier_it, | ||
605 | }, | ||
606 | { | ||
607 | .flags = 0, | ||
608 | .tag = 0, | ||
609 | .offset = offsetof(CMS_RecipientEncryptedKey, encryptedKey), | ||
610 | .field_name = "encryptedKey", | ||
611 | .item = &ASN1_OCTET_STRING_it, | ||
612 | }, | ||
613 | }; | ||
614 | |||
615 | const ASN1_ITEM CMS_RecipientEncryptedKey_it = { | ||
616 | .itype = ASN1_ITYPE_SEQUENCE, | ||
617 | .utype = V_ASN1_SEQUENCE, | ||
618 | .templates = CMS_RecipientEncryptedKey_seq_tt, | ||
619 | .tcount = sizeof(CMS_RecipientEncryptedKey_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
620 | .funcs = NULL, | ||
621 | .size = sizeof(CMS_RecipientEncryptedKey), | ||
622 | .sname = "CMS_RecipientEncryptedKey", | ||
623 | }; | ||
624 | |||
625 | static const ASN1_TEMPLATE CMS_OriginatorPublicKey_seq_tt[] = { | ||
626 | { | ||
627 | .flags = 0, | ||
628 | .tag = 0, | ||
629 | .offset = offsetof(CMS_OriginatorPublicKey, algorithm), | ||
630 | .field_name = "algorithm", | ||
631 | .item = &X509_ALGOR_it, | ||
632 | }, | ||
633 | { | ||
634 | .flags = 0, | ||
635 | .tag = 0, | ||
636 | .offset = offsetof(CMS_OriginatorPublicKey, publicKey), | ||
637 | .field_name = "publicKey", | ||
638 | .item = &ASN1_BIT_STRING_it, | ||
639 | }, | ||
640 | }; | ||
641 | |||
642 | const ASN1_ITEM CMS_OriginatorPublicKey_it = { | ||
643 | .itype = ASN1_ITYPE_SEQUENCE, | ||
644 | .utype = V_ASN1_SEQUENCE, | ||
645 | .templates = CMS_OriginatorPublicKey_seq_tt, | ||
646 | .tcount = sizeof(CMS_OriginatorPublicKey_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
647 | .funcs = NULL, | ||
648 | .size = sizeof(CMS_OriginatorPublicKey), | ||
649 | .sname = "CMS_OriginatorPublicKey", | ||
650 | }; | ||
651 | |||
652 | static const ASN1_TEMPLATE CMS_OriginatorIdentifierOrKey_ch_tt[] = { | ||
653 | { | ||
654 | .flags = 0, | ||
655 | .tag = 0, | ||
656 | .offset = offsetof(CMS_OriginatorIdentifierOrKey, d.issuerAndSerialNumber), | ||
657 | .field_name = "d.issuerAndSerialNumber", | ||
658 | .item = &CMS_IssuerAndSerialNumber_it, | ||
659 | }, | ||
660 | { | ||
661 | .flags = ASN1_TFLG_IMPLICIT, | ||
662 | .tag = 0, | ||
663 | .offset = offsetof(CMS_OriginatorIdentifierOrKey, d.subjectKeyIdentifier), | ||
664 | .field_name = "d.subjectKeyIdentifier", | ||
665 | .item = &ASN1_OCTET_STRING_it, | ||
666 | }, | ||
667 | { | ||
668 | .flags = ASN1_TFLG_IMPLICIT, | ||
669 | .tag = 1, | ||
670 | .offset = offsetof(CMS_OriginatorIdentifierOrKey, d.originatorKey), | ||
671 | .field_name = "d.originatorKey", | ||
672 | .item = &CMS_OriginatorPublicKey_it, | ||
673 | }, | ||
674 | }; | ||
675 | |||
676 | const ASN1_ITEM CMS_OriginatorIdentifierOrKey_it = { | ||
677 | .itype = ASN1_ITYPE_CHOICE, | ||
678 | .utype = offsetof(CMS_OriginatorIdentifierOrKey, type), | ||
679 | .templates = CMS_OriginatorIdentifierOrKey_ch_tt, | ||
680 | .tcount = sizeof(CMS_OriginatorIdentifierOrKey_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
681 | .funcs = NULL, | ||
682 | .size = sizeof(CMS_OriginatorIdentifierOrKey), | ||
683 | .sname = "CMS_OriginatorIdentifierOrKey", | ||
684 | }; | ||
685 | |||
686 | static const ASN1_TEMPLATE CMS_KeyAgreeRecipientInfo_seq_tt[] = { | ||
687 | { | ||
688 | .flags = 0, | ||
689 | .tag = 0, | ||
690 | .offset = offsetof(CMS_KeyAgreeRecipientInfo, version), | ||
691 | .field_name = "version", | ||
692 | .item = &LONG_it, | ||
693 | }, | ||
694 | { | ||
695 | .flags = ASN1_TFLG_EXPLICIT, | ||
696 | .tag = 0, | ||
697 | .offset = offsetof(CMS_KeyAgreeRecipientInfo, originator), | ||
698 | .field_name = "originator", | ||
699 | .item = &CMS_OriginatorIdentifierOrKey_it, | ||
700 | }, | ||
701 | { | ||
702 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_OPTIONAL, | ||
703 | .tag = 1, | ||
704 | .offset = offsetof(CMS_KeyAgreeRecipientInfo, ukm), | ||
705 | .field_name = "ukm", | ||
706 | .item = &ASN1_OCTET_STRING_it, | ||
707 | }, | ||
708 | { | ||
709 | .flags = 0, | ||
710 | .tag = 0, | ||
711 | .offset = offsetof(CMS_KeyAgreeRecipientInfo, keyEncryptionAlgorithm), | ||
712 | .field_name = "keyEncryptionAlgorithm", | ||
713 | .item = &X509_ALGOR_it, | ||
714 | }, | ||
715 | { | ||
716 | .flags = ASN1_TFLG_SEQUENCE_OF, | ||
717 | .tag = 0, | ||
718 | .offset = offsetof(CMS_KeyAgreeRecipientInfo, recipientEncryptedKeys), | ||
719 | .field_name = "recipientEncryptedKeys", | ||
720 | .item = &CMS_RecipientEncryptedKey_it, | ||
721 | }, | ||
722 | }; | ||
723 | |||
724 | const ASN1_ITEM CMS_KeyAgreeRecipientInfo_it = { | ||
725 | .itype = ASN1_ITYPE_SEQUENCE, | ||
726 | .utype = V_ASN1_SEQUENCE, | ||
727 | .templates = CMS_KeyAgreeRecipientInfo_seq_tt, | ||
728 | .tcount = sizeof(CMS_KeyAgreeRecipientInfo_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
729 | .funcs = NULL, | ||
730 | .size = sizeof(CMS_KeyAgreeRecipientInfo), | ||
731 | .sname = "CMS_KeyAgreeRecipientInfo", | ||
732 | }; | ||
733 | |||
734 | static const ASN1_TEMPLATE CMS_KEKIdentifier_seq_tt[] = { | ||
735 | { | ||
736 | .flags = 0, | ||
737 | .tag = 0, | ||
738 | .offset = offsetof(CMS_KEKIdentifier, keyIdentifier), | ||
739 | .field_name = "keyIdentifier", | ||
740 | .item = &ASN1_OCTET_STRING_it, | ||
741 | }, | ||
742 | { | ||
743 | .flags = ASN1_TFLG_OPTIONAL, | ||
744 | .tag = 0, | ||
745 | .offset = offsetof(CMS_KEKIdentifier, date), | ||
746 | .field_name = "date", | ||
747 | .item = &ASN1_GENERALIZEDTIME_it, | ||
748 | }, | ||
749 | { | ||
750 | .flags = ASN1_TFLG_OPTIONAL, | ||
751 | .tag = 0, | ||
752 | .offset = offsetof(CMS_KEKIdentifier, other), | ||
753 | .field_name = "other", | ||
754 | .item = &CMS_OtherKeyAttribute_it, | ||
755 | }, | ||
756 | }; | ||
757 | |||
758 | const ASN1_ITEM CMS_KEKIdentifier_it = { | ||
759 | .itype = ASN1_ITYPE_SEQUENCE, | ||
760 | .utype = V_ASN1_SEQUENCE, | ||
761 | .templates = CMS_KEKIdentifier_seq_tt, | ||
762 | .tcount = sizeof(CMS_KEKIdentifier_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
763 | .funcs = NULL, | ||
764 | .size = sizeof(CMS_KEKIdentifier), | ||
765 | .sname = "CMS_KEKIdentifier", | ||
766 | }; | ||
767 | |||
768 | static const ASN1_TEMPLATE CMS_KEKRecipientInfo_seq_tt[] = { | ||
769 | { | ||
770 | .flags = 0, | ||
771 | .tag = 0, | ||
772 | .offset = offsetof(CMS_KEKRecipientInfo, version), | ||
773 | .field_name = "version", | ||
774 | .item = &LONG_it, | ||
775 | }, | ||
776 | { | ||
777 | .flags = 0, | ||
778 | .tag = 0, | ||
779 | .offset = offsetof(CMS_KEKRecipientInfo, kekid), | ||
780 | .field_name = "kekid", | ||
781 | .item = &CMS_KEKIdentifier_it, | ||
782 | }, | ||
783 | { | ||
784 | .flags = 0, | ||
785 | .tag = 0, | ||
786 | .offset = offsetof(CMS_KEKRecipientInfo, keyEncryptionAlgorithm), | ||
787 | .field_name = "keyEncryptionAlgorithm", | ||
788 | .item = &X509_ALGOR_it, | ||
789 | }, | ||
790 | { | ||
791 | .flags = 0, | ||
792 | .tag = 0, | ||
793 | .offset = offsetof(CMS_KEKRecipientInfo, encryptedKey), | ||
794 | .field_name = "encryptedKey", | ||
795 | .item = &ASN1_OCTET_STRING_it, | ||
796 | }, | ||
797 | }; | ||
798 | |||
799 | const ASN1_ITEM CMS_KEKRecipientInfo_it = { | ||
800 | .itype = ASN1_ITYPE_SEQUENCE, | ||
801 | .utype = V_ASN1_SEQUENCE, | ||
802 | .templates = CMS_KEKRecipientInfo_seq_tt, | ||
803 | .tcount = sizeof(CMS_KEKRecipientInfo_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
804 | .funcs = NULL, | ||
805 | .size = sizeof(CMS_KEKRecipientInfo), | ||
806 | .sname = "CMS_KEKRecipientInfo", | ||
807 | }; | ||
808 | |||
809 | static const ASN1_TEMPLATE CMS_PasswordRecipientInfo_seq_tt[] = { | ||
810 | { | ||
811 | .flags = 0, | ||
812 | .tag = 0, | ||
813 | .offset = offsetof(CMS_PasswordRecipientInfo, version), | ||
814 | .field_name = "version", | ||
815 | .item = &LONG_it, | ||
816 | }, | ||
817 | { | ||
818 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_OPTIONAL, | ||
819 | .tag = 0, | ||
820 | .offset = offsetof(CMS_PasswordRecipientInfo, keyDerivationAlgorithm), | ||
821 | .field_name = "keyDerivationAlgorithm", | ||
822 | .item = &X509_ALGOR_it, | ||
823 | }, | ||
824 | { | ||
825 | .flags = 0, | ||
826 | .tag = 0, | ||
827 | .offset = offsetof(CMS_PasswordRecipientInfo, keyEncryptionAlgorithm), | ||
828 | .field_name = "keyEncryptionAlgorithm", | ||
829 | .item = &X509_ALGOR_it, | ||
830 | }, | ||
831 | { | ||
832 | .flags = 0, | ||
833 | .tag = 0, | ||
834 | .offset = offsetof(CMS_PasswordRecipientInfo, encryptedKey), | ||
835 | .field_name = "encryptedKey", | ||
836 | .item = &ASN1_OCTET_STRING_it, | ||
837 | }, | ||
838 | }; | ||
839 | |||
840 | const ASN1_ITEM CMS_PasswordRecipientInfo_it = { | ||
841 | .itype = ASN1_ITYPE_SEQUENCE, | ||
842 | .utype = V_ASN1_SEQUENCE, | ||
843 | .templates = CMS_PasswordRecipientInfo_seq_tt, | ||
844 | .tcount = sizeof(CMS_PasswordRecipientInfo_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
845 | .funcs = NULL, | ||
846 | .size = sizeof(CMS_PasswordRecipientInfo), | ||
847 | .sname = "CMS_PasswordRecipientInfo", | ||
848 | }; | ||
849 | |||
850 | static const ASN1_TEMPLATE CMS_OtherRecipientInfo_seq_tt[] = { | ||
851 | { | ||
852 | .flags = 0, | ||
853 | .tag = 0, | ||
854 | .offset = offsetof(CMS_OtherRecipientInfo, oriType), | ||
855 | .field_name = "oriType", | ||
856 | .item = &ASN1_OBJECT_it, | ||
857 | }, | ||
858 | { | ||
859 | .flags = ASN1_TFLG_OPTIONAL, | ||
860 | .tag = 0, | ||
861 | .offset = offsetof(CMS_OtherRecipientInfo, oriValue), | ||
862 | .field_name = "oriValue", | ||
863 | .item = &ASN1_ANY_it, | ||
864 | }, | ||
865 | }; | ||
866 | |||
867 | const ASN1_ITEM CMS_OtherRecipientInfo_it = { | ||
868 | .itype = ASN1_ITYPE_SEQUENCE, | ||
869 | .utype = V_ASN1_SEQUENCE, | ||
870 | .templates = CMS_OtherRecipientInfo_seq_tt, | ||
871 | .tcount = sizeof(CMS_OtherRecipientInfo_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
872 | .funcs = NULL, | ||
873 | .size = sizeof(CMS_OtherRecipientInfo), | ||
874 | .sname = "CMS_OtherRecipientInfo", | ||
875 | }; | ||
876 | |||
877 | /* Free up RecipientInfo additional data */ | ||
878 | static int | ||
879 | cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) | ||
880 | { | ||
881 | if (operation == ASN1_OP_FREE_PRE) { | ||
882 | CMS_RecipientInfo *ri = (CMS_RecipientInfo *)*pval; | ||
883 | if (ri->type == CMS_RECIPINFO_TRANS) { | ||
884 | CMS_KeyTransRecipientInfo *ktri = ri->d.ktri; | ||
885 | EVP_PKEY_free(ktri->pkey); | ||
886 | if (ktri->recip) | ||
887 | X509_free(ktri->recip); | ||
888 | } else if (ri->type == CMS_RECIPINFO_KEK) { | ||
889 | CMS_KEKRecipientInfo *kekri = ri->d.kekri; | ||
890 | if (kekri->key) { | ||
891 | OPENSSL_cleanse(kekri->key, kekri->keylen); | ||
892 | free(kekri->key); | ||
893 | } | ||
894 | } else if (ri->type == CMS_RECIPINFO_PASS) { | ||
895 | CMS_PasswordRecipientInfo *pwri = ri->d.pwri; | ||
896 | if (pwri->pass) { | ||
897 | OPENSSL_cleanse(pwri->pass, pwri->passlen); | ||
898 | free(pwri->pass); | ||
899 | } | ||
900 | } | ||
901 | } | ||
902 | return 1; | ||
903 | } | ||
904 | |||
905 | static const ASN1_AUX CMS_RecipientInfo_aux = { | ||
906 | .app_data = NULL, | ||
907 | .flags = 0, | ||
908 | .ref_offset = 0, | ||
909 | .ref_lock = 0, | ||
910 | .asn1_cb = cms_ri_cb, | ||
911 | .enc_offset = 0, | ||
912 | }; | ||
913 | static const ASN1_TEMPLATE CMS_RecipientInfo_ch_tt[] = { | ||
914 | { | ||
915 | .flags = 0, | ||
916 | .tag = 0, | ||
917 | .offset = offsetof(CMS_RecipientInfo, d.ktri), | ||
918 | .field_name = "d.ktri", | ||
919 | .item = &CMS_KeyTransRecipientInfo_it, | ||
920 | }, | ||
921 | { | ||
922 | .flags = ASN1_TFLG_IMPLICIT, | ||
923 | .tag = 1, | ||
924 | .offset = offsetof(CMS_RecipientInfo, d.kari), | ||
925 | .field_name = "d.kari", | ||
926 | .item = &CMS_KeyAgreeRecipientInfo_it, | ||
927 | }, | ||
928 | { | ||
929 | .flags = ASN1_TFLG_IMPLICIT, | ||
930 | .tag = 2, | ||
931 | .offset = offsetof(CMS_RecipientInfo, d.kekri), | ||
932 | .field_name = "d.kekri", | ||
933 | .item = &CMS_KEKRecipientInfo_it, | ||
934 | }, | ||
935 | { | ||
936 | .flags = ASN1_TFLG_IMPLICIT, | ||
937 | .tag = 3, | ||
938 | .offset = offsetof(CMS_RecipientInfo, d.pwri), | ||
939 | .field_name = "d.pwri", | ||
940 | .item = &CMS_PasswordRecipientInfo_it, | ||
941 | }, | ||
942 | { | ||
943 | .flags = ASN1_TFLG_IMPLICIT, | ||
944 | .tag = 4, | ||
945 | .offset = offsetof(CMS_RecipientInfo, d.ori), | ||
946 | .field_name = "d.ori", | ||
947 | .item = &CMS_OtherRecipientInfo_it, | ||
948 | }, | ||
949 | }; | ||
950 | |||
951 | const ASN1_ITEM CMS_RecipientInfo_it = { | ||
952 | .itype = ASN1_ITYPE_CHOICE, | ||
953 | .utype = offsetof(CMS_RecipientInfo, type), | ||
954 | .templates = CMS_RecipientInfo_ch_tt, | ||
955 | .tcount = sizeof(CMS_RecipientInfo_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
956 | .funcs = &CMS_RecipientInfo_aux, | ||
957 | .size = sizeof(CMS_RecipientInfo), | ||
958 | .sname = "CMS_RecipientInfo", | ||
959 | }; | ||
960 | |||
961 | static const ASN1_TEMPLATE CMS_EnvelopedData_seq_tt[] = { | ||
962 | { | ||
963 | .flags = 0, | ||
964 | .tag = 0, | ||
965 | .offset = offsetof(CMS_EnvelopedData, version), | ||
966 | .field_name = "version", | ||
967 | .item = &LONG_it, | ||
968 | }, | ||
969 | { | ||
970 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_OPTIONAL, | ||
971 | .tag = 0, | ||
972 | .offset = offsetof(CMS_EnvelopedData, originatorInfo), | ||
973 | .field_name = "originatorInfo", | ||
974 | .item = &CMS_OriginatorInfo_it, | ||
975 | }, | ||
976 | { | ||
977 | .flags = ASN1_TFLG_SET_OF, | ||
978 | .tag = 0, | ||
979 | .offset = offsetof(CMS_EnvelopedData, recipientInfos), | ||
980 | .field_name = "recipientInfos", | ||
981 | .item = &CMS_RecipientInfo_it, | ||
982 | }, | ||
983 | { | ||
984 | .flags = 0, | ||
985 | .tag = 0, | ||
986 | .offset = offsetof(CMS_EnvelopedData, encryptedContentInfo), | ||
987 | .field_name = "encryptedContentInfo", | ||
988 | .item = &CMS_EncryptedContentInfo_it, | ||
989 | }, | ||
990 | { | ||
991 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, | ||
992 | .tag = 1, | ||
993 | .offset = offsetof(CMS_EnvelopedData, unprotectedAttrs), | ||
994 | .field_name = "unprotectedAttrs", | ||
995 | .item = &X509_ATTRIBUTE_it, | ||
996 | }, | ||
997 | }; | ||
998 | |||
999 | const ASN1_ITEM CMS_EnvelopedData_it = { | ||
1000 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, | ||
1001 | .utype = V_ASN1_SEQUENCE, | ||
1002 | .templates = CMS_EnvelopedData_seq_tt, | ||
1003 | .tcount = sizeof(CMS_EnvelopedData_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
1004 | .funcs = NULL, | ||
1005 | .size = sizeof(CMS_EnvelopedData), | ||
1006 | .sname = "CMS_EnvelopedData", | ||
1007 | }; | ||
1008 | |||
1009 | static const ASN1_TEMPLATE CMS_DigestedData_seq_tt[] = { | ||
1010 | { | ||
1011 | .flags = 0, | ||
1012 | .tag = 0, | ||
1013 | .offset = offsetof(CMS_DigestedData, version), | ||
1014 | .field_name = "version", | ||
1015 | .item = &LONG_it, | ||
1016 | }, | ||
1017 | { | ||
1018 | .flags = 0, | ||
1019 | .tag = 0, | ||
1020 | .offset = offsetof(CMS_DigestedData, digestAlgorithm), | ||
1021 | .field_name = "digestAlgorithm", | ||
1022 | .item = &X509_ALGOR_it, | ||
1023 | }, | ||
1024 | { | ||
1025 | .flags = 0, | ||
1026 | .tag = 0, | ||
1027 | .offset = offsetof(CMS_DigestedData, encapContentInfo), | ||
1028 | .field_name = "encapContentInfo", | ||
1029 | .item = &CMS_EncapsulatedContentInfo_it, | ||
1030 | }, | ||
1031 | { | ||
1032 | .flags = 0, | ||
1033 | .tag = 0, | ||
1034 | .offset = offsetof(CMS_DigestedData, digest), | ||
1035 | .field_name = "digest", | ||
1036 | .item = &ASN1_OCTET_STRING_it, | ||
1037 | }, | ||
1038 | }; | ||
1039 | |||
1040 | const ASN1_ITEM CMS_DigestedData_it = { | ||
1041 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, | ||
1042 | .utype = V_ASN1_SEQUENCE, | ||
1043 | .templates = CMS_DigestedData_seq_tt, | ||
1044 | .tcount = sizeof(CMS_DigestedData_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
1045 | .funcs = NULL, | ||
1046 | .size = sizeof(CMS_DigestedData), | ||
1047 | .sname = "CMS_DigestedData", | ||
1048 | }; | ||
1049 | |||
1050 | static const ASN1_TEMPLATE CMS_EncryptedData_seq_tt[] = { | ||
1051 | { | ||
1052 | .flags = 0, | ||
1053 | .tag = 0, | ||
1054 | .offset = offsetof(CMS_EncryptedData, version), | ||
1055 | .field_name = "version", | ||
1056 | .item = &LONG_it, | ||
1057 | }, | ||
1058 | { | ||
1059 | .flags = 0, | ||
1060 | .tag = 0, | ||
1061 | .offset = offsetof(CMS_EncryptedData, encryptedContentInfo), | ||
1062 | .field_name = "encryptedContentInfo", | ||
1063 | .item = &CMS_EncryptedContentInfo_it, | ||
1064 | }, | ||
1065 | { | ||
1066 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, | ||
1067 | .tag = 1, | ||
1068 | .offset = offsetof(CMS_EncryptedData, unprotectedAttrs), | ||
1069 | .field_name = "unprotectedAttrs", | ||
1070 | .item = &X509_ATTRIBUTE_it, | ||
1071 | }, | ||
1072 | }; | ||
1073 | |||
1074 | const ASN1_ITEM CMS_EncryptedData_it = { | ||
1075 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, | ||
1076 | .utype = V_ASN1_SEQUENCE, | ||
1077 | .templates = CMS_EncryptedData_seq_tt, | ||
1078 | .tcount = sizeof(CMS_EncryptedData_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
1079 | .funcs = NULL, | ||
1080 | .size = sizeof(CMS_EncryptedData), | ||
1081 | .sname = "CMS_EncryptedData", | ||
1082 | }; | ||
1083 | |||
1084 | static const ASN1_TEMPLATE CMS_AuthenticatedData_seq_tt[] = { | ||
1085 | { | ||
1086 | .flags = 0, | ||
1087 | .tag = 0, | ||
1088 | .offset = offsetof(CMS_AuthenticatedData, version), | ||
1089 | .field_name = "version", | ||
1090 | .item = &LONG_it, | ||
1091 | }, | ||
1092 | { | ||
1093 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_OPTIONAL, | ||
1094 | .tag = 0, | ||
1095 | .offset = offsetof(CMS_AuthenticatedData, originatorInfo), | ||
1096 | .field_name = "originatorInfo", | ||
1097 | .item = &CMS_OriginatorInfo_it, | ||
1098 | }, | ||
1099 | { | ||
1100 | .flags = ASN1_TFLG_SET_OF, | ||
1101 | .tag = 0, | ||
1102 | .offset = offsetof(CMS_AuthenticatedData, recipientInfos), | ||
1103 | .field_name = "recipientInfos", | ||
1104 | .item = &CMS_RecipientInfo_it, | ||
1105 | }, | ||
1106 | { | ||
1107 | .flags = 0, | ||
1108 | .tag = 0, | ||
1109 | .offset = offsetof(CMS_AuthenticatedData, macAlgorithm), | ||
1110 | .field_name = "macAlgorithm", | ||
1111 | .item = &X509_ALGOR_it, | ||
1112 | }, | ||
1113 | { | ||
1114 | .flags = ASN1_TFLG_IMPLICIT, | ||
1115 | .tag = 1, | ||
1116 | .offset = offsetof(CMS_AuthenticatedData, digestAlgorithm), | ||
1117 | .field_name = "digestAlgorithm", | ||
1118 | .item = &X509_ALGOR_it, | ||
1119 | }, | ||
1120 | { | ||
1121 | .flags = 0, | ||
1122 | .tag = 0, | ||
1123 | .offset = offsetof(CMS_AuthenticatedData, encapContentInfo), | ||
1124 | .field_name = "encapContentInfo", | ||
1125 | .item = &CMS_EncapsulatedContentInfo_it, | ||
1126 | }, | ||
1127 | { | ||
1128 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, | ||
1129 | .tag = 2, | ||
1130 | .offset = offsetof(CMS_AuthenticatedData, authAttrs), | ||
1131 | .field_name = "authAttrs", | ||
1132 | .item = &X509_ALGOR_it, | ||
1133 | }, | ||
1134 | { | ||
1135 | .flags = 0, | ||
1136 | .tag = 0, | ||
1137 | .offset = offsetof(CMS_AuthenticatedData, mac), | ||
1138 | .field_name = "mac", | ||
1139 | .item = &ASN1_OCTET_STRING_it, | ||
1140 | }, | ||
1141 | { | ||
1142 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SET_OF | ASN1_TFLG_OPTIONAL, | ||
1143 | .tag = 3, | ||
1144 | .offset = offsetof(CMS_AuthenticatedData, unauthAttrs), | ||
1145 | .field_name = "unauthAttrs", | ||
1146 | .item = &X509_ALGOR_it, | ||
1147 | }, | ||
1148 | }; | ||
1149 | |||
1150 | const ASN1_ITEM CMS_AuthenticatedData_it = { | ||
1151 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, | ||
1152 | .utype = V_ASN1_SEQUENCE, | ||
1153 | .templates = CMS_AuthenticatedData_seq_tt, | ||
1154 | .tcount = sizeof(CMS_AuthenticatedData_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
1155 | .funcs = NULL, | ||
1156 | .size = sizeof(CMS_AuthenticatedData), | ||
1157 | .sname = "CMS_AuthenticatedData", | ||
1158 | }; | ||
1159 | |||
1160 | static const ASN1_TEMPLATE CMS_CompressedData_seq_tt[] = { | ||
1161 | { | ||
1162 | .flags = 0, | ||
1163 | .tag = 0, | ||
1164 | .offset = offsetof(CMS_CompressedData, version), | ||
1165 | .field_name = "version", | ||
1166 | .item = &LONG_it, | ||
1167 | }, | ||
1168 | { | ||
1169 | .flags = 0, | ||
1170 | .tag = 0, | ||
1171 | .offset = offsetof(CMS_CompressedData, compressionAlgorithm), | ||
1172 | .field_name = "compressionAlgorithm", | ||
1173 | .item = &X509_ALGOR_it, | ||
1174 | }, | ||
1175 | { | ||
1176 | .flags = 0, | ||
1177 | .tag = 0, | ||
1178 | .offset = offsetof(CMS_CompressedData, encapContentInfo), | ||
1179 | .field_name = "encapContentInfo", | ||
1180 | .item = &CMS_EncapsulatedContentInfo_it, | ||
1181 | }, | ||
1182 | }; | ||
1183 | |||
1184 | const ASN1_ITEM CMS_CompressedData_it = { | ||
1185 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, | ||
1186 | .utype = V_ASN1_SEQUENCE, | ||
1187 | .templates = CMS_CompressedData_seq_tt, | ||
1188 | .tcount = sizeof(CMS_CompressedData_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
1189 | .funcs = NULL, | ||
1190 | .size = sizeof(CMS_CompressedData), | ||
1191 | .sname = "CMS_CompressedData", | ||
1192 | }; | ||
1193 | |||
1194 | /* This is the ANY DEFINED BY table for the top level ContentInfo structure */ | ||
1195 | |||
1196 | static const ASN1_TEMPLATE cms_default_tt = { | ||
1197 | .flags = ASN1_TFLG_EXPLICIT, | ||
1198 | .tag = 0, | ||
1199 | .offset = offsetof(CMS_ContentInfo, d.other), | ||
1200 | .field_name = "d.other", | ||
1201 | .item = &ASN1_ANY_it, | ||
1202 | }; | ||
1203 | |||
1204 | static const ASN1_ADB_TABLE CMS_ContentInfo_adbtbl[] = { | ||
1205 | { | ||
1206 | .value = NID_pkcs7_data, | ||
1207 | .tt = { | ||
1208 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_NDEF, | ||
1209 | .tag = 0, | ||
1210 | .offset = offsetof(CMS_ContentInfo, d.data), | ||
1211 | .field_name = "d.data", | ||
1212 | .item = &ASN1_OCTET_STRING_NDEF_it, | ||
1213 | }, | ||
1214 | |||
1215 | }, | ||
1216 | { | ||
1217 | .value = NID_pkcs7_signed, | ||
1218 | .tt = { | ||
1219 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_NDEF, | ||
1220 | .tag = 0, | ||
1221 | .offset = offsetof(CMS_ContentInfo, d.signedData), | ||
1222 | .field_name = "d.signedData", | ||
1223 | .item = &CMS_SignedData_it, | ||
1224 | }, | ||
1225 | |||
1226 | }, | ||
1227 | { | ||
1228 | .value = NID_pkcs7_enveloped, | ||
1229 | .tt = { | ||
1230 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_NDEF, | ||
1231 | .tag = 0, | ||
1232 | .offset = offsetof(CMS_ContentInfo, d.envelopedData), | ||
1233 | .field_name = "d.envelopedData", | ||
1234 | .item = &CMS_EnvelopedData_it, | ||
1235 | }, | ||
1236 | |||
1237 | }, | ||
1238 | { | ||
1239 | .value = NID_pkcs7_digest, | ||
1240 | .tt = { | ||
1241 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_NDEF, | ||
1242 | .tag = 0, | ||
1243 | .offset = offsetof(CMS_ContentInfo, d.digestedData), | ||
1244 | .field_name = "d.digestedData", | ||
1245 | .item = &CMS_DigestedData_it, | ||
1246 | }, | ||
1247 | |||
1248 | }, | ||
1249 | { | ||
1250 | .value = NID_pkcs7_encrypted, | ||
1251 | .tt = { | ||
1252 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_NDEF, | ||
1253 | .tag = 0, | ||
1254 | .offset = offsetof(CMS_ContentInfo, d.encryptedData), | ||
1255 | .field_name = "d.encryptedData", | ||
1256 | .item = &CMS_EncryptedData_it, | ||
1257 | }, | ||
1258 | |||
1259 | }, | ||
1260 | { | ||
1261 | .value = NID_id_smime_ct_authData, | ||
1262 | .tt = { | ||
1263 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_NDEF, | ||
1264 | .tag = 0, | ||
1265 | .offset = offsetof(CMS_ContentInfo, d.authenticatedData), | ||
1266 | .field_name = "d.authenticatedData", | ||
1267 | .item = &CMS_AuthenticatedData_it, | ||
1268 | }, | ||
1269 | |||
1270 | }, | ||
1271 | { | ||
1272 | .value = NID_id_smime_ct_compressedData, | ||
1273 | .tt = { | ||
1274 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_NDEF, | ||
1275 | .tag = 0, | ||
1276 | .offset = offsetof(CMS_ContentInfo, d.compressedData), | ||
1277 | .field_name = "d.compressedData", | ||
1278 | .item = &CMS_CompressedData_it, | ||
1279 | }, | ||
1280 | |||
1281 | }, | ||
1282 | }; | ||
1283 | |||
1284 | static const ASN1_ADB CMS_ContentInfo_adb = { | ||
1285 | .flags = 0, | ||
1286 | .offset = offsetof(CMS_ContentInfo, contentType), | ||
1287 | .app_items = 0, | ||
1288 | .tbl = CMS_ContentInfo_adbtbl, | ||
1289 | .tblcount = sizeof(CMS_ContentInfo_adbtbl) / sizeof(ASN1_ADB_TABLE), | ||
1290 | .default_tt = &cms_default_tt, | ||
1291 | .null_tt = NULL, | ||
1292 | }; | ||
1293 | |||
1294 | /* CMS streaming support */ | ||
1295 | static int | ||
1296 | cms_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) | ||
1297 | { | ||
1298 | ASN1_STREAM_ARG *sarg = exarg; | ||
1299 | CMS_ContentInfo *cms = NULL; | ||
1300 | |||
1301 | if (pval) | ||
1302 | cms = (CMS_ContentInfo *)*pval; | ||
1303 | else | ||
1304 | return 1; | ||
1305 | |||
1306 | switch (operation) { | ||
1307 | case ASN1_OP_STREAM_PRE: | ||
1308 | if (CMS_stream(&sarg->boundary, cms) <= 0) | ||
1309 | return 0; | ||
1310 | case ASN1_OP_DETACHED_PRE: | ||
1311 | sarg->ndef_bio = CMS_dataInit(cms, sarg->out); | ||
1312 | if (!sarg->ndef_bio) | ||
1313 | return 0; | ||
1314 | break; | ||
1315 | case ASN1_OP_STREAM_POST: | ||
1316 | case ASN1_OP_DETACHED_POST: | ||
1317 | if (CMS_dataFinal(cms, sarg->ndef_bio) <= 0) | ||
1318 | return 0; | ||
1319 | break; | ||
1320 | } | ||
1321 | return 1; | ||
1322 | } | ||
1323 | |||
1324 | static const ASN1_AUX CMS_ContentInfo_aux = { | ||
1325 | .app_data = NULL, | ||
1326 | .flags = 0, | ||
1327 | .ref_offset = 0, | ||
1328 | .ref_lock = 0, | ||
1329 | .asn1_cb = cms_cb, | ||
1330 | .enc_offset = 0, | ||
1331 | }; | ||
1332 | static const ASN1_TEMPLATE CMS_ContentInfo_seq_tt[] = { | ||
1333 | { | ||
1334 | .flags = 0, | ||
1335 | .tag = 0, | ||
1336 | .offset = offsetof(CMS_ContentInfo, contentType), | ||
1337 | .field_name = "contentType", | ||
1338 | .item = &ASN1_OBJECT_it, | ||
1339 | }, | ||
1340 | { | ||
1341 | .flags = ASN1_TFLG_ADB_OID, | ||
1342 | .tag = -1, | ||
1343 | .offset = 0, | ||
1344 | .field_name = "CMS_ContentInfo", | ||
1345 | .item = (const ASN1_ITEM *)&CMS_ContentInfo_adb, | ||
1346 | }, | ||
1347 | }; | ||
1348 | |||
1349 | const ASN1_ITEM CMS_ContentInfo_it = { | ||
1350 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, | ||
1351 | .utype = V_ASN1_SEQUENCE, | ||
1352 | .templates = CMS_ContentInfo_seq_tt, | ||
1353 | .tcount = sizeof(CMS_ContentInfo_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
1354 | .funcs = &CMS_ContentInfo_aux, | ||
1355 | .size = sizeof(CMS_ContentInfo), | ||
1356 | .sname = "CMS_ContentInfo", | ||
1357 | }; | ||
1358 | |||
1359 | /* Specials for signed attributes */ | ||
1360 | |||
1361 | /* When signing attributes we want to reorder them to match the sorted | ||
1362 | * encoding. | ||
1363 | */ | ||
1364 | |||
1365 | static const ASN1_TEMPLATE CMS_Attributes_Sign_item_tt = { | ||
1366 | .flags = ASN1_TFLG_SET_ORDER, | ||
1367 | .tag = 0, | ||
1368 | .offset = 0, | ||
1369 | .field_name = "CMS_ATTRIBUTES", | ||
1370 | .item = &X509_ATTRIBUTE_it, | ||
1371 | }; | ||
1372 | |||
1373 | const ASN1_ITEM CMS_Attributes_Sign_it = { | ||
1374 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
1375 | .utype = -1, | ||
1376 | .templates = &CMS_Attributes_Sign_item_tt, | ||
1377 | .tcount = 0, | ||
1378 | .funcs = NULL, | ||
1379 | .size = 0, | ||
1380 | .sname = "CMS_Attributes_Sign", | ||
1381 | }; | ||
1382 | |||
1383 | /* When verifying attributes we need to use the received order. So | ||
1384 | * we use SEQUENCE OF and tag it to SET OF | ||
1385 | */ | ||
1386 | |||
1387 | static const ASN1_TEMPLATE CMS_Attributes_Verify_item_tt = { | ||
1388 | .flags = ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_IMPTAG | ASN1_TFLG_UNIVERSAL, | ||
1389 | .tag = V_ASN1_SET, | ||
1390 | .offset = 0, | ||
1391 | .field_name = "CMS_ATTRIBUTES", | ||
1392 | .item = &X509_ATTRIBUTE_it, | ||
1393 | }; | ||
1394 | |||
1395 | const ASN1_ITEM CMS_Attributes_Verify_it = { | ||
1396 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
1397 | .utype = -1, | ||
1398 | .templates = &CMS_Attributes_Verify_item_tt, | ||
1399 | .tcount = 0, | ||
1400 | .funcs = NULL, | ||
1401 | .size = 0, | ||
1402 | .sname = "CMS_Attributes_Verify", | ||
1403 | }; | ||
1404 | |||
1405 | static const ASN1_TEMPLATE CMS_ReceiptsFrom_ch_tt[] = { | ||
1406 | { | ||
1407 | .flags = ASN1_TFLG_IMPLICIT, | ||
1408 | .tag = 0, | ||
1409 | .offset = offsetof(CMS_ReceiptsFrom, d.allOrFirstTier), | ||
1410 | .field_name = "d.allOrFirstTier", | ||
1411 | .item = &LONG_it, | ||
1412 | }, | ||
1413 | { | ||
1414 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_SEQUENCE_OF, | ||
1415 | .tag = 1, | ||
1416 | .offset = offsetof(CMS_ReceiptsFrom, d.receiptList), | ||
1417 | .field_name = "d.receiptList", | ||
1418 | .item = &GENERAL_NAMES_it, | ||
1419 | }, | ||
1420 | }; | ||
1421 | |||
1422 | const ASN1_ITEM CMS_ReceiptsFrom_it = { | ||
1423 | .itype = ASN1_ITYPE_CHOICE, | ||
1424 | .utype = offsetof(CMS_ReceiptsFrom, type), | ||
1425 | .templates = CMS_ReceiptsFrom_ch_tt, | ||
1426 | .tcount = sizeof(CMS_ReceiptsFrom_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
1427 | .funcs = NULL, | ||
1428 | .size = sizeof(CMS_ReceiptsFrom), | ||
1429 | .sname = "CMS_ReceiptsFrom", | ||
1430 | }; | ||
1431 | |||
1432 | static const ASN1_TEMPLATE CMS_ReceiptRequest_seq_tt[] = { | ||
1433 | { | ||
1434 | .flags = 0, | ||
1435 | .tag = 0, | ||
1436 | .offset = offsetof(CMS_ReceiptRequest, signedContentIdentifier), | ||
1437 | .field_name = "signedContentIdentifier", | ||
1438 | .item = &ASN1_OCTET_STRING_it, | ||
1439 | }, | ||
1440 | { | ||
1441 | .flags = 0, | ||
1442 | .tag = 0, | ||
1443 | .offset = offsetof(CMS_ReceiptRequest, receiptsFrom), | ||
1444 | .field_name = "receiptsFrom", | ||
1445 | .item = &CMS_ReceiptsFrom_it, | ||
1446 | }, | ||
1447 | { | ||
1448 | .flags = ASN1_TFLG_SEQUENCE_OF, | ||
1449 | .tag = 0, | ||
1450 | .offset = offsetof(CMS_ReceiptRequest, receiptsTo), | ||
1451 | .field_name = "receiptsTo", | ||
1452 | .item = &GENERAL_NAMES_it, | ||
1453 | }, | ||
1454 | }; | ||
1455 | |||
1456 | const ASN1_ITEM CMS_ReceiptRequest_it = { | ||
1457 | .itype = ASN1_ITYPE_SEQUENCE, | ||
1458 | .utype = V_ASN1_SEQUENCE, | ||
1459 | .templates = CMS_ReceiptRequest_seq_tt, | ||
1460 | .tcount = sizeof(CMS_ReceiptRequest_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
1461 | .funcs = NULL, | ||
1462 | .size = sizeof(CMS_ReceiptRequest), | ||
1463 | .sname = "CMS_ReceiptRequest", | ||
1464 | }; | ||
1465 | |||
1466 | static const ASN1_TEMPLATE CMS_Receipt_seq_tt[] = { | ||
1467 | { | ||
1468 | .flags = 0, | ||
1469 | .tag = 0, | ||
1470 | .offset = offsetof(CMS_Receipt, version), | ||
1471 | .field_name = "version", | ||
1472 | .item = &LONG_it, | ||
1473 | }, | ||
1474 | { | ||
1475 | .flags = 0, | ||
1476 | .tag = 0, | ||
1477 | .offset = offsetof(CMS_Receipt, contentType), | ||
1478 | .field_name = "contentType", | ||
1479 | .item = &ASN1_OBJECT_it, | ||
1480 | }, | ||
1481 | { | ||
1482 | .flags = 0, | ||
1483 | .tag = 0, | ||
1484 | .offset = offsetof(CMS_Receipt, signedContentIdentifier), | ||
1485 | .field_name = "signedContentIdentifier", | ||
1486 | .item = &ASN1_OCTET_STRING_it, | ||
1487 | }, | ||
1488 | { | ||
1489 | .flags = 0, | ||
1490 | .tag = 0, | ||
1491 | .offset = offsetof(CMS_Receipt, originatorSignatureValue), | ||
1492 | .field_name = "originatorSignatureValue", | ||
1493 | .item = &ASN1_OCTET_STRING_it, | ||
1494 | }, | ||
1495 | }; | ||
1496 | |||
1497 | const ASN1_ITEM CMS_Receipt_it = { | ||
1498 | .itype = ASN1_ITYPE_SEQUENCE, | ||
1499 | .utype = V_ASN1_SEQUENCE, | ||
1500 | .templates = CMS_Receipt_seq_tt, | ||
1501 | .tcount = sizeof(CMS_Receipt_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
1502 | .funcs = NULL, | ||
1503 | .size = sizeof(CMS_Receipt), | ||
1504 | .sname = "CMS_Receipt", | ||
1505 | }; | ||