Date: Tue, 15 Nov 2011 06:39:12 +0400 From: Andrey Chernov <ache@FreeBSD.ORG> To: Oliver Pinter <oliver.pntr@gmail.com> Cc: das@FreeBSD.ORG, current@FreeBSD.ORG, secteam@FreeBSD.ORG Subject: Re: Is fork() hook ever possible? Message-ID: <20111115023912.GA68523@vniz.net> In-Reply-To: <CAPjTQNFSbkiaDUzMh_WYffM9vF1-H3j-FA2FZJfHR-0uJyJ3eQ@mail.gmail.com> 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> <CAPjTQNFSbkiaDUzMh_WYffM9vF1-H3j-FA2FZJfHR-0uJyJ3eQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111115023912.GA68523>
