vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jan F 0e9135
diff -up openssh-5.8p2/entropy.c.entropy openssh-5.8p2/entropy.c
Jan F 0e9135
--- openssh-5.8p2/entropy.c.entropy	2011-05-03 02:00:08.000000000 +0200
Jan F 0e9135
+++ openssh-5.8p2/entropy.c	2011-05-28 21:13:09.302866730 +0200
Jan F 0e9135
@@ -145,6 +145,9 @@ seed_rng(void)
Jan F 3657ad
 	memset(buf, '\0', sizeof(buf));
Jan F 3657ad
 
Jan F 3657ad
 #endif /* OPENSSL_PRNG_ONLY */
Jan F 3657ad
+#ifdef __linux__
Jan F 3657ad
+	linux_seed();
Jan F 3657ad
+#endif /* __linux__ */
Jan F 3657ad
 	if (RAND_status() != 1)
Jan F 3657ad
 		fatal("PRNG is not seeded");
Jan F 3657ad
 }
Jan F 0e9135
diff -up openssh-5.8p2/openbsd-compat/Makefile.in.entropy openssh-5.8p2/openbsd-compat/Makefile.in
Jan F 0e9135
--- openssh-5.8p2/openbsd-compat/Makefile.in.entropy	2010-10-07 13:19:24.000000000 +0200
Jan F 0e9135
+++ openssh-5.8p2/openbsd-compat/Makefile.in	2011-05-28 21:13:09.449924419 +0200
Jan F 3657ad
@@ -20,7 +20,7 @@ OPENBSD=base64.o basename.o bindresvport
Jan F 3657ad
 
Jan F 3657ad
 COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o
Jan F 3657ad
 
Jan F 3657ad
-PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-tun.o port-uw.o
Jan F 3657ad
+PORTS=port-aix.o port-irix.o port-linux.o port-linux-prng.o port-solaris.o port-tun.o port-uw.o
Jan F 3657ad
 
Jan F 3657ad
 .c.o:
Jan F 3657ad
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
Jan F 0e9135
diff -up openssh-5.8p2/openbsd-compat/port-linux-prng.c.entropy openssh-5.8p2/openbsd-compat/port-linux-prng.c
Jan F 0e9135
--- openssh-5.8p2/openbsd-compat/port-linux-prng.c.entropy	2011-05-28 21:13:09.540878930 +0200
Jan F 0e9135
+++ openssh-5.8p2/openbsd-compat/port-linux-prng.c	2011-05-28 21:13:09.547919624 +0200
Jan F 0e9135
@@ -0,0 +1,59 @@
Jan F 3657ad
+/* $Id: port-linux.c,v 1.11.4.2 2011/02/04 00:43:08 djm Exp $ */
Jan F 3657ad
+
Jan F 3657ad
+/*
Jan F 11896a
+ * Copyright (c) 2011 Jan F. Chadima <jchadima@redhat.com>
Jan F 3657ad
+ *
Jan F 3657ad
+ * Permission to use, copy, modify, and distribute this software for any
Jan F 3657ad
+ * purpose with or without fee is hereby granted, provided that the above
Jan F 3657ad
+ * copyright notice and this permission notice appear in all copies.
Jan F 3657ad
+ *
Jan F 3657ad
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
Jan F 3657ad
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
Jan F 3657ad
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
Jan F 3657ad
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
Jan F 3657ad
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
Jan F 3657ad
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
Jan F 3657ad
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Jan F 3657ad
+ */
Jan F 3657ad
+
Jan F 3657ad
+/*
Jan F 3657ad
+ * Linux-specific portability code - prng support
Jan F 3657ad
+ */
Jan F 3657ad
+
Jan F 3657ad
+#include "includes.h"
Jan F 3657ad
+
Jan F 3657ad
+#include <errno.h>
Jan F 3657ad
+#include <stdarg.h>
Jan F 3657ad
+#include <string.h>
Jan F 3657ad
+#include <stdio.h>
Jan F 8ecc9b
+#include <openssl/rand.h>
Jan F 3657ad
+
Jan F 3657ad
+#include "log.h"
Jan F 3657ad
+#include "xmalloc.h"
Jan F 3657ad
+#include "servconf.h"
Jan F 3657ad
+#include "port-linux.h"
Jan F 3657ad
+#include "key.h"
Jan F 3657ad
+#include "hostfile.h"
Jan F 3657ad
+#include "auth.h"
Jan F 3657ad
+
Jan F 3657ad
+void
Jan F 3657ad
+linux_seed(void)
Jan F 3657ad
+{
Jan F 3657ad
+	int len;
Jan F 3657ad
+	char *env = getenv("SSH_USE_STRONG_RNG");
Jan F 0e9135
+	char *random = "/dev/random";
Jan F 0e9135
+	size_t ienv, randlen = 6;
Jan F 3657ad
+
Jan F 0e9135
+	if (!env || !strcmp(env, "0"))
Jan F 0e9135
+		random = "/dev/urandom";
Jan F 0e9135
+	else if ((ienv = atoi(env)) > 6)
Jan F 0e9135
+		randlen = ienv;
Jan F 3657ad
+
Jan F 3657ad
+	errno = 0;
Jan F 0e9135
+	if ((len = RAND_load_file(random, randlen)) != randlen) {
Jan F 3657ad
+		if (errno)
Jan F 3657ad
+			fatal ("cannot read from %s, %s", random, strerror(errno));
Jan F 3657ad
+		else
Jan F 3657ad
+			fatal ("EOF reading %s", random);
Jan F 3657ad
+	}
Jan F 3657ad
+}
Jan F 0e9135
diff -up openssh-5.8p2/ssh.1.entropy openssh-5.8p2/ssh.1
Jan F 0e9135
--- openssh-5.8p2/ssh.1.entropy	2010-11-20 05:21:03.000000000 +0100
Jan F 0e9135
+++ openssh-5.8p2/ssh.1	2011-05-28 21:15:27.375920967 +0200
Jan F bc60f3
@@ -1250,6 +1250,20 @@ For more information, see the
Jan F 0553df
 .Cm PermitUserEnvironment
Jan F 0553df
 option in
Jan F 0553df
 .Xr sshd_config 5 .
Jan F 0553df
+.It Ev SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F bc60f3
+environment variable is set to value other than
Jan F bc60f3
+.Cm 0
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F bc60f3
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F bc60f3
+Minimum is 6 bytes.
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F bc60f3
+random generator because insufficient entropy causes the connection to 
Jan F bc60f3
+be blocked until enough entropy is available.
Jan F 0553df
 .Sh FILES
Jan F 0553df
 .Bl -tag -width Ds -compact
Jan F 0553df
 .It Pa ~/.rhosts
Jan F 0e9135
diff -up openssh-5.8p2/ssh-add.1.entropy openssh-5.8p2/ssh-add.1
Jan F 0e9135
--- openssh-5.8p2/ssh-add.1.entropy	2010-11-05 00:20:14.000000000 +0100
Jan F 0e9135
+++ openssh-5.8p2/ssh-add.1	2011-05-28 21:16:43.891859186 +0200
Jan F bc60f3
@@ -158,6 +158,20 @@ Identifies the path of a
Jan F 0553df
 .Ux Ns -domain
Jan F 0553df
 socket used to communicate with the agent.
Jan F 0e9135
 .El
Jan F 0553df
+.It Ev SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F bc60f3
+environment variable is set to value other than
Jan F bc60f3
+.Cm 0
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F bc60f3
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F bc60f3
+Minimum is 6 bytes.
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F bc60f3
+random generator because insufficient entropy causes the connection to 
Jan F bc60f3
+be blocked until enough entropy is available.
Jan F 0553df
 .Sh FILES
Jan F 0553df
 .Bl -tag -width Ds
Jan F 0e9135
 .It Pa ~/.ssh/identity
Jan F 0e9135
diff -up openssh-5.8p2/ssh-agent.1.entropy openssh-5.8p2/ssh-agent.1
Jan F 0e9135
--- openssh-5.8p2/ssh-agent.1.entropy	2010-12-01 01:50:35.000000000 +0100
Jan F 0e9135
+++ openssh-5.8p2/ssh-agent.1	2011-05-28 21:13:10.086864993 +0200
Jan F bc60f3
@@ -198,6 +198,23 @@ sockets used to contain the connection t
Jan F 0553df
 These sockets should only be readable by the owner.
Jan F 0553df
 The sockets should get automatically removed when the agent exits.
Jan F 0553df
 .El
Jan F 0553df
+.Sh ENVIRONMENT
Jan F 0553df
+.Bl -tag -width Ds -compact
Jan F 0553df
+.Pp
Jan F 0553df
+.It Pa SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F bc60f3
+environment variable is set to value other than
Jan F bc60f3
+.Cm 0
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F bc60f3
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F bc60f3
+Minimum is 6 bytes.
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F bc60f3
+random generator because insufficient entropy causes the connection to 
Jan F bc60f3
+be blocked until enough entropy is available.
Jan F 0553df
 .Sh SEE ALSO
Jan F 0553df
 .Xr ssh 1 ,
Jan F 0553df
 .Xr ssh-add 1 ,
Jan F 0e9135
diff -up openssh-5.8p2/sshd.8.entropy openssh-5.8p2/sshd.8
Jan F 0e9135
--- openssh-5.8p2/sshd.8.entropy	2010-11-05 00:20:14.000000000 +0100
Jan F 0e9135
+++ openssh-5.8p2/sshd.8	2011-05-28 21:13:10.241861760 +0200
Jan F bc60f3
@@ -937,6 +937,23 @@ concurrently for different ports, this c
Jan F 0553df
 started last).
Jan F 0553df
 The content of this file is not sensitive; it can be world-readable.
Jan F 0553df
 .El
Jan F 0553df
+.Sh ENVIRONMENT
Jan F 0553df
+.Bl -tag -width Ds -compact
Jan F 0553df
+.Pp
Jan F 0553df
+.It Pa SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F bc60f3
+environment variable is set to value other than
Jan F bc60f3
+.Cm 0
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F bc60f3
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F bc60f3
+Minimum is 6 bytes.
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F bc60f3
+random generator because insufficient entropy causes the connection to 
Jan F bc60f3
+be blocked until enough entropy is available.
Jan F 0553df
 .Sh SEE ALSO
Jan F 0553df
 .Xr scp 1 ,
Jan F 0553df
 .Xr sftp 1 ,
Jan F 0e9135
diff -up openssh-5.8p2/ssh-keygen.1.entropy openssh-5.8p2/ssh-keygen.1
Jan F 0e9135
--- openssh-5.8p2/ssh-keygen.1.entropy	2010-11-05 00:20:14.000000000 +0100
Jan F 0e9135
+++ openssh-5.8p2/ssh-keygen.1	2011-05-28 21:13:10.389856432 +0200
Jan F bc60f3
@@ -655,6 +655,23 @@ Contains Diffie-Hellman groups used for
Jan F 0553df
 The file format is described in
Jan F 0553df
 .Xr moduli 5 .
Jan F 0553df
 .El
Jan F 0553df
+.Sh ENVIRONMENT
Jan F 0553df
+.Bl -tag -width Ds -compact
Jan F 0553df
+.Pp
Jan F 0553df
+.It Pa SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F bc60f3
+environment variable is set to value other than
Jan F bc60f3
+.Cm 0
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F bc60f3
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F bc60f3
+Minimum is 6 bytes.
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F bc60f3
+random generator because insufficient entropy causes the connection to 
Jan F bc60f3
+be blocked until enough entropy is available.
Jan F 0553df
 .Sh SEE ALSO
Jan F 0553df
 .Xr ssh 1 ,
Jan F 0553df
 .Xr ssh-add 1 ,
Jan F 0e9135
diff -up openssh-5.8p2/ssh-keysign.8.entropy openssh-5.8p2/ssh-keysign.8
Jan F 0e9135
--- openssh-5.8p2/ssh-keysign.8.entropy	2010-08-31 14:41:14.000000000 +0200
Jan F 0e9135
+++ openssh-5.8p2/ssh-keysign.8	2011-05-28 21:17:32.399856797 +0200
Jan F bc60f3
@@ -78,6 +78,23 @@ must be set-uid root if host-based authe
Jan F 0553df
 If these files exist they are assumed to contain public certificate
Jan F 0553df
 information corresponding with the private keys above.
Jan F 0553df
 .El
Jan F 0553df
+.Sh ENVIRONMENT
Jan F 0553df
+.Bl -tag -width Ds -compact
Jan F 0553df
+.Pp
Jan F 0553df
+.It Pa SSH_USE_STRONG_RNG
Jan F 0553df
+The reseeding of the OpenSSL random generator is usually done from
Jan F 0553df
+.Cm /dev/urandom .
Jan F 0553df
+If the 
Jan F 0553df
+.Cm SSH_USE_STRONG_RNG
Jan F bc60f3
+environment variable is set to value other than
Jan F bc60f3
+.Cm 0
Jan F 0553df
+the OpenSSL random generator is reseeded from
Jan F 0553df
+.Cm /dev/random .
Jan F bc60f3
+The number of bytes read is defined by the SSH_USE_STRONG_RNG value. 
Jan F bc60f3
+Minimum is 6 bytes.
Jan F 7317c8
+This setting is not recommended on the computers without the hardware
Jan F bc60f3
+random generator because insufficient entropy causes the connection to 
Jan F bc60f3
+be blocked until enough entropy is available.
Jan F 0553df
 .Sh SEE ALSO
Jan F 0553df
 .Xr ssh 1 ,
Jan F 0553df
 .Xr ssh-keygen 1 ,