Module Name: src
Committed By: tls
Date: Sat Nov 26 01:17:17 UTC 2011
Modified Files:
src/etc/mtree: special
src/sbin/rndctl: rndctl.c
src/sys/sys: rnd.h
src/usr.sbin/postinstall: postinstall
Log Message:
Make the rndsave structure public -- the kernel will learn to read it
and sysinst may learn to write it (since, on some systems, most of
the keyboard input they ever get happens to be during install). Fix a
couple of minor problems with the random_seed rc script addition.
To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/etc/mtree/special
cvs rdiff -u -r1.21 -r1.22 src/sbin/rndctl/rndctl.c
cvs rdiff -u -r1.23 -r1.24 src/sys/sys/rnd.h
cvs rdiff -u -r1.126 -r1.127 src/usr.sbin/postinstall/postinstall
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/etc/mtree/special
diff -u src/etc/mtree/special:1.138 src/etc/mtree/special:1.139
--- src/etc/mtree/special:1.138 Fri May 27 09:28:42 2011
+++ src/etc/mtree/special Sat Nov 26 01:17:17 2011
@@ -1,4 +1,4 @@
-# $NetBSD: special,v 1.138 2011/05/27 09:28:42 plunky Exp $
+# $NetBSD: special,v 1.139 2011/11/26 01:17:17 tls Exp $
# @(#)special 8.2 (Berkeley) 1/23/94
#
# This file may be overwritten on upgrades.
@@ -252,6 +252,7 @@
./etc/rc.d/racoon type=file mode=0555
./etc/rc.d/raidframe type=file mode=0555
./etc/rc.d/raidframeparity type=file mode=0555
+./etc/rc.d/random_seed type=file mode=0555
./etc/rc.d/rarpd type=file mode=0555
./etc/rc.d/rbootd type=file mode=0555
./etc/rc.d/rndctl type=file mode=0555
Index: src/sbin/rndctl/rndctl.c
diff -u src/sbin/rndctl/rndctl.c:1.21 src/sbin/rndctl/rndctl.c:1.22
--- src/sbin/rndctl/rndctl.c:1.21 Wed Nov 23 10:47:49 2011
+++ src/sbin/rndctl/rndctl.c Sat Nov 26 01:17:17 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rndctl.c,v 1.21 2011/11/23 10:47:49 tls Exp $ */
+/* $NetBSD: rndctl.c,v 1.22 2011/11/26 01:17:17 tls Exp $ */
/*-
* Copyright (c) 1997 Michael Graff.
@@ -33,7 +33,7 @@
#include <sha1.h>
#ifndef lint
-__RCSID("$NetBSD: rndctl.c,v 1.21 2011/11/23 10:47:49 tls Exp $");
+__RCSID("$NetBSD: rndctl.c,v 1.22 2011/11/26 01:17:17 tls Exp $");
#endif
@@ -51,12 +51,6 @@ __RCSID("$NetBSD: rndctl.c,v 1.21 2011/1
#include <string.h>
typedef struct {
- uint32_t entropy;
- uint8_t data[RND_POOLWORDS * sizeof(uint32_t)];
- uint8_t digest[SHA1_DIGEST_LENGTH];
-} rndsave_t;
-
-typedef struct {
const char *a_name;
u_int32_t a_type;
} arg_t;
Index: src/sys/sys/rnd.h
diff -u src/sys/sys/rnd.h:1.23 src/sys/sys/rnd.h:1.24
--- src/sys/sys/rnd.h:1.23 Wed Nov 23 10:47:49 2011
+++ src/sys/sys/rnd.h Sat Nov 26 01:17:17 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rnd.h,v 1.23 2011/11/23 10:47:49 tls Exp $ */
+/* $NetBSD: rnd.h,v 1.24 2011/11/26 01:17:17 tls Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,6 +38,7 @@
#endif /* !_KERNEL */
#include <sys/types.h>
+#include <sys/sha1.h>
#ifdef _KERNEL
#include <sys/queue.h>
@@ -50,6 +51,7 @@
#define RND_DEV_RANDOM 0 /* minor devices for random and kinda random */
#define RND_DEV_URANDOM 1
+#ifdef _KERNEL
/*
* Size of entropy pool in 32-bit words. This _MUST_ be a power of 2. Don't
* change this unless you really know what you are doing...
@@ -73,6 +75,20 @@
#define RND_EVENTQSIZE 128
#endif
+#endif /* _KERNEL */
+
+/*
+ * Exposed "size" of entropy pool, for convenience in load/save
+ * from userspace. Do not assume this is the same as the actual in-kernel
+ * pool size!
+ */
+#define RND_SAVEWORDS 128
+typedef struct {
+ uint32_t entropy;
+ uint8_t data[RND_SAVEWORDS * sizeof(uint32_t)];
+ uint8_t digest[SHA1_DIGEST_LENGTH];
+} rndsave_t;
+
typedef struct
{
uint32_t poolsize;
@@ -209,7 +225,7 @@ typedef struct {
typedef struct {
uint32_t len;
uint32_t entropy;
- u_char data[RND_POOLWORDS * sizeof(uint32_t)];
+ u_char data[RND_SAVEWORDS * sizeof(uint32_t)];
} rnddata_t;
#define RNDGETENTCNT _IOR('R', 101, uint32_t) /* get entropy count */
Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.126 src/usr.sbin/postinstall/postinstall:1.127
--- src/usr.sbin/postinstall/postinstall:1.126 Fri Oct 7 02:07:56 2011
+++ src/usr.sbin/postinstall/postinstall Sat Nov 26 01:17:17 2011
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: postinstall,v 1.126 2011/10/07 02:07:56 mrg Exp $
+# $NetBSD: postinstall,v 1.127 2011/11/26 01:17:17 tls Exp $
#
# Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -1149,7 +1149,8 @@ do_rc()
ntpd ntpdate \
perusertmp pf pf_boot pflogd postfix powerd ppp pwcheck \
quota \
- racoon rpcbind raidframe raidframeparity rarpd rbootd rndctl \
+ racoon rpcbind raidframe raidframeparity random_seed \
+ rarpd rbootd rndctl \
root route6d routed rtadvd rtclocaltime rtsold rwho \
savecore screenblank securelevel sshd \
staticroute swap1 swap2 sysctl sysdb syslogd \