59
59
#include <openssl/x509.h>
60
60
#include <openssl/asn1.h>
62
/* PKCS#7 wrappers round generalised MIME routines */
62
/* PKCS#7 wrappers round generalised stream and MIME routines */
64
PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont)
64
int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags)
66
return (PKCS7 *)SMIME_read_ASN1(bio, bcont, ASN1_ITEM_rptr(PKCS7));
66
return i2d_ASN1_bio_stream(out, (ASN1_VALUE *)p7, in, flags,
67
ASN1_ITEM_rptr(PKCS7));
69
/* Callback for int_smime_write_ASN1 */
71
static int pk7_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
70
int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags)
74
PKCS7 *p7 = (PKCS7 *)val;
78
if (!(flags & SMIME_DETACHED))
80
SMIME_crlf_copy(data, out, flags);
84
/* Let PKCS7 code prepend any needed BIOs */
86
p7bio = PKCS7_dataInit(p7, out);
91
/* Copy data across, passing through filter BIOs for processing */
92
SMIME_crlf_copy(data, p7bio, flags);
94
/* Finalize structure */
95
if (PKCS7_dataFinal(p7, p7bio) <= 0)
102
/* Now remove any digests prepended to the BIO */
106
tmpbio = BIO_pop(p7bio);
72
return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *) p7, in, flags,
74
ASN1_ITEM_rptr(PKCS7));
115
77
int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
124
return int_smime_write_ASN1(bio, (ASN1_VALUE *)p7, data, flags,
86
flags ^= SMIME_OLDMIME;
89
return SMIME_write_ASN1(bio, (ASN1_VALUE *)p7, data, flags,
125
90
ctype_nid, NID_undef, mdalgs,
127
91
ASN1_ITEM_rptr(PKCS7));
94
PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont)
96
return (PKCS7 *)SMIME_read_ASN1(bio, bcont, ASN1_ITEM_rptr(PKCS7));