diff options
Diffstat (limited to 'src/lib/libcrypto/cms/cms_smime.c')
-rw-r--r-- | src/lib/libcrypto/cms/cms_smime.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/lib/libcrypto/cms/cms_smime.c b/src/lib/libcrypto/cms/cms_smime.c index 4a799eb897..f35883aa22 100644 --- a/src/lib/libcrypto/cms/cms_smime.c +++ b/src/lib/libcrypto/cms/cms_smime.c | |||
@@ -171,7 +171,7 @@ CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags) | |||
171 | if (!cms) | 171 | if (!cms) |
172 | return NULL; | 172 | return NULL; |
173 | 173 | ||
174 | if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) | 174 | if (CMS_final(cms, in, NULL, flags)) |
175 | return cms; | 175 | return cms; |
176 | 176 | ||
177 | CMS_ContentInfo_free(cms); | 177 | CMS_ContentInfo_free(cms); |
@@ -214,7 +214,10 @@ CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, | |||
214 | return NULL; | 214 | return NULL; |
215 | 215 | ||
216 | if(!(flags & CMS_DETACHED)) | 216 | if(!(flags & CMS_DETACHED)) |
217 | { | ||
218 | flags &= ~CMS_STREAM; | ||
217 | CMS_set_detached(cms, 0); | 219 | CMS_set_detached(cms, 0); |
220 | } | ||
218 | 221 | ||
219 | if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) | 222 | if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) |
220 | return cms; | 223 | return cms; |
@@ -266,7 +269,10 @@ CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, | |||
266 | return NULL; | 269 | return NULL; |
267 | 270 | ||
268 | if(!(flags & CMS_DETACHED)) | 271 | if(!(flags & CMS_DETACHED)) |
272 | { | ||
273 | flags &= ~CMS_STREAM; | ||
269 | CMS_set_detached(cms, 0); | 274 | CMS_set_detached(cms, 0); |
275 | } | ||
270 | 276 | ||
271 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) | 277 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) |
272 | || CMS_final(cms, in, NULL, flags)) | 278 | || CMS_final(cms, in, NULL, flags)) |
@@ -450,7 +456,6 @@ int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, | |||
450 | X509_STORE *store, unsigned int flags) | 456 | X509_STORE *store, unsigned int flags) |
451 | { | 457 | { |
452 | int r; | 458 | int r; |
453 | flags &= ~(CMS_DETACHED|CMS_TEXT); | ||
454 | r = CMS_verify(rcms, certs, store, NULL, NULL, flags); | 459 | r = CMS_verify(rcms, certs, store, NULL, NULL, flags); |
455 | if (r <= 0) | 460 | if (r <= 0) |
456 | return r; | 461 | return r; |
@@ -481,7 +486,10 @@ CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, | |||
481 | } | 486 | } |
482 | 487 | ||
483 | if(!(flags & CMS_DETACHED)) | 488 | if(!(flags & CMS_DETACHED)) |
489 | { | ||
490 | flags &= ~CMS_STREAM; | ||
484 | CMS_set_detached(cms, 0); | 491 | CMS_set_detached(cms, 0); |
492 | } | ||
485 | 493 | ||
486 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) | 494 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) |
487 | || CMS_final(cms, data, NULL, flags)) | 495 | || CMS_final(cms, data, NULL, flags)) |
@@ -509,7 +517,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, | |||
509 | BIO *rct_cont = NULL; | 517 | BIO *rct_cont = NULL; |
510 | int r = 0; | 518 | int r = 0; |
511 | 519 | ||
512 | flags &= ~(CMS_STREAM|CMS_TEXT); | 520 | flags &= ~CMS_STREAM; |
513 | /* Not really detached but avoids content being allocated */ | 521 | /* Not really detached but avoids content being allocated */ |
514 | flags |= CMS_PARTIAL|CMS_BINARY|CMS_DETACHED; | 522 | flags |= CMS_PARTIAL|CMS_BINARY|CMS_DETACHED; |
515 | if (!pkey || !signcert) | 523 | if (!pkey || !signcert) |
@@ -590,7 +598,10 @@ CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *data, | |||
590 | } | 598 | } |
591 | 599 | ||
592 | if(!(flags & CMS_DETACHED)) | 600 | if(!(flags & CMS_DETACHED)) |
601 | { | ||
602 | flags &= ~CMS_STREAM; | ||
593 | CMS_set_detached(cms, 0); | 603 | CMS_set_detached(cms, 0); |
604 | } | ||
594 | 605 | ||
595 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) | 606 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) |
596 | || CMS_final(cms, data, NULL, flags)) | 607 | || CMS_final(cms, data, NULL, flags)) |
@@ -770,9 +781,12 @@ CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags) | |||
770 | return NULL; | 781 | return NULL; |
771 | 782 | ||
772 | if(!(flags & CMS_DETACHED)) | 783 | if(!(flags & CMS_DETACHED)) |
784 | { | ||
785 | flags &= ~CMS_STREAM; | ||
773 | CMS_set_detached(cms, 0); | 786 | CMS_set_detached(cms, 0); |
787 | } | ||
774 | 788 | ||
775 | if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) | 789 | if (CMS_final(cms, in, NULL, flags)) |
776 | return cms; | 790 | return cms; |
777 | 791 | ||
778 | CMS_ContentInfo_free(cms); | 792 | CMS_ContentInfo_free(cms); |