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

Side by Side Diff: openssl/apps/rand.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/progs.pl ('k') | openssl/apps/req.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/rand.c */ 1 /* apps/rand.c */
2 /* ==================================================================== 2 /* ====================================================================
3 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 * -rand file:file - PRNG seed files 70 * -rand file:file - PRNG seed files
71 * -base64 - base64 encode output 71 * -base64 - base64 encode output
72 * -hex - hex encode output 72 * -hex - hex encode output
73 * num - write 'num' bytes 73 * num - write 'num' bytes
74 */ 74 */
75 75
76 int MAIN(int, char **); 76 int MAIN(int, char **);
77 77
78 int MAIN(int argc, char **argv) 78 int MAIN(int argc, char **argv)
79 { 79 {
80 #ifndef OPENSSL_NO_ENGINE
81 ENGINE *e = NULL;
82 #endif
83 int i, r, ret = 1; 80 int i, r, ret = 1;
84 int badopt; 81 int badopt;
85 char *outfile = NULL; 82 char *outfile = NULL;
86 char *inrand = NULL; 83 char *inrand = NULL;
87 int base64 = 0; 84 int base64 = 0;
88 int hex = 0; 85 int hex = 0;
89 BIO *out = NULL; 86 BIO *out = NULL;
90 int num = -1; 87 int num = -1;
91 #ifndef OPENSSL_NO_ENGINE 88 #ifndef OPENSSL_NO_ENGINE
92 char *engine=NULL; 89 char *engine=NULL;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 #ifndef OPENSSL_NO_ENGINE 168 #ifndef OPENSSL_NO_ENGINE
172 BIO_printf(bio_err, "-engine e - use engine e, possi bly a hardware device.\n"); 169 BIO_printf(bio_err, "-engine e - use engine e, possi bly a hardware device.\n");
173 #endif 170 #endif
174 BIO_printf(bio_err, "-rand file%cfile%c... - seed PRNG from file s\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); 171 BIO_printf(bio_err, "-rand file%cfile%c... - seed PRNG from file s\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
175 BIO_printf(bio_err, "-base64 - base64 encode outpu t\n"); 172 BIO_printf(bio_err, "-base64 - base64 encode outpu t\n");
176 BIO_printf(bio_err, "-hex - hex encode output\n "); 173 BIO_printf(bio_err, "-hex - hex encode output\n ");
177 goto err; 174 goto err;
178 } 175 }
179 176
180 #ifndef OPENSSL_NO_ENGINE 177 #ifndef OPENSSL_NO_ENGINE
181 e = setup_engine(bio_err, engine, 0); 178 setup_engine(bio_err, engine, 0);
182 #endif 179 #endif
183 180
184 app_RAND_load_file(NULL, bio_err, (inrand != NULL)); 181 app_RAND_load_file(NULL, bio_err, (inrand != NULL));
185 if (inrand != NULL) 182 if (inrand != NULL)
186 BIO_printf(bio_err,"%ld semi-random bytes loaded\n", 183 BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
187 app_RAND_load_files(inrand)); 184 app_RAND_load_files(inrand));
188 185
189 out = BIO_new(BIO_s_file()); 186 out = BIO_new(BIO_s_file());
190 if (out == NULL) 187 if (out == NULL)
191 goto err; 188 goto err;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 app_RAND_write_file(NULL, bio_err); 236 app_RAND_write_file(NULL, bio_err);
240 ret = 0; 237 ret = 0;
241 238
242 err: 239 err:
243 ERR_print_errors(bio_err); 240 ERR_print_errors(bio_err);
244 if (out) 241 if (out)
245 BIO_free_all(out); 242 BIO_free_all(out);
246 apps_shutdown(); 243 apps_shutdown();
247 OPENSSL_EXIT(ret); 244 OPENSSL_EXIT(ret);
248 } 245 }
OLDNEW
« no previous file with comments | « openssl/apps/progs.pl ('k') | openssl/apps/req.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698