summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pkcs7/pk7_mime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/pkcs7/pk7_mime.c')
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_mime.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/lib/libcrypto/pkcs7/pk7_mime.c b/src/lib/libcrypto/pkcs7/pk7_mime.c
index 927b88c3e7..5d2a97839d 100644
--- a/src/lib/libcrypto/pkcs7/pk7_mime.c
+++ b/src/lib/libcrypto/pkcs7/pk7_mime.c
@@ -3,7 +3,7 @@
3 * project 1999. 3 * project 1999.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
@@ -152,12 +152,11 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
152{ 152{
153 char bound[33], c; 153 char bound[33], c;
154 int i; 154 int i;
155 char *mime_prefix, *mime_eol, *msg_type=NULL; 155 char *mime_prefix, *mime_eol;
156 if (flags & PKCS7_NOOLDMIMETYPE) 156 if (flags & PKCS7_NOOLDMIMETYPE)
157 mime_prefix = "application/pkcs7-"; 157 mime_prefix = "application/pkcs7-";
158 else 158 else
159 mime_prefix = "application/x-pkcs7-"; 159 mime_prefix = "application/x-pkcs7-";
160
161 if (flags & PKCS7_CRLFEOL) 160 if (flags & PKCS7_CRLFEOL)
162 mime_eol = "\r\n"; 161 mime_eol = "\r\n";
163 else 162 else
@@ -199,30 +198,11 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
199 mime_eol, mime_eol); 198 mime_eol, mime_eol);
200 return 1; 199 return 1;
201 } 200 }
202
203 /* Determine smime-type header */
204
205 if (PKCS7_type_is_enveloped(p7))
206 msg_type = "enveloped-data";
207 else if (PKCS7_type_is_signed(p7))
208 {
209 /* If we have any signers it is signed-data othewise
210 * certs-only.
211 */
212 STACK_OF(PKCS7_SIGNER_INFO) *sinfos;
213 sinfos = PKCS7_get_signer_info(p7);
214 if (sk_PKCS7_SIGNER_INFO_num(sinfos) > 0)
215 msg_type = "signed-data";
216 else
217 msg_type = "certs-only";
218 }
219 /* MIME headers */ 201 /* MIME headers */
220 BIO_printf(bio, "MIME-Version: 1.0%s", mime_eol); 202 BIO_printf(bio, "MIME-Version: 1.0%s", mime_eol);
221 BIO_printf(bio, "Content-Disposition: attachment;"); 203 BIO_printf(bio, "Content-Disposition: attachment;");
222 BIO_printf(bio, " filename=\"smime.p7m\"%s", mime_eol); 204 BIO_printf(bio, " filename=\"smime.p7m\"%s", mime_eol);
223 BIO_printf(bio, "Content-Type: %smime;", mime_prefix); 205 BIO_printf(bio, "Content-Type: %smime;", mime_prefix);
224 if (msg_type)
225 BIO_printf(bio, " smime-type=%s;", msg_type);
226 BIO_printf(bio, " name=\"smime.p7m\"%s", mime_eol); 206 BIO_printf(bio, " name=\"smime.p7m\"%s", mime_eol);
227 BIO_printf(bio, "Content-Transfer-Encoding: base64%s%s", 207 BIO_printf(bio, "Content-Transfer-Encoding: base64%s%s",
228 mime_eol, mime_eol); 208 mime_eol, mime_eol);