diff options
Diffstat (limited to 'src/lib/libcrypto/cms/cms_asn1.c')
-rw-r--r-- | src/lib/libcrypto/cms/cms_asn1.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/src/lib/libcrypto/cms/cms_asn1.c b/src/lib/libcrypto/cms/cms_asn1.c index 7664921861..fcba4dcbcc 100644 --- a/src/lib/libcrypto/cms/cms_asn1.c +++ b/src/lib/libcrypto/cms/cms_asn1.c | |||
@@ -87,7 +87,8 @@ ASN1_NDEF_SEQUENCE(CMS_EncapsulatedContentInfo) = { | |||
87 | } ASN1_NDEF_SEQUENCE_END(CMS_EncapsulatedContentInfo) | 87 | } ASN1_NDEF_SEQUENCE_END(CMS_EncapsulatedContentInfo) |
88 | 88 | ||
89 | /* Minor tweak to operation: free up signer key, cert */ | 89 | /* Minor tweak to operation: free up signer key, cert */ |
90 | static int cms_si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 90 | static int cms_si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
91 | void *exarg) | ||
91 | { | 92 | { |
92 | if(operation == ASN1_OP_FREE_POST) | 93 | if(operation == ASN1_OP_FREE_POST) |
93 | { | 94 | { |
@@ -130,8 +131,8 @@ ASN1_NDEF_SEQUENCE(CMS_SignedData) = { | |||
130 | } ASN1_NDEF_SEQUENCE_END(CMS_SignedData) | 131 | } ASN1_NDEF_SEQUENCE_END(CMS_SignedData) |
131 | 132 | ||
132 | ASN1_SEQUENCE(CMS_OriginatorInfo) = { | 133 | ASN1_SEQUENCE(CMS_OriginatorInfo) = { |
133 | ASN1_IMP_SET_OF_OPT(CMS_SignedData, certificates, CMS_CertificateChoices, 0), | 134 | ASN1_IMP_SET_OF_OPT(CMS_OriginatorInfo, certificates, CMS_CertificateChoices, 0), |
134 | ASN1_IMP_SET_OF_OPT(CMS_SignedData, crls, CMS_RevocationInfoChoice, 1) | 135 | ASN1_IMP_SET_OF_OPT(CMS_OriginatorInfo, crls, CMS_RevocationInfoChoice, 1) |
135 | } ASN1_SEQUENCE_END(CMS_OriginatorInfo) | 136 | } ASN1_SEQUENCE_END(CMS_OriginatorInfo) |
136 | 137 | ||
137 | ASN1_NDEF_SEQUENCE(CMS_EncryptedContentInfo) = { | 138 | ASN1_NDEF_SEQUENCE(CMS_EncryptedContentInfo) = { |
@@ -213,7 +214,8 @@ ASN1_SEQUENCE(CMS_OtherRecipientInfo) = { | |||
213 | } ASN1_SEQUENCE_END(CMS_OtherRecipientInfo) | 214 | } ASN1_SEQUENCE_END(CMS_OtherRecipientInfo) |
214 | 215 | ||
215 | /* Free up RecipientInfo additional data */ | 216 | /* Free up RecipientInfo additional data */ |
216 | static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 217 | static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
218 | void *exarg) | ||
217 | { | 219 | { |
218 | if(operation == ASN1_OP_FREE_PRE) | 220 | if(operation == ASN1_OP_FREE_PRE) |
219 | { | 221 | { |
@@ -300,10 +302,42 @@ ASN1_ADB(CMS_ContentInfo) = { | |||
300 | ADB_ENTRY(NID_id_smime_ct_compressedData, ASN1_NDEF_EXP(CMS_ContentInfo, d.compressedData, CMS_CompressedData, 0)), | 302 | ADB_ENTRY(NID_id_smime_ct_compressedData, ASN1_NDEF_EXP(CMS_ContentInfo, d.compressedData, CMS_CompressedData, 0)), |
301 | } ASN1_ADB_END(CMS_ContentInfo, 0, contentType, 0, &cms_default_tt, NULL); | 303 | } ASN1_ADB_END(CMS_ContentInfo, 0, contentType, 0, &cms_default_tt, NULL); |
302 | 304 | ||
303 | ASN1_NDEF_SEQUENCE(CMS_ContentInfo) = { | 305 | /* CMS streaming support */ |
306 | static int cms_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | ||
307 | void *exarg) | ||
308 | { | ||
309 | ASN1_STREAM_ARG *sarg = exarg; | ||
310 | CMS_ContentInfo *cms = NULL; | ||
311 | if (pval) | ||
312 | cms = (CMS_ContentInfo *)*pval; | ||
313 | else | ||
314 | return 1; | ||
315 | switch(operation) | ||
316 | { | ||
317 | |||
318 | case ASN1_OP_STREAM_PRE: | ||
319 | if (CMS_stream(&sarg->boundary, cms) <= 0) | ||
320 | return 0; | ||
321 | case ASN1_OP_DETACHED_PRE: | ||
322 | sarg->ndef_bio = CMS_dataInit(cms, sarg->out); | ||
323 | if (!sarg->ndef_bio) | ||
324 | return 0; | ||
325 | break; | ||
326 | |||
327 | case ASN1_OP_STREAM_POST: | ||
328 | case ASN1_OP_DETACHED_POST: | ||
329 | if (CMS_dataFinal(cms, sarg->ndef_bio) <= 0) | ||
330 | return 0; | ||
331 | break; | ||
332 | |||
333 | } | ||
334 | return 1; | ||
335 | } | ||
336 | |||
337 | ASN1_NDEF_SEQUENCE_cb(CMS_ContentInfo, cms_cb) = { | ||
304 | ASN1_SIMPLE(CMS_ContentInfo, contentType, ASN1_OBJECT), | 338 | ASN1_SIMPLE(CMS_ContentInfo, contentType, ASN1_OBJECT), |
305 | ASN1_ADB_OBJECT(CMS_ContentInfo) | 339 | ASN1_ADB_OBJECT(CMS_ContentInfo) |
306 | } ASN1_NDEF_SEQUENCE_END(CMS_ContentInfo) | 340 | } ASN1_NDEF_SEQUENCE_END_cb(CMS_ContentInfo, CMS_ContentInfo) |
307 | 341 | ||
308 | /* Specials for signed attributes */ | 342 | /* Specials for signed attributes */ |
309 | 343 | ||