Re: Is fork() hook ever possible?
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/
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
討論串 (同標題文章)
完整討論串 (本文為第 11 之 13 篇):