Date: Wed, 23 Jun 2004 09:03:10 +0100 From: Mark Murray <mark@grondar.org> To: Scott Long <scottl@FreeBSD.ORG> Cc: freebsd-current@FreeBSD.ORG Subject: Re: Entropy device is blocked. Dance fandango on keyboard to unblock. Message-ID: <200406230803.i5N83AD9032086@grimreaper.grondar.org> In-Reply-To: Your message of "Sun, 20 Jun 2004 18:19:58 MDT." <40D629AE.1070207@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
------- =_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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406230803.i5N83AD9032086>