From owner-freebsd-current Sun Jan 20 14:21:10 2002 Delivered-To: freebsd-current@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 114E537B404 for ; Sun, 20 Jan 2002 14:21:08 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id JAA00631; Mon, 21 Jan 2002 09:21:06 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37645) with ESMTP id <01KDBTCFFDWG5IJJ3H@cim.alcatel.com.au>; Mon, 21 Jan 2002 09:21:23 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.6/8.11.6) id g0KML3q63535; Mon, 21 Jan 2002 09:21:03 +1100 Content-return: prohibited Date: Mon, 21 Jan 2002 09:21:02 +1100 From: Peter Jeremy Subject: Re: Step1, pam_unix srandomdev fix for review In-reply-to: <200201202151.g0KLp7t34081@grimreaper.grondar.org>; from mark@grondar.za on Sun, Jan 20, 2002 at 09:51:07PM +0000 To: Mark Murray Cc: Terry Lambert , current@FreeBSD.ORG Mail-Followup-To: Mark Murray , Terry Lambert , current@FreeBSD.ORG Message-id: <20020121092102.C72285@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <3C4B3775.1AFA318@mindspring.com> <200201202151.g0KLp7t34081@grimreaper.grondar.org> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-Jan-20 21:51:07 +0000, Mark Murray wrote: >> > Second step is effectively damages srandom(3) RNG state. >> >> Since the library is a totally encapsulated usage, it makes sense >> for it to save and restore state aroun its use of the functions, >> which would effectively allow concurrent use of the generator >> with other code that uses it. >> >> Other code that cares about the state should do the same. > >True but not trivial. I'd be happy to commit working patches :-) The simplest solution would appear to be to add srandom_r() and random_r() functions - both of which take an initstate() buffer. It should be possible using setstate() but there doesn't appear to be a documented sequence to restore the internal random state to "uninitialised". Is there any good reason why random_r(), srandom_r(), srandomdev_r() should not exist? Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message