diff random.c @ 442:d82a2a44c684

Add -u option to specify /dev/urandom instead
author Matt Johnston <matt@ucc.asn.au>
date Mon, 16 Apr 2007 13:39:50 +0000
parents c216212001fc
children 2cd2edfa11ee
line wrap: on
line diff
--- a/random.c	Sat Mar 17 06:30:11 2007 +0000
+++ b/random.c	Mon Apr 16 13:39:50 2007 +0000
@@ -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 @@
 #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