From owner-freebsd-current@FreeBSD.ORG Wed Jun 23 08:04:43 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ADA3E16A4CE; Wed, 23 Jun 2004 08:04:43 +0000 (GMT) Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.157.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3BAA443D48; Wed, 23 Jun 2004 08:04:43 +0000 (GMT) (envelope-from mark@grondar.org) Received: from storm.FreeBSD.org.uk (Ugrondar@localhost [127.0.0.1]) i5N84XZK012283; Wed, 23 Jun 2004 09:04:33 +0100 (BST) (envelope-from mark@grondar.org) Received: (from Ugrondar@localhost)i5N84Xqu012282; Wed, 23 Jun 2004 09:04:33 +0100 (BST) (envelope-from mark@grondar.org) X-Authentication-Warning: storm.FreeBSD.org.uk: Ugrondar set sender to mark@grondar.org using -f Received: from grondar.org (localhost [127.0.0.1])i5N83AD9032086; Wed, 23 Jun 2004 09:03:10 +0100 (BST) (envelope-from mark@grondar.org) From: Mark Murray Message-Id: <200406230803.i5N83AD9032086@grimreaper.grondar.org> To: Scott Long In-Reply-To: Your message of "Sun, 20 Jun 2004 18:19:58 MDT." <40D629AE.1070207@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <32083.1087977745.0@grondar.org> Date: Wed, 23 Jun 2004 09:03:10 +0100 Sender: mark@grondar.org X-Scanned-By: milter-sender/0.55.730 (storm.FreeBSD.org.uk []); Wed, 23 Jun 2004 09:04:33 +0100 X-Mailman-Approved-At: Wed, 23 Jun 2004 09:18:37 +0000 cc: freebsd-current@FreeBSD.ORG Subject: Re: Entropy device is blocked. Dance fandango on keyboard to unblock. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jun 2004 08:04:43 -0000 ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32083.1087977745.1@grondar.org> Scott Long writes: > Yes, this will be a 5.3 showstopper item. I will update the TODO list > tonight. MarkM, paging MarkM, you have a call on the Batphone. :-) Here is the proposed fix. Anyone want to try it before I commit? M -- Mark Murray iumop ap!sdn w,I idlaH ------- =_aaaaaaaaaa0 Content-Type: text/plain; file="sysinstall.patch"; charset="us-ascii" Content-ID: <32083.1087977745.2@grondar.org> Content-Description: sysinstall.patch Index: config.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/sysinstall/config.c,v retrieving revision 1.222 diff -u -d -r1.222 config.c --- config.c 7 May 2004 19:15:55 -0000 1.222 +++ config.c 22 Jun 2004 22:34:57 -0000 @@ -389,6 +389,7 @@ { char line[256]; FILE *rcSite, *rcOld; + int rcRNG, rcEntropy; Variable *v; int write_header; time_t t_loc; @@ -396,6 +397,8 @@ static int did_marker = 0; int do_sort; int do_merge; + int do_rng; + int i; time_t tp; configTtys(); @@ -403,6 +406,7 @@ do_sort = RunningAsInit && file_readable("/usr/bin/sort") && file_readable("/usr/bin/uniq"); do_merge = do_sort && file_readable("/etc/rc.conf"); + do_rng = RunningAsInit; if(do_merge) { rcSite = fopen("/etc/rc.conf.new", "w"); @@ -462,6 +466,31 @@ if (do_sort) { (void)vsystem("sort /etc/rc.conf | uniq > /etc/rc.conf.new && mv /etc/rc.conf.new /etc/rc.conf"); } + + /* Kickstart the new RNG with a new /entropy file */ + if (do_rng) { + rcRNG = open("/dev/random", O_RDONLY); + if(rcRNG == -1) { + msgError("Error opening /dev/random for reading: %s (%u)", + strerror(errno), errno); + return; + } + rcEntropy = open("/entropy", O_WRONLY|O_CREAT, 0600); + if(rcEntropy == -1) { + msgError("Error opening /entropy for writing: %s (%u)", + strerror(errno), errno); + close(rcRNG); + return; + } + + for (i = 0; i < 2048; i += (int)sizeof(line)) { + read(rcRNG, line, sizeof(line)); + write(rcEntropy, line, sizeof(line)); + } + + close(rcEntropy); + close(rcRNG); + } } int Index: main.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/sysinstall/main.c,v retrieving revision 1.71 diff -u -d -r1.71 main.c --- main.c 20 Aug 2003 06:27:21 -0000 1.71 +++ main.c 22 Jun 2004 22:29:03 -0000 @@ -50,6 +50,7 @@ int main(int argc, char **argv) { + FILE *rng; int choice, scroll, curr, max, status; /* Record name to be able to restart */ @@ -77,6 +78,14 @@ } #endif + /* Unblock RNG. This could be replaced with something to make the + * human installer generate some entropy, but we'll likely get + * as much or better through the install/reboot. + */ + rng = fopen("/dev/random", "w"); + fprintf(rng, "unlock"); + fclose(rng); + /* Set up whatever things need setting up */ systemInitialize(argc, argv); ------- =_aaaaaaaaaa0--