diff options
author | Matt Johnston <matt@ucc.asn.au> | 2012-06-29 23:19:43 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2012-06-29 23:19:43 +0800 |
commit | d5ccc32b4d8903562107a534fbe09433c27d2880 (patch) | |
tree | 467f88f9f0d6d85c2be90d2a590504ec10742bba /svr-main.c | |
parent | db34044c7fdfcdf85a2606b686d60910e1ff36b6 (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.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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]; |