diff common-runopts.c @ 687:167fdc091c05

Improve RNG seeding. Try to read from /dev/urandom multiple times, take input from extra sources, and use /dev/random when generating private keys
author Matt Johnston <matt@ucc.asn.au>
date Fri, 29 Jun 2012 23:19:43 +0800
parents 4edea9f363d0
children e22d5f5f6e37
line wrap: on
line diff
--- a/common-runopts.c	Thu May 17 00:26:12 2012 +0800
+++ b/common-runopts.c	Fri Jun 29 23:19:43 2012 +0800
@@ -29,6 +29,7 @@
 #include "dbutil.h"
 #include "auth.h"
 #include "algo.h"
+#include "random.h"
 
 runopts opts; /* GLOBAL */
 
@@ -45,6 +46,9 @@
 		goto out;
 	}
 	buf_setpos(buf, 0);
+
+	addrandom(buf_getptr(buf, buf->len), buf->len);
+
 	if (buf_get_priv_key(buf, hostkey, type) == DROPBEAR_FAILURE) {
 		goto out;
 	}