5cd882e
diff -up openssh-6.2p1/entropy.c.entropy openssh-6.2p1/entropy.c
5cd882e
--- openssh-6.2p1/entropy.c.entropy	2013-03-25 19:31:42.737611051 +0100
5cd882e
+++ openssh-6.2p1/entropy.c	2013-03-25 19:31:42.797611433 +0100
fe69dd6
@@ -237,6 +237,9 @@ seed_rng(void)
99254d5
 	memset(buf, '\0', sizeof(buf));
99254d5
 
99254d5
 #endif /* OPENSSL_PRNG_ONLY */
99254d5
+#ifdef __linux__
99254d5
+	linux_seed();
99254d5
+#endif /* __linux__ */
99254d5
 	if (RAND_status() != 1)
99254d5
 		fatal("PRNG is not seeded");
99254d5
 }
5cd882e
diff -up openssh-6.2p1/openbsd-compat/Makefile.in.entropy openssh-6.2p1/openbsd-compat/Makefile.in
5cd882e
--- openssh-6.2p1/openbsd-compat/Makefile.in.entropy	2013-03-25 19:31:42.798611440 +0100
5cd882e
+++ openssh-6.2p1/openbsd-compat/Makefile.in	2013-03-25 19:33:02.042116876 +0100
99254d5
@@ -20,7 +20,7 @@ OPENBSD=base64.o basename.o bindresvport
99254d5
 
5cd882e
 COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.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 xmmap.o xcrypt.o
99254d5
 
99254d5
-PORTS=port-aix.o port-irix.o port-linux.o port-linux_part_2.o port-solaris.o port-tun.o port-uw.o
99254d5
+PORTS=port-aix.o port-irix.o port-linux.o port-linux_part_2.o port-linux-prng.o port-solaris.o port-tun.o port-uw.o
99254d5
 
99254d5
 .c.o:
99254d5
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
5cd882e
diff -up openssh-6.2p1/openbsd-compat/port-linux-prng.c.entropy openssh-6.2p1/openbsd-compat/port-linux-prng.c
5cd882e
--- openssh-6.2p1/openbsd-compat/port-linux-prng.c.entropy	2013-03-25 19:31:42.798611440 +0100
5cd882e
+++ openssh-6.2p1/openbsd-compat/port-linux-prng.c	2013-03-25 19:31:42.798611440 +0100
99254d5
@@ -0,0 +1,59 @@
99254d5
+/* $Id: port-linux.c,v 1.11.4.2 2011/02/04 00:43:08 djm Exp $ */
99254d5
+
99254d5
+/*
99254d5
+ * Copyright (c) 2011 Jan F. Chadima <jchadima@redhat.com>
99254d5
+ *
99254d5
+ * Permission to use, copy, modify, and distribute this software for any
99254d5
+ * purpose with or without fee is hereby granted, provided that the above
99254d5
+ * copyright notice and this permission notice appear in all copies.
99254d5
+ *
99254d5
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
99254d5
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
99254d5
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
99254d5
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
99254d5
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
99254d5
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
99254d5
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
99254d5
+ */
99254d5
+
99254d5
+/*
99254d5
+ * Linux-specific portability code - prng support
99254d5
+ */
99254d5
+
99254d5
+#include "includes.h"
99254d5
+
99254d5
+#include <errno.h>
99254d5
+#include <stdarg.h>
99254d5
+#include <string.h>
99254d5
+#include <stdio.h>
99254d5
+#include <openssl/rand.h>
99254d5
+
99254d5
+#include "log.h"
99254d5
+#include "xmalloc.h"
99254d5
+#include "servconf.h"
99254d5
+#include "port-linux.h"
99254d5
+#include "key.h"
99254d5
+#include "hostfile.h"
99254d5
+#include "auth.h"
99254d5
+
99254d5
+void
99254d5
+linux_seed(void)
99254d5
+{
99254d5
+	int len;
99254d5
+	char *env = getenv("SSH_USE_STRONG_RNG");
99254d5
+	char *random = "/dev/random";
99254d5
+	size_t ienv, randlen = 6;
99254d5
+
99254d5
+	if (!env || !strcmp(env, "0"))
99254d5
+		random = "/dev/urandom";
99254d5
+	else if ((ienv = atoi(env)) > 6)
99254d5
+		randlen = ienv;
99254d5
+
99254d5
+	errno = 0;
99254d5
+	if ((len = RAND_load_file(random, randlen)) != randlen) {
99254d5
+		if (errno)
99254d5
+			fatal ("cannot read from %s, %s", random, strerror(errno));
99254d5
+		else
99254d5
+			fatal ("EOF reading %s", random);
99254d5
+	}
99254d5
+}
5cd882e
diff -up openssh-6.2p1/ssh-add.0.entropy openssh-6.2p1/ssh-add.0
5cd882e
--- openssh-6.2p1/ssh-add.0.entropy	2013-03-22 00:38:29.000000000 +0100
5cd882e
+++ openssh-6.2p1/ssh-add.0	2013-03-25 19:31:42.799611446 +0100
5cd882e
@@ -82,6 +82,16 @@ ENVIRONMENT
9dd0663
              Identifies the path of a UNIX-domain socket used to communicate
9dd0663
              with the agent.
9dd0663
 
9dd0663
+     SSH_USE_STRONG_RNG
9dd0663
+             The reseeding of the OpenSSL random generator is usually done
9dd0663
+             from /dev/urandom.  If the SSH_USE_STRONG_RNG environment vari-
9dd0663
+             able is set to value other than 0 the OpenSSL random generator is
9dd0663
+             reseeded from /dev/random.  The number of bytes read is defined
9dd0663
+             by the SSH_USE_STRONG_RNG value.  Minimum is 6 bytes.  This set-
9dd0663
+             ting is not recommended on the computers without the hardware
9dd0663
+             random generator because insufficient entropy causes the connec-
9dd0663
+             tion to be blocked until enough entropy is available.
9dd0663
+
9dd0663
 FILES
9dd0663
      ~/.ssh/identity
9dd0663
              Contains the protocol version 1 RSA authentication identity of
5cd882e
diff -up openssh-6.2p1/ssh-add.1.entropy openssh-6.2p1/ssh-add.1
5cd882e
--- openssh-6.2p1/ssh-add.1.entropy	2012-12-07 03:06:13.000000000 +0100
5cd882e
+++ openssh-6.2p1/ssh-add.1	2013-03-25 19:31:42.799611446 +0100
9dd0663
@@ -160,6 +160,20 @@ to make this work.)
9dd0663
 Identifies the path of a
fe69dd6
 .Ux Ns -domain
fe69dd6
 socket used to communicate with the agent.
fe69dd6
+.It Ev SSH_USE_STRONG_RNG
99254d5
+The reseeding of the OpenSSL random generator is usually done from
99254d5
+.Cm /dev/urandom .
99254d5
+If the 
99254d5
+.Cm SSH_USE_STRONG_RNG
99254d5
+environment variable is set to value other than
99254d5
+.Cm 0
99254d5
+the OpenSSL random generator is reseeded from
99254d5
+.Cm /dev/random .
99254d5
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
99254d5
+Minimum is 6 bytes.
99254d5
+This setting is not recommended on the computers without the hardware
99254d5
+random generator because insufficient entropy causes the connection to 
99254d5
+be blocked until enough entropy is available.
9dd0663
 .El
fe69dd6
 .Sh FILES
fe69dd6
 .Bl -tag -width Ds
5cd882e
diff -up openssh-6.2p1/ssh-agent.1.entropy openssh-6.2p1/ssh-agent.1
5cd882e
--- openssh-6.2p1/ssh-agent.1.entropy	2010-12-01 01:50:35.000000000 +0100
5cd882e
+++ openssh-6.2p1/ssh-agent.1	2013-03-25 19:31:42.800611452 +0100
fe69dd6
@@ -198,6 +198,24 @@ sockets used to contain the connection t
fe69dd6
 These sockets should only be readable by the owner.
fe69dd6
 The sockets should get automatically removed when the agent exits.
99254d5
 .El
99254d5
+.Sh ENVIRONMENT
99254d5
+.Bl -tag -width Ds -compact
99254d5
+.Pp
99254d5
+.It Pa SSH_USE_STRONG_RNG
99254d5
+The reseeding of the OpenSSL random generator is usually done from
99254d5
+.Cm /dev/urandom .
99254d5
+If the 
99254d5
+.Cm SSH_USE_STRONG_RNG
99254d5
+environment variable is set to value other than
99254d5
+.Cm 0
99254d5
+the OpenSSL random generator is reseeded from
99254d5
+.Cm /dev/random .
99254d5
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
99254d5
+Minimum is 6 bytes.
99254d5
+This setting is not recommended on the computers without the hardware
99254d5
+random generator because insufficient entropy causes the connection to 
99254d5
+be blocked until enough entropy is available.
99254d5
+.El
99254d5
 .Sh SEE ALSO
99254d5
 .Xr ssh 1 ,
99254d5
 .Xr ssh-add 1 ,
5cd882e
diff -up openssh-6.2p1/sshd.8.entropy openssh-6.2p1/sshd.8
5cd882e
--- openssh-6.2p1/sshd.8.entropy	2013-03-25 19:31:42.752611146 +0100
5cd882e
+++ openssh-6.2p1/sshd.8	2013-03-25 19:31:42.800611452 +0100
5cd882e
@@ -945,6 +945,24 @@ concurrently for different ports, this c
fe69dd6
 started last).
fe69dd6
 The content of this file is not sensitive; it can be world-readable.
99254d5
 .El
99254d5
+.Sh ENVIRONMENT
99254d5
+.Bl -tag -width Ds -compact
99254d5
+.Pp
99254d5
+.It Pa SSH_USE_STRONG_RNG
99254d5
+The reseeding of the OpenSSL random generator is usually done from
99254d5
+.Cm /dev/urandom .
99254d5
+If the 
99254d5
+.Cm SSH_USE_STRONG_RNG
99254d5
+environment variable is set to value other than
99254d5
+.Cm 0
99254d5
+the OpenSSL random generator is reseeded from
99254d5
+.Cm /dev/random .
99254d5
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
99254d5
+Minimum is 6 bytes.
99254d5
+This setting is not recommended on the computers without the hardware
99254d5
+random generator because insufficient entropy causes the connection to 
99254d5
+be blocked until enough entropy is available.
99254d5
+.El
fe69dd6
 .Sh IPV6
fe69dd6
 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.
99254d5
 .Sh SEE ALSO
5cd882e
diff -up openssh-6.2p1/ssh-keygen.1.entropy openssh-6.2p1/ssh-keygen.1
5cd882e
--- openssh-6.2p1/ssh-keygen.1.entropy	2013-01-20 12:35:06.000000000 +0100
5cd882e
+++ openssh-6.2p1/ssh-keygen.1	2013-03-25 19:31:42.801611459 +0100
5cd882e
@@ -806,6 +806,24 @@ Contains Diffie-Hellman groups used for
fe69dd6
 The file format is described in
fe69dd6
 .Xr moduli 5 .
fe69dd6
 .El
99254d5
+.Sh ENVIRONMENT
99254d5
+.Bl -tag -width Ds -compact
fe69dd6
+.Pp
fe69dd6
+.It Pa SSH_USE_STRONG_RNG
99254d5
+The reseeding of the OpenSSL random generator is usually done from
99254d5
+.Cm /dev/urandom .
99254d5
+If the 
99254d5
+.Cm SSH_USE_STRONG_RNG
99254d5
+environment variable is set to value other than
99254d5
+.Cm 0
99254d5
+the OpenSSL random generator is reseeded from
99254d5
+.Cm /dev/random .
99254d5
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
99254d5
+Minimum is 6 bytes.
99254d5
+This setting is not recommended on the computers without the hardware
99254d5
+random generator because insufficient entropy causes the connection to 
99254d5
+be blocked until enough entropy is available.
99254d5
+.El
fe69dd6
 .Sh SEE ALSO
fe69dd6
 .Xr ssh 1 ,
fe69dd6
 .Xr ssh-add 1 ,
5cd882e
diff -up openssh-6.2p1/ssh-keysign.8.entropy openssh-6.2p1/ssh-keysign.8
5cd882e
--- openssh-6.2p1/ssh-keysign.8.entropy	2010-08-31 14:41:14.000000000 +0200
5cd882e
+++ openssh-6.2p1/ssh-keysign.8	2013-03-25 19:31:42.801611459 +0100
fe69dd6
@@ -78,6 +78,24 @@ must be set-uid root if host-based authe
fe69dd6
 If these files exist they are assumed to contain public certificate
fe69dd6
 information corresponding with the private keys above.
99254d5
 .El
99254d5
+.Sh ENVIRONMENT
99254d5
+.Bl -tag -width Ds -compact
99254d5
+.Pp
99254d5
+.It Pa SSH_USE_STRONG_RNG
99254d5
+The reseeding of the OpenSSL random generator is usually done from
99254d5
+.Cm /dev/urandom .
99254d5
+If the 
99254d5
+.Cm SSH_USE_STRONG_RNG
99254d5
+environment variable is set to value other than
99254d5
+.Cm 0
99254d5
+the OpenSSL random generator is reseeded from
99254d5
+.Cm /dev/random .
99254d5
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
99254d5
+Minimum is 6 bytes.
99254d5
+This setting is not recommended on the computers without the hardware
99254d5
+random generator because insufficient entropy causes the connection to 
99254d5
+be blocked until enough entropy is available.
99254d5
+.El
99254d5
 .Sh SEE ALSO
fe69dd6
 .Xr ssh 1 ,
fe69dd6
 .Xr ssh-keygen 1 ,
5cd882e
diff -up openssh-6.2p1/ssh.1.entropy openssh-6.2p1/ssh.1
5cd882e
--- openssh-6.2p1/ssh.1.entropy	2013-03-25 19:31:42.752611146 +0100
5cd882e
+++ openssh-6.2p1/ssh.1	2013-03-25 19:31:42.799611446 +0100
5cd882e
@@ -1277,6 +1277,23 @@ For more information, see the
5cd882e
 .Cm PermitUserEnvironment
5cd882e
 option in
5cd882e
 .Xr sshd_config 5 .
5cd882e
+.Sh ENVIRONMENT
5cd882e
+.Bl -tag -width Ds -compact
5cd882e
+.It Ev SSH_USE_STRONG_RNG
5cd882e
+The reseeding of the OpenSSL random generator is usually done from
5cd882e
+.Cm /dev/urandom .
5cd882e
+If the 
5cd882e
+.Cm SSH_USE_STRONG_RNG
5cd882e
+environment variable is set to value other than
5cd882e
+.Cm 0
5cd882e
+the OpenSSL random generator is reseeded from
5cd882e
+.Cm /dev/random .
5cd882e
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
5cd882e
+Minimum is 6 bytes.
5cd882e
+This setting is not recommended on the computers without the hardware
5cd882e
+random generator because insufficient entropy causes the connection to 
5cd882e
+be blocked until enough entropy is available.
5cd882e
+.El
5cd882e
 .Sh FILES
5cd882e
 .Bl -tag -width Ds -compact
5cd882e
 .It Pa ~/.rhosts