summaryrefslogtreecommitdiffhomepage
path: root/random.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2007-04-16 13:39:50 +0000
committerMatt Johnston <matt@ucc.asn.au>2007-04-16 13:39:50 +0000
commit77c33e775081dfe6de1699987aaf497b7203c9b7 (patch)
tree59ef925dd1782b5909a711f3089ce3cf0963580f /random.c
parenta4130263bd36edad8c4bd8b9daf729148f1c0d8f (diff)
Add -u option to specify /dev/urandom instead
--HG-- extra : convert_revision : 6925cd3fd7727fbc69db9883675aa90f594f58a0
Diffstat (limited to 'random.c')
-rw-r--r--random.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/random.c b/random.c
index f1475ed..cd0ac31 100644
--- a/random.c
+++ b/random.c
@@ -27,6 +27,13 @@
#include "dbutil.h"
#include "bignum.h"
+#ifdef DROPBEAR_RANDOM_DEV
+const char* random_dev = DROPBEAR_RANDOM_DEV;
+#else
+const char* random_dev = NULL;
+#endif
+
+
static int donerandinit = 0;
/* this is used to generate unique output from the same hashpool */
@@ -62,9 +69,9 @@ static void readrand(unsigned char* buf, unsigned int buflen) {
#endif
#ifdef DROPBEAR_RANDOM_DEV
- readfd = open(DROPBEAR_RANDOM_DEV, O_RDONLY);
+ readfd = open(random_dev, O_RDONLY);
if (readfd < 0) {
- dropbear_exit("couldn't open random device");
+ dropbear_exit("couldn't open %s", random_dev);
}
#endif