diff options
author | steve <steve> | 2012-02-29 14:02:02 +0000 |
---|---|---|
committer | steve <steve> | 2012-02-29 14:02:02 +0000 |
commit | 0facc1c6c335aa01d982883d10fa837ceb944107 (patch) | |
tree | ab7ea4347349210b95f91dc04f3925fb8f02458d /crypto/asn1/asn_mime.c | |
parent | 872a0b0abca89d30666009c56b69f6b0d57b1581 (diff) | |
download | openssl-0facc1c6c335aa01d982883d10fa837ceb944107.tar.gz |
PR: 2742
Reported by: Dmitry Belyavsky <beldmit@gmail.com>
If resigning with detached content in CMS just copy data across.
Diffstat (limited to 'crypto/asn1/asn_mime.c')
-rw-r--r-- | crypto/asn1/asn_mime.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c index 42536f77e..6d8a9bf90 100644 --- a/crypto/asn1/asn_mime.c +++ b/crypto/asn1/asn_mime.c @@ -377,8 +377,12 @@ static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags, BIO *tmpbio; const ASN1_AUX *aux = it->funcs; ASN1_STREAM_ARG sarg; + int rv = 1; - if (!(flags & SMIME_DETACHED)) + /* If data is not deteched or resigning then the output BIO is + * already set up to finalise when it is written through. + */ + if (!(flags & SMIME_DETACHED) || (flags & PKCS7_REUSE_DIGEST)) { SMIME_crlf_copy(data, out, flags); return 1; @@ -405,7 +409,7 @@ static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags, /* Finalize structure */ if (aux->asn1_cb(ASN1_OP_DETACHED_POST, &val, it, &sarg) <= 0) - return 0; + rv = 0; /* Now remove any digests prepended to the BIO */ @@ -416,7 +420,7 @@ static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags, sarg.ndef_bio = tmpbio; } - return 1; + return rv; } |