Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: openssl/crypto/pkcs7/pk7_mime.c

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « openssl/crypto/pkcs7/pk7_lib.c ('k') | openssl/crypto/pkcs7/pk7_smime.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* pk7_mime.c */ 1 /* pk7_mime.c */
2 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
5 /* ==================================================================== 5 /* ====================================================================
6 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 1999-2005 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
10 * are met: 10 * are met:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 * 52 *
53 */ 53 */
54 54
55 #include <stdio.h> 55 #include <stdio.h>
56 #include <ctype.h> 56 #include <ctype.h>
57 #include "cryptlib.h" 57 #include "cryptlib.h"
58 #include <openssl/rand.h> 58 #include <openssl/rand.h>
59 #include <openssl/x509.h> 59 #include <openssl/x509.h>
60 #include <openssl/asn1.h> 60 #include <openssl/asn1.h>
61 61
62 /* PKCS#7 wrappers round generalised MIME routines */ 62 /* PKCS#7 wrappers round generalised stream and MIME routines */
63 63
64 PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont) 64 int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags)
65 { 65 {
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));
67 } 68 }
68 69
69 /* Callback for int_smime_write_ASN1 */ 70 int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags)
70
71 static int pk7_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
72 » » » » » const ASN1_ITEM *it)
73 { 71 {
74 » PKCS7 *p7 = (PKCS7 *)val; 72 » return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *) p7, in, flags,
75 » BIO *tmpbio, *p7bio; 73 » » » » » » "PKCS7",
76 » int r = 0; 74 » » » » » » ASN1_ITEM_rptr(PKCS7));
77
78 » if (!(flags & SMIME_DETACHED))
79 » » {
80 » » SMIME_crlf_copy(data, out, flags);
81 » » return 1;
82 » » }
83
84 » /* Let PKCS7 code prepend any needed BIOs */
85
86 » p7bio = PKCS7_dataInit(p7, out);
87
88 » if (!p7bio)
89 » » return 0;
90
91 » /* Copy data across, passing through filter BIOs for processing */
92 » SMIME_crlf_copy(data, p7bio, flags);
93
94 » /* Finalize structure */
95 » if (PKCS7_dataFinal(p7, p7bio) <= 0)
96 » » goto err;
97
98 » r = 1;
99
100 » err:
101
102 » /* Now remove any digests prepended to the BIO */
103
104 » while (p7bio != out)
105 » » {
106 » » tmpbio = BIO_pop(p7bio);
107 » » BIO_free(p7bio);
108 » » p7bio = tmpbio;
109 » » }
110
111 » return 1;
112
113 } 75 }
114 76
115 int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags) 77 int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
116 { 78 {
117 STACK_OF(X509_ALGOR) *mdalgs; 79 STACK_OF(X509_ALGOR) *mdalgs;
118 int ctype_nid = OBJ_obj2nid(p7->type); 80 int ctype_nid = OBJ_obj2nid(p7->type);
119 if (ctype_nid == NID_pkcs7_signed) 81 if (ctype_nid == NID_pkcs7_signed)
120 mdalgs = p7->d.sign->md_algs; 82 mdalgs = p7->d.sign->md_algs;
121 else 83 else
122 mdalgs = NULL; 84 mdalgs = NULL;
123 85
124 » return int_smime_write_ASN1(bio, (ASN1_VALUE *)p7, data, flags, 86 » flags ^= SMIME_OLDMIME;
87
88
89 » return SMIME_write_ASN1(bio, (ASN1_VALUE *)p7, data, flags,
125 ctype_nid, NID_undef, mdalgs, 90 ctype_nid, NID_undef, mdalgs,
126 pk7_output_data,
127 ASN1_ITEM_rptr(PKCS7)); 91 ASN1_ITEM_rptr(PKCS7));
128 } 92 }
93
94 PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont)
95 {
96 return (PKCS7 *)SMIME_read_ASN1(bio, bcont, ASN1_ITEM_rptr(PKCS7));
97 }
OLDNEW
« no previous file with comments | « openssl/crypto/pkcs7/pk7_lib.c ('k') | openssl/crypto/pkcs7/pk7_smime.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698