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

Side by Side Diff: openssl/apps/pkcs7.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/apps/pkcs12.c ('k') | openssl/apps/pkcs8.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 /* apps/pkcs7.c */ 1 /* apps/pkcs7.c */
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 * -outform arg - output format - default PEM 75 * -outform arg - output format - default PEM
76 * -in arg - input file - default stdin 76 * -in arg - input file - default stdin
77 * -out arg - output file - default stdout 77 * -out arg - output file - default stdout
78 * -print_certs 78 * -print_certs
79 */ 79 */
80 80
81 int MAIN(int, char **); 81 int MAIN(int, char **);
82 82
83 int MAIN(int argc, char **argv) 83 int MAIN(int argc, char **argv)
84 { 84 {
85 #ifndef OPENSSL_NO_ENGINE
86 ENGINE *e = NULL;
87 #endif
88 PKCS7 *p7=NULL; 85 PKCS7 *p7=NULL;
89 int i,badops=0; 86 int i,badops=0;
90 BIO *in=NULL,*out=NULL; 87 BIO *in=NULL,*out=NULL;
91 int informat,outformat; 88 int informat,outformat;
92 char *infile,*outfile,*prog; 89 char *infile,*outfile,*prog;
93 » int print_certs=0,text=0,noout=0; 90 » int print_certs=0,text=0,noout=0,p7_print=0;
94 int ret=1; 91 int ret=1;
95 #ifndef OPENSSL_NO_ENGINE 92 #ifndef OPENSSL_NO_ENGINE
96 char *engine=NULL; 93 char *engine=NULL;
97 #endif 94 #endif
98 95
99 apps_startup(); 96 apps_startup();
100 97
101 if (bio_err == NULL) 98 if (bio_err == NULL)
102 if ((bio_err=BIO_new(BIO_s_file())) != NULL) 99 if ((bio_err=BIO_new(BIO_s_file())) != NULL)
103 BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); 100 BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
(...skipping 28 matching lines...) Expand all
132 } 129 }
133 else if (strcmp(*argv,"-out") == 0) 130 else if (strcmp(*argv,"-out") == 0)
134 { 131 {
135 if (--argc < 1) goto bad; 132 if (--argc < 1) goto bad;
136 outfile= *(++argv); 133 outfile= *(++argv);
137 } 134 }
138 else if (strcmp(*argv,"-noout") == 0) 135 else if (strcmp(*argv,"-noout") == 0)
139 noout=1; 136 noout=1;
140 else if (strcmp(*argv,"-text") == 0) 137 else if (strcmp(*argv,"-text") == 0)
141 text=1; 138 text=1;
139 else if (strcmp(*argv,"-print") == 0)
140 p7_print=1;
142 else if (strcmp(*argv,"-print_certs") == 0) 141 else if (strcmp(*argv,"-print_certs") == 0)
143 print_certs=1; 142 print_certs=1;
144 #ifndef OPENSSL_NO_ENGINE 143 #ifndef OPENSSL_NO_ENGINE
145 else if (strcmp(*argv,"-engine") == 0) 144 else if (strcmp(*argv,"-engine") == 0)
146 { 145 {
147 if (--argc < 1) goto bad; 146 if (--argc < 1) goto bad;
148 engine= *(++argv); 147 engine= *(++argv);
149 } 148 }
150 #endif 149 #endif
151 else 150 else
(...skipping 21 matching lines...) Expand all
173 #ifndef OPENSSL_NO_ENGINE 172 #ifndef OPENSSL_NO_ENGINE
174 BIO_printf(bio_err," -engine e use engine e, possibly a hard ware device.\n"); 173 BIO_printf(bio_err," -engine e use engine e, possibly a hard ware device.\n");
175 #endif 174 #endif
176 ret = 1; 175 ret = 1;
177 goto end; 176 goto end;
178 } 177 }
179 178
180 ERR_load_crypto_strings(); 179 ERR_load_crypto_strings();
181 180
182 #ifndef OPENSSL_NO_ENGINE 181 #ifndef OPENSSL_NO_ENGINE
183 e = setup_engine(bio_err, engine, 0); 182 setup_engine(bio_err, engine, 0);
184 #endif 183 #endif
185 184
186 in=BIO_new(BIO_s_file()); 185 in=BIO_new(BIO_s_file());
187 out=BIO_new(BIO_s_file()); 186 out=BIO_new(BIO_s_file());
188 if ((in == NULL) || (out == NULL)) 187 if ((in == NULL) || (out == NULL))
189 { 188 {
190 ERR_print_errors(bio_err); 189 ERR_print_errors(bio_err);
191 goto end; 190 goto end;
192 } 191 }
193 192
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 230 }
232 else 231 else
233 { 232 {
234 if (BIO_write_filename(out,outfile) <= 0) 233 if (BIO_write_filename(out,outfile) <= 0)
235 { 234 {
236 perror(outfile); 235 perror(outfile);
237 goto end; 236 goto end;
238 } 237 }
239 } 238 }
240 239
240 if (p7_print)
241 PKCS7_print_ctx(out, p7, 0, NULL);
242
241 if (print_certs) 243 if (print_certs)
242 { 244 {
243 STACK_OF(X509) *certs=NULL; 245 STACK_OF(X509) *certs=NULL;
244 STACK_OF(X509_CRL) *crls=NULL; 246 STACK_OF(X509_CRL) *crls=NULL;
245 247
246 i=OBJ_obj2nid(p7->type); 248 i=OBJ_obj2nid(p7->type);
247 switch (i) 249 switch (i)
248 { 250 {
249 case NID_pkcs7_signed: 251 case NID_pkcs7_signed:
250 certs=p7->d.sign->cert; 252 certs=p7->d.sign->cert;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 311 }
310 } 312 }
311 ret=0; 313 ret=0;
312 end: 314 end:
313 if (p7 != NULL) PKCS7_free(p7); 315 if (p7 != NULL) PKCS7_free(p7);
314 if (in != NULL) BIO_free(in); 316 if (in != NULL) BIO_free(in);
315 if (out != NULL) BIO_free_all(out); 317 if (out != NULL) BIO_free_all(out);
316 apps_shutdown(); 318 apps_shutdown();
317 OPENSSL_EXIT(ret); 319 OPENSSL_EXIT(ret);
318 } 320 }
OLDNEW
« no previous file with comments | « openssl/apps/pkcs12.c ('k') | openssl/apps/pkcs8.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698