Re: cprng sysctl: WARNING pseudorandom rekeying.

On Wed, 14 Nov 2012, Iain Hibbert wrote:
> On Wed, 14 Nov 2012, Iain Hibbert wrote:
>
> > On Mon, 12 Nov 2012, Iain Hibbert wrote:
> >
> > > On Fri, 9 Nov 2012, Thor Lancelot Simon wrote:
> > >
> > > > On Sat, Nov 10, 2012 at 12:39:59AM +0700, Robert Elz wrote:
> > > > >
> > > > > How?
> > > > >
> > > > > And if that's something that is supposed to be enabled, why does the
> > > > > default install not just enable it?
> > > >
> > > > Did you install by upgrading? If so, I think what you've run into is
> > > > that your boot loader configuration has the old default entries (or
> > > > whatever changes you made to them) and not the new defaults.
> > >
> > > I tried updating the "boot.cfg" bootloader configuration file as you
> > > suggested, but the system fails to boot as the rndseed command is unknown;
> > > what else is required to be updated, is it the on-disk bootblocks or just
> > > the second stage /boot object?
> >
> > So, I updated the second stage /boot file, changed my boot.cfg to include
> > the rndseed command as found in src/etc/etc.i386/boot.cfg
> >
> > menu=Boot normally:rndseed /root/entropy-file;boot netbsd
> >
> > and changed my /etc/rc.conf to use the random_file as above
> >
> > random_file=/root/entropy-file
> >
> > I verified that this works ("stop" creates the file, "start" removes it)
> >
> > and rebooted, but it still produces warning messages (the "sysctl" one
> > during dev_mkdb, and the "kernel" one during fetchmail)
> >
> > ..so what is not working?
>
> my kernel is based on MONOLITHIC, so "no options MODULAR" is present..
> this means, I think, that because the random seed loader is
> piggybacked into the module system then although the bootloader loads the
> random seed file just fine, it never gets processed..
>
> I note though, that the /etc/rc.d/random_seed file still says
>
> Loaded entropy from disk.
>
> during the boot process (it shows up in /var/run/rc.log, and the entropy
> file is removed) so I wonder why I still get warning messages?
The warning messages are produced, because the random generator is created
before there is any entropy, and since in the meantime some entropy has
been either generated or loaded, a rekeying is performed which seems
logical. But, I do think that since this is by design and entropy was
available before any data was requested, then this warning is spurious,
and should be suppressed in that case.
By the way there seems to be another bug here; it looks to me that the
cprng_strong() function returns no random data at all in this situation,
but does not actually indicate that, is that correct?
and note also that the cprng_strong32() and cprng_strong64() functions
would also be affected by that, since the kern_cprng generator is marked
with CPRNG_REKEY_ANY .. and those at least dont have any way to return
failure
regards,
iain