From owner-freebsd-current@FreeBSD.ORG Tue Nov 15 02:39:22 2011 Return-Path: Delivered-To: current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75FAD106566B; Tue, 15 Nov 2011 02:39:22 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id C81978FC16; Tue, 15 Nov 2011 02:39:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id pAF2dDcm069132; Tue, 15 Nov 2011 06:39:13 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id pAF2dCl6069130; Tue, 15 Nov 2011 06:39:12 +0400 (MSK) (envelope-from ache) Date: Tue, 15 Nov 2011 06:39:12 +0400 From: Andrey Chernov To: Oliver Pinter Message-ID: <20111115023912.GA68523@vniz.net> Mail-Followup-To: Andrey Chernov , Oliver Pinter , das@FreeBSD.ORG, current@FreeBSD.ORG, secteam@FreeBSD.ORG References: <20111112102241.GA75396@vniz.net> <20111112154135.GA21512@zim.MIT.EDU> <20111112171531.GA83419@vniz.net> <20111114013004.GA53392@zim.MIT.EDU> <20111114192721.GA16834@vniz.net> <20111114205855.GB58790@zim.MIT.EDU> <20111114212926.GA28783@vniz.net> <20111114230855.GA59545@zim.MIT.EDU> <20111115004443.GA50429@vniz.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: das@FreeBSD.ORG, current@FreeBSD.ORG, secteam@FreeBSD.ORG Subject: Re: Is fork() hook ever possible? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 15 Nov 2011 02:39:22 -0000 On Tue, Nov 15, 2011 at 02:11:03AM +0100, Oliver Pinter wrote: > > P.S. Do I answer your doubts about &rdat key initialization in my prev. > > posting? > > I think it's a much correct solution, rather than the original patch, > while it initializes the whole structure, not only the key array... > (&rdat.key vs &rdat; and uninitialized pid and tv): > > fd = _open(RANDOMDEV, O_RDONLY, 0); > done = 0; > if (fd >= 0) { > - if (_read(fd, &rdat, KEYSIZE) == KEYSIZE) > + if (_read(fd, &rdat, sizeof(rdat)) == sizeof(rdat)) > done = 1; > (void)_close(fd); > - } > + } > Currently this change will have no any effect in the code because only first 128 bytes of the structure are passed later: arc4_addrandom((u_char *)&rdat, KEYSIZE); In case you mean passing later whole structure like: arc4_addrandom((u_char *)&rdat, sizeof(rdat)); it will be incorrect because it change known algorithm parameters, which defines exact 128 bytes and not anything else. -- http://ache.vniz.net/