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