From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 17:00:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60BAE1065675 for ; Sun, 22 Jan 2012 17:00:09 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0:2]) by mx1.freebsd.org (Postfix) with ESMTP id 77BAA8FC18 for ; Sun, 22 Jan 2012 17:00:08 +0000 (UTC) Received: from uucp by gromit.grondar.org with local-rmail (Exim 4.76 (FreeBSD)) (envelope-from ) id 1Rp0lz-000Hxe-5k for svn-src-all@freebsd.org; Sun, 22 Jan 2012 17:00:07 +0000 Received: from localhost ([127.0.0.1] helo=groundzero.grondar.org) by groundzero.grondar.org with esmtp (Exim 4.77 (FreeBSD)) (envelope-from ) id 1Rp0lq-000Gly-FT; Sun, 22 Jan 2012 16:59:58 +0000 To: Andrey Chernov In-reply-to: <20120120215649.GA40016@vniz.net> References: <201201162018.q0GKIADK050161@svn.freebsd.org> <20120118061943.GA80874@vniz.net> <20120120055823.GA28177@vniz.net> <20120120215649.GA40016@vniz.net> From: Mark Murray Date: Sun, 22 Jan 2012 16:59:55 +0000 Message-Id: Cc: svn-src-head@FreeBSD.ORG, David Schultz , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG Subject: Re: svn commit: r230230 - head/sys/dev/random X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 17:00:09 -0000 Andrey Chernov writes: > > The usual way round this is with a flag. Set a static, volatile > > flag, defaulting "off", and set it to "on" when the seeding has > > happened. Then arc4random() can do the right thing, depending on > > this flag. > > Ok, what about this version, is it right? libkern/arc4rand.c is not a > module but always present in the kernel, so "arc4rand_iniseed_state" > will be always accessible. > > --- dev/random/randomdev_soft.c.old 2011-09-26 07:35:48.000000000 +0400 > +++ dev/random/randomdev_soft.c 2012-01-21 01:41:37.000000000 +0400 > @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD: src/sys/dev/random/r > > #define RANDOM_FIFO_MAX 256 /* How many events to queue up */ > > +extern int arc4rand_iniseed_state; > + Should be in a header file, nad _possibly_ should be volatile. If it works without being volatile, then OK. The rest is OK. I've not tested it, so this is not a review, simply an "OK" :-) M -- Mark R V Murray Cert APS(Open) Dip Phys(Open) BSc Open(Open) BSc(Hons)(Open) Pi: 132511160