summaryrefslogtreecommitdiffhomepage
path: root/svr-main.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2012-06-29 23:19:43 +0800
committerMatt Johnston <matt@ucc.asn.au>2012-06-29 23:19:43 +0800
commitd5ccc32b4d8903562107a534fbe09433c27d2880 (patch)
tree467f88f9f0d6d85c2be90d2a590504ec10742bba /svr-main.c
parentdb34044c7fdfcdf85a2606b686d60910e1ff36b6 (diff)
Improve RNG seeding.
Try to read from /dev/urandom multiple times, take input from extra sources, and use /dev/random when generating private keys
Diffstat (limited to 'svr-main.c')
-rw-r--r--svr-main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/svr-main.c b/svr-main.c
index b7258e5..43d6656 100644
--- a/svr-main.c
+++ b/svr-main.c
@@ -254,6 +254,8 @@ void main_noinetd() {
goto out;
}
+ seedrandom();
+
if (pipe(childpipe) < 0) {
TRACE(("error creating child pipe"))
goto out;
@@ -267,8 +269,11 @@ void main_noinetd() {
if (fork_ret < 0) {
dropbear_log(LOG_WARNING, "Error forking: %s", strerror(errno));
goto out;
+ }
- } else if (fork_ret > 0) {
+ addrandom(&fork_ret, sizeof(fork_ret));
+
+ if (fork_ret > 0) {
/* parent */
childpipes[conn_idx] = childpipe[0];