summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/apps/rand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/apps/rand.c')
-rw-r--r--src/lib/libssl/src/apps/rand.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/libssl/src/apps/rand.c b/src/lib/libssl/src/apps/rand.c
index f51f5bec35..63724bc730 100644
--- a/src/lib/libssl/src/apps/rand.c
+++ b/src/lib/libssl/src/apps/rand.c
@@ -76,7 +76,9 @@ int MAIN(int, char **);
76 76
77int MAIN(int argc, char **argv) 77int MAIN(int argc, char **argv)
78 { 78 {
79#ifndef OPENSSL_NO_ENGINE
79 ENGINE *e = NULL; 80 ENGINE *e = NULL;
81#endif
80 int i, r, ret = 1; 82 int i, r, ret = 1;
81 int badopt; 83 int badopt;
82 char *outfile = NULL; 84 char *outfile = NULL;
@@ -84,7 +86,9 @@ int MAIN(int argc, char **argv)
84 int base64 = 0; 86 int base64 = 0;
85 BIO *out = NULL; 87 BIO *out = NULL;
86 int num = -1; 88 int num = -1;
89#ifndef OPENSSL_NO_ENGINE
87 char *engine=NULL; 90 char *engine=NULL;
91#endif
88 92
89 apps_startup(); 93 apps_startup();
90 94
@@ -106,6 +110,7 @@ int MAIN(int argc, char **argv)
106 else 110 else
107 badopt = 1; 111 badopt = 1;
108 } 112 }
113#ifndef OPENSSL_NO_ENGINE
109 else if (strcmp(argv[i], "-engine") == 0) 114 else if (strcmp(argv[i], "-engine") == 0)
110 { 115 {
111 if ((argv[i+1] != NULL) && (engine == NULL)) 116 if ((argv[i+1] != NULL) && (engine == NULL))
@@ -113,6 +118,7 @@ int MAIN(int argc, char **argv)
113 else 118 else
114 badopt = 1; 119 badopt = 1;
115 } 120 }
121#endif
116 else if (strcmp(argv[i], "-rand") == 0) 122 else if (strcmp(argv[i], "-rand") == 0)
117 { 123 {
118 if ((argv[i+1] != NULL) && (inrand == NULL)) 124 if ((argv[i+1] != NULL) && (inrand == NULL))
@@ -150,13 +156,17 @@ int MAIN(int argc, char **argv)
150 BIO_printf(bio_err, "Usage: rand [options] num\n"); 156 BIO_printf(bio_err, "Usage: rand [options] num\n");
151 BIO_printf(bio_err, "where options are\n"); 157 BIO_printf(bio_err, "where options are\n");
152 BIO_printf(bio_err, "-out file - write to file\n"); 158 BIO_printf(bio_err, "-out file - write to file\n");
159#ifndef OPENSSL_NO_ENGINE
153 BIO_printf(bio_err, "-engine e - use engine e, possibly a hardware device.\n"); 160 BIO_printf(bio_err, "-engine e - use engine e, possibly a hardware device.\n");
161#endif
154 BIO_printf(bio_err, "-rand file%cfile%c... - seed PRNG from files\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); 162 BIO_printf(bio_err, "-rand file%cfile%c... - seed PRNG from files\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
155 BIO_printf(bio_err, "-base64 - encode output\n"); 163 BIO_printf(bio_err, "-base64 - encode output\n");
156 goto err; 164 goto err;
157 } 165 }
158 166
167#ifndef OPENSSL_NO_ENGINE
159 e = setup_engine(bio_err, engine, 0); 168 e = setup_engine(bio_err, engine, 0);
169#endif
160 170
161 app_RAND_load_file(NULL, bio_err, (inrand != NULL)); 171 app_RAND_load_file(NULL, bio_err, (inrand != NULL));
162 if (inrand != NULL) 172 if (inrand != NULL)
@@ -213,5 +223,5 @@ err:
213 if (out) 223 if (out)
214 BIO_free_all(out); 224 BIO_free_all(out);
215 apps_shutdown(); 225 apps_shutdown();
216 EXIT(ret); 226 OPENSSL_EXIT(ret);
217 } 227 }