Skip to content

Commit

Permalink
PR: 2742
Browse files Browse the repository at this point in the history
Reported by: Dmitry Belyavsky <beldmit@gmail.com>

If resigning with detached content in CMS just copy data across.
  • Loading branch information
snhenson committed Feb 29, 2012
1 parent 33a688e commit a859587
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crypto/asn1/asn_mime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 */

Expand All @@ -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;

}

Expand Down

0 comments on commit a859587

Please sign in to comment.