|
Jan F |
3657ad |
diff -up openssh-5.8p1/entropy.c.entropy openssh-5.8p1/entropy.c
|
|
Jan F |
3657ad |
--- openssh-5.8p1/entropy.c.entropy 2011-01-13 11:05:29.000000000 +0100
|
|
Jan F |
3657ad |
+++ openssh-5.8p1/entropy.c 2011-03-22 18:26:41.013648606 +0100
|
|
Jan F |
3657ad |
@@ -144,6 +144,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 |
3657ad |
diff -up openssh-5.8p1/openbsd-compat/Makefile.in.entropy openssh-5.8p1/openbsd-compat/Makefile.in
|
|
Jan F |
3657ad |
--- openssh-5.8p1/openbsd-compat/Makefile.in.entropy 2010-10-07 13:19:24.000000000 +0200
|
|
Jan F |
3657ad |
+++ openssh-5.8p1/openbsd-compat/Makefile.in 2011-03-22 18:28:31.835648739 +0100
|
|
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 |
3657ad |
diff -up openssh-5.8p1/openbsd-compat/port-linux-prng.c.entropy openssh-5.8p1/openbsd-compat/port-linux-prng.c
|
|
Jan F |
3657ad |
--- openssh-5.8p1/openbsd-compat/port-linux-prng.c.entropy 2011-03-22 18:27:57.422648991 +0100
|
|
Jan F |
3657ad |
+++ openssh-5.8p1/openbsd-compat/port-linux-prng.c 2011-03-22 18:27:57.401648964 +0100
|
|
Jan F |
3657ad |
@@ -0,0 +1,56 @@
|
|
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 |
3657ad |
+ * Copyright (c) 2005 Daniel Walsh <dwalsh@redhat.com>
|
|
Jan F |
3657ad |
+ * Copyright (c) 2006 Damien Miller <djm@openbsd.org>
|
|
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 |
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 |
3657ad |
+ char *random = "/dev/urandom";
|
|
Jan F |
3657ad |
+
|
|
Jan F |
3657ad |
+ if (env && !strcmp(env, "1"))
|
|
Jan F |
3657ad |
+ random = "/dev/random";
|
|
Jan F |
3657ad |
+
|
|
Jan F |
3657ad |
+ errno = 0;
|
|
Jan F |
3657ad |
+ if ((len = RAND_load_file(random, 48)) != 48) {
|
|
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 |
+}
|