Deleted Added
full compact
rand.c (1.1.1.3) rand.c (1.1.1.4)
1/* apps/rand.c */
2/* ====================================================================
3 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 72 unchanged lines hidden (view full) ---

81 int i, r, ret = 1;
82 int badopt;
83 char *outfile = NULL;
84 char *inrand = NULL;
85 int base64 = 0;
86 int hex = 0;
87 BIO *out = NULL;
88 int num = -1;
1/* apps/rand.c */
2/* ====================================================================
3 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 72 unchanged lines hidden (view full) ---

81 int i, r, ret = 1;
82 int badopt;
83 char *outfile = NULL;
84 char *inrand = NULL;
85 int base64 = 0;
86 int hex = 0;
87 BIO *out = NULL;
88 int num = -1;
89#ifndef OPENSSL_NO_ENGINE
89 ENGINE *e = NULL;
90 char *engine = NULL;
90 char *engine = NULL;
91#endif
92
93 apps_startup();
94
95 if (bio_err == NULL)
96 if ((bio_err = BIO_new(BIO_s_file())) != NULL)
97 BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
98
99 if (!load_config(bio_err, NULL))

--- 57 unchanged lines hidden (view full) ---

157 "-engine e - use engine e, possibly a hardware device.\n");
158#endif
159 BIO_printf(bio_err, "-rand file%cfile%c... - seed PRNG from files\n",
160 LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
161 BIO_printf(bio_err, "-base64 - base64 encode output\n");
162 BIO_printf(bio_err, "-hex - hex encode output\n");
163 goto err;
164 }
91
92 apps_startup();
93
94 if (bio_err == NULL)
95 if ((bio_err = BIO_new(BIO_s_file())) != NULL)
96 BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
97
98 if (!load_config(bio_err, NULL))

--- 57 unchanged lines hidden (view full) ---

156 "-engine e - use engine e, possibly a hardware device.\n");
157#endif
158 BIO_printf(bio_err, "-rand file%cfile%c... - seed PRNG from files\n",
159 LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
160 BIO_printf(bio_err, "-base64 - base64 encode output\n");
161 BIO_printf(bio_err, "-hex - hex encode output\n");
162 goto err;
163 }
165#ifndef OPENSSL_NO_ENGINE
166 setup_engine(bio_err, engine, 0);
167#endif
164 e = setup_engine(bio_err, engine, 0);
168
169 app_RAND_load_file(NULL, bio_err, (inrand != NULL));
170 if (inrand != NULL)
171 BIO_printf(bio_err, "%ld semi-random bytes loaded\n",
172 app_RAND_load_files(inrand));
173
174 out = BIO_new(BIO_s_file());
175 if (out == NULL)

--- 41 unchanged lines hidden (view full) ---

217 BIO_puts(out, "\n");
218 (void)BIO_flush(out);
219
220 app_RAND_write_file(NULL, bio_err);
221 ret = 0;
222
223 err:
224 ERR_print_errors(bio_err);
165
166 app_RAND_load_file(NULL, bio_err, (inrand != NULL));
167 if (inrand != NULL)
168 BIO_printf(bio_err, "%ld semi-random bytes loaded\n",
169 app_RAND_load_files(inrand));
170
171 out = BIO_new(BIO_s_file());
172 if (out == NULL)

--- 41 unchanged lines hidden (view full) ---

214 BIO_puts(out, "\n");
215 (void)BIO_flush(out);
216
217 app_RAND_write_file(NULL, bio_err);
218 ret = 0;
219
220 err:
221 ERR_print_errors(bio_err);
222 release_engine(e);
225 if (out)
226 BIO_free_all(out);
227 apps_shutdown();
228 OPENSSL_EXIT(ret);
229}
223 if (out)
224 BIO_free_all(out);
225 apps_shutdown();
226 OPENSSL_EXIT(ret);
227}