summaryrefslogtreecommitdiffstats
path: root/apps/rand.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/rand.c')
-rw-r--r--apps/rand.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/rand.c b/apps/rand.c
index fa9bc023f4..b0c50920a5 100644
--- a/apps/rand.c
+++ b/apps/rand.c
@@ -15,6 +15,7 @@
/* -out file - write to file
* -rand file:file - PRNG seed files
+ * -egd file - PRNG seed from EGD named socket
* -base64 - encode output
* num - write 'num' bytes
*/
@@ -26,7 +27,7 @@ int MAIN(int argc, char **argv)
int i, r, ret = 1;
int badopt;
char *outfile = NULL;
- char *inrand = NULL;
+ char *inrand = NULL,*inegd=NULL;
int base64 = 0;
BIO *out = NULL;
int num = -1;
@@ -55,6 +56,13 @@ int MAIN(int argc, char **argv)
else
badopt = 1;
}
+ else if (strcmp(argv[i], "-egd") == 0)
+ {
+ if ((argv[i+1] != NULL) && (inegd == NULL))
+ inegd = argv[++i];
+ else
+ badopt = 1;
+ }
else if (strcmp(argv[i], "-base64") == 0)
{
if (!base64)
@@ -86,14 +94,18 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err, "-out file - write to file\n");
BIO_printf(bio_err, "-rand file%cfile%c... - seed PRNG from files\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
+ BIO_printf(bio_err, "-egd file - seed PRNG from EGD named socket\n");
BIO_printf(bio_err, "-base64 - encode output\n");
goto err;
}
- app_RAND_load_file(NULL, bio_err, (inrand != NULL));
+ app_RAND_load_file(NULL, bio_err, (inrand != NULL || inegd != NULL));
if (inrand != NULL)
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
app_RAND_load_files(inrand));
+ if (inegd != NULL)
+ BIO_printf(bio_err,"%ld egd bytes loaded\n",
+ RAND_egd(inegd));
out = BIO_new(BIO_s_file());
if (out == NULL)