b58e57
diff --git a/entropy.c b/entropy.c
b58e57
index 2d483b3..b361a04 100644
b58e57
--- a/entropy.c
b58e57
+++ b/entropy.c
b58e57
@@ -234,6 +234,9 @@ seed_rng(void)
b58e57
 	memset(buf, '\0', sizeof(buf));
b58e57
 
b58e57
 #endif /* OPENSSL_PRNG_ONLY */
b58e57
+#ifdef __linux__
b58e57
+	linux_seed();
b58e57
+#endif /* __linux__ */
b58e57
 	if (RAND_status() != 1)
b58e57
 		fatal("PRNG is not seeded");
b58e57
 }
b58e57
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
b58e57
index b912dbe..9206337 100644
b58e57
--- a/openbsd-compat/Makefile.in
b58e57
+++ b/openbsd-compat/Makefile.in
b58e57
@@ -20,7 +20,7 @@ OPENBSD=base64.o basename.o bcrypt_pbkdf.o bindresvport.o blowfish.o daemon.o di
b58e57
 
b58e57
 COMPAT=arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-err.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xcrypt.o kludge-fd_set.o
b58e57
 
b58e57
-PORTS=port-aix.o port-irix.o port-linux.o port-linux-sshd.o port-solaris.o port-tun.o port-uw.o
b58e57
+PORTS=port-aix.o port-irix.o port-linux.o port-linux-sshd.o port-linux-prng.o port-solaris.o port-tun.o port-uw.o
b58e57
 
b58e57
 .c.o:
b58e57
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
b58e57
diff -up openssh-7.4p1/openbsd-compat/port-linux.h.entropy openssh-7.4p1/openbsd-compat/port-linux.h
b58e57
--- openssh-7.4p1/openbsd-compat/port-linux.h.entropy	2016-12-23 18:34:27.747753563 +0100
b58e57
+++ openssh-7.4p1/openbsd-compat/port-linux.h	2016-12-23 18:34:27.769753570 +0100
b58e57
@@ -34,4 +34,6 @@ void oom_adjust_restore(void);
b58e57
 void oom_adjust_setup(void);
b58e57
 #endif
b58e57
 
b58e57
+void linux_seed(void);
b58e57
+
b58e57
 #endif /* ! _PORT_LINUX_H */
b58e57
diff --git a/openbsd-compat/port-linux-prng.c b/openbsd-compat/port-linux-prng.c
b58e57
new file mode 100644
b58e57
index 0000000..92a617c
b58e57
--- /dev/null
b58e57
+++ b/openbsd-compat/port-linux-prng.c
b58e57
@@ -0,0 +1,59 @@
b58e57
+/* $Id: port-linux.c,v 1.11.4.2 2011/02/04 00:43:08 djm Exp $ */
b58e57
+
b58e57
+/*
b58e57
+ * Copyright (c) 2011 Jan F. Chadima <jchadima@redhat.com>
b58e57
+ *
b58e57
+ * Permission to use, copy, modify, and distribute this software for any
b58e57
+ * purpose with or without fee is hereby granted, provided that the above
b58e57
+ * copyright notice and this permission notice appear in all copies.
b58e57
+ *
b58e57
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
b58e57
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
b58e57
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
b58e57
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
b58e57
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
b58e57
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
b58e57
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
b58e57
+ */
b58e57
+
b58e57
+/*
b58e57
+ * Linux-specific portability code - prng support
b58e57
+ */
b58e57
+
b58e57
+#include "includes.h"
b58e57
+
b58e57
+#include <errno.h>
b58e57
+#include <stdarg.h>
b58e57
+#include <string.h>
b58e57
+#include <stdio.h>
b58e57
+#include <openssl/rand.h>
b58e57
+
b58e57
+#include "log.h"
b58e57
+#include "xmalloc.h"
b58e57
+#include "misc.h"      /* servconf.h needs misc.h for struct ForwardOptions */
b58e57
+#include "servconf.h"
b58e57
+#include "port-linux.h"
b58e57
+#include "key.h"
b58e57
+#include "hostfile.h"
b58e57
+#include "auth.h"
b58e57
+
b58e57
+void
b58e57
+linux_seed(void)
b58e57
+{
b58e57
+	char *env = getenv("SSH_USE_STRONG_RNG");
b58e57
+	char *random = "/dev/random";
b58e57
+	size_t len, ienv, randlen = 14;
b58e57
+
b58e57
+	if (!env || !strcmp(env, "0"))
b58e57
+		random = "/dev/urandom";
b58e57
+	else if ((ienv = atoi(env)) > randlen)
b58e57
+		randlen = ienv;
b58e57
+
b58e57
+	errno = 0;
b58e57
+	if ((len = RAND_load_file(random, randlen)) != randlen) {
b58e57
+		if (errno)
b58e57
+			fatal ("cannot read from %s, %s", random, strerror(errno));
b58e57
+		else
b58e57
+			fatal ("EOF reading %s", random);
b58e57
+	}
b58e57
+}
b58e57
diff --git a/ssh-add.0 b/ssh-add.0
b58e57
index ba43fee..0b2629a 100644
b58e57
--- a/ssh-add.0
b58e57
+++ b/ssh-add.0
b58e57
@@ -82,6 +82,16 @@ ENVIRONMENT
b58e57
              Identifies the path of a UNIX-domain socket used to communicate
b58e57
              with the agent.
b58e57
 
b58e57
+     SSH_USE_STRONG_RNG
b58e57
+             The reseeding of the OpenSSL random generator is usually done
b58e57
+             from /dev/urandom.  If the SSH_USE_STRONG_RNG environment vari-
b58e57
+             able is set to value other than 0 the OpenSSL random generator is
b58e57
+             reseeded from /dev/random.  The number of bytes read is defined
b58e57
+             by the SSH_USE_STRONG_RNG value.  Minimum is 14 bytes.  This set-
b58e57
+             ting is not recommended on the computers without the hardware
b58e57
+             random generator because insufficient entropy causes the connec-
b58e57
+             tion to be blocked until enough entropy is available.
b58e57
+
b58e57
 FILES
b58e57
      ~/.ssh/identity
b58e57
              Contains the protocol version 1 RSA authentication identity of
b58e57
diff --git a/ssh-add.1 b/ssh-add.1
b58e57
index 4812448..16305bf 100644
b58e57
--- a/ssh-add.1
b58e57
+++ b/ssh-add.1
b58e57
@@ -161,6 +161,20 @@ to make this work.)
b58e57
 Identifies the path of a
b58e57
 .Ux Ns -domain
b58e57
 socket used to communicate with the agent.
b58e57
+.It Ev SSH_USE_STRONG_RNG
b58e57
+The reseeding of the OpenSSL random generator is usually done from
b58e57
+.Cm /dev/urandom .
b58e57
+If the 
b58e57
+.Cm SSH_USE_STRONG_RNG
b58e57
+environment variable is set to value other than
b58e57
+.Cm 0
b58e57
+the OpenSSL random generator is reseeded from
b58e57
+.Cm /dev/random .
b58e57
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
b58e57
+Minimum is 14 bytes.
b58e57
+This setting is not recommended on the computers without the hardware
b58e57
+random generator because insufficient entropy causes the connection to 
b58e57
+be blocked until enough entropy is available.
b58e57
 .El
b58e57
 .Sh FILES
b58e57
 .Bl -tag -width Ds
b58e57
diff --git a/ssh-agent.1 b/ssh-agent.1
b58e57
index 281ecbd..1a9a635 100644
b58e57
--- a/ssh-agent.1
b58e57
+++ b/ssh-agent.1
b58e57
@@ -201,6 +201,24 @@ sockets used to contain the connection to the authentication agent.
b58e57
 These sockets should only be readable by the owner.
b58e57
 The sockets should get automatically removed when the agent exits.
b58e57
 .El
b58e57
+.Sh ENVIRONMENT
b58e57
+.Bl -tag -width Ds -compact
b58e57
+.Pp
b58e57
+.It Pa SSH_USE_STRONG_RNG
b58e57
+The reseeding of the OpenSSL random generator is usually done from
b58e57
+.Cm /dev/urandom .
b58e57
+If the 
b58e57
+.Cm SSH_USE_STRONG_RNG
b58e57
+environment variable is set to value other than
b58e57
+.Cm 0
b58e57
+the OpenSSL random generator is reseeded from
b58e57
+.Cm /dev/random .
b58e57
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
b58e57
+Minimum is 14 bytes.
b58e57
+This setting is not recommended on the computers without the hardware
b58e57
+random generator because insufficient entropy causes the connection to 
b58e57
+be blocked until enough entropy is available.
b58e57
+.El
b58e57
 .Sh SEE ALSO
b58e57
 .Xr ssh 1 ,
b58e57
 .Xr ssh-add 1 ,
b58e57
diff --git a/ssh-keygen.1 b/ssh-keygen.1
b58e57
index 12e00d4..1b51a4a 100644
b58e57
--- a/ssh-keygen.1
b58e57
+++ b/ssh-keygen.1
b58e57
@@ -832,6 +832,24 @@ Contains Diffie-Hellman groups used for DH-GEX.
b58e57
 The file format is described in
b58e57
 .Xr moduli 5 .
b58e57
 .El
b58e57
+.Sh ENVIRONMENT
b58e57
+.Bl -tag -width Ds -compact
b58e57
+.Pp
b58e57
+.It Pa SSH_USE_STRONG_RNG
b58e57
+The reseeding of the OpenSSL random generator is usually done from
b58e57
+.Cm /dev/urandom .
b58e57
+If the 
b58e57
+.Cm SSH_USE_STRONG_RNG
b58e57
+environment variable is set to value other than
b58e57
+.Cm 0
b58e57
+the OpenSSL random generator is reseeded from
b58e57
+.Cm /dev/random .
b58e57
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
b58e57
+Minimum is 14 bytes.
b58e57
+This setting is not recommended on the computers without the hardware
b58e57
+random generator because insufficient entropy causes the connection to 
b58e57
+be blocked until enough entropy is available.
b58e57
+.El
b58e57
 .Sh SEE ALSO
b58e57
 .Xr ssh 1 ,
b58e57
 .Xr ssh-add 1 ,
b58e57
diff --git a/ssh-keysign.8 b/ssh-keysign.8
b58e57
index 69d0829..02d79f8 100644
b58e57
--- a/ssh-keysign.8
b58e57
+++ b/ssh-keysign.8
b58e57
@@ -80,6 +80,24 @@ must be set-uid root if host-based authentication is used.
b58e57
 If these files exist they are assumed to contain public certificate
b58e57
 information corresponding with the private keys above.
b58e57
 .El
b58e57
+.Sh ENVIRONMENT
b58e57
+.Bl -tag -width Ds -compact
b58e57
+.Pp
b58e57
+.It Pa SSH_USE_STRONG_RNG
b58e57
+The reseeding of the OpenSSL random generator is usually done from
b58e57
+.Cm /dev/urandom .
b58e57
+If the 
b58e57
+.Cm SSH_USE_STRONG_RNG
b58e57
+environment variable is set to value other than
b58e57
+.Cm 0
b58e57
+the OpenSSL random generator is reseeded from
b58e57
+.Cm /dev/random .
b58e57
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
b58e57
+Minimum is 14 bytes.
b58e57
+This setting is not recommended on the computers without the hardware
b58e57
+random generator because insufficient entropy causes the connection to 
b58e57
+be blocked until enough entropy is available.
b58e57
+.El
b58e57
 .Sh SEE ALSO
b58e57
 .Xr ssh 1 ,
b58e57
 .Xr ssh-keygen 1 ,
b58e57
diff --git a/ssh.1 b/ssh.1
b58e57
index 929904b..f65e42f 100644
b58e57
--- a/ssh.1
b58e57
+++ b/ssh.1
b58e57
@@ -1309,6 +1309,23 @@ For more information, see the
b58e57
 .Cm PermitUserEnvironment
b58e57
 option in
b58e57
 .Xr sshd_config 5 .
b58e57
+.Sh ENVIRONMENT
b58e57
+.Bl -tag -width Ds -compact
b58e57
+.It Ev SSH_USE_STRONG_RNG
b58e57
+The reseeding of the OpenSSL random generator is usually done from
b58e57
+.Cm /dev/urandom .
b58e57
+If the 
b58e57
+.Cm SSH_USE_STRONG_RNG
b58e57
+environment variable is set to value other than
b58e57
+.Cm 0
b58e57
+the OpenSSL random generator is reseeded from
b58e57
+.Cm /dev/random .
b58e57
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
b58e57
+Minimum is 14 bytes.
b58e57
+This setting is not recommended on the computers without the hardware
b58e57
+random generator because insufficient entropy causes the connection to 
b58e57
+be blocked until enough entropy is available.
b58e57
+.El
b58e57
 .Sh FILES
b58e57
 .Bl -tag -width Ds -compact
b58e57
 .It Pa ~/.rhosts
b58e57
diff --git a/sshd.8 b/sshd.8
b58e57
index c2c237f..058d37a 100644
b58e57
--- a/sshd.8
b58e57
+++ b/sshd.8
b58e57
@@ -951,6 +951,24 @@ concurrently for different ports, this contains the process ID of the one
b58e57
 started last).
b58e57
 The content of this file is not sensitive; it can be world-readable.
b58e57
 .El
b58e57
+.Sh ENVIRONMENT
b58e57
+.Bl -tag -width Ds -compact
b58e57
+.Pp
b58e57
+.It Pa SSH_USE_STRONG_RNG
b58e57
+The reseeding of the OpenSSL random generator is usually done from
b58e57
+.Cm /dev/urandom .
b58e57
+If the 
b58e57
+.Cm SSH_USE_STRONG_RNG
b58e57
+environment variable is set to value other than
b58e57
+.Cm 0
b58e57
+the OpenSSL random generator is reseeded from
b58e57
+.Cm /dev/random .
b58e57
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
b58e57
+Minimum is 14 bytes.
b58e57
+This setting is not recommended on the computers without the hardware
b58e57
+random generator because insufficient entropy causes the connection to 
b58e57
+be blocked until enough entropy is available.
b58e57
+.El
b58e57
 .Sh IPV6
b58e57
 IPv6 address can be used everywhere where IPv4 address. In all entries must be the IPv6 address enclosed in square brackets. Note: The square brackets are metacharacters for the shell and must be escaped in shell.
b58e57
 .Sh SEE ALSO