yarrow random generator



Hello guys,

I've looked at FreeBSD 8.0 cryptographically secure pseudorandom
numbers generator and have a question. It looks like a bug but I'am
not sure.

In file sys/dev/randomdev.c, function random_read:

if (!random_systat.seeded)
error = (*random_systat.block)(flag);

It blocks until PRNG is seeded. For software random generator implementation
block method looks as follows, sys/dev/randomdev_soft.c:

random_yarrow_block(int flag)
{
int error = 0;

mtx_lock(&random_reseed_mtx);

/* Blocking logic */
while (random_systat.seeded && !error) {
if (flag & O_NONBLOCK)
error = EWOULDBLOCK;
else {
printf("Entropy device is blocking.\n");
error = msleep(&random_systat,
&random_reseed_mtx,
PUSER | PCATCH, "block", 0);
}
}
mtx_unlock(&random_reseed_mtx);

return error;
}

It seems that random_systat.seeded in "while" condition should be negated.
Or it will never block actually, or block erroneously until next reseed
(under very rare
conditions)

Am I right?

Thanks.
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: yarrow random generator
    ... I've looked at FreeBSD 8.0 cryptographically secure pseudorandom ... numbers generator and have a question. ... It looks like a bug but I'am ...
    (freebsd-hackers)
  • RE: Iterating generator from C (PostgreSQLs pl/python RETUN SETOF/RECORD iterator support broken on
    ... The actual calls to iterator come through a pl/python framework, ... Then there is no other way than to report the bug, ... to update things after the fix. ... of our generic enchancement (using a built-in generator, ...
    (comp.lang.python)
  • Re: scope of generators, class variables, resulting in global na
    ... Here is the link to the bug report from which the discussion in PEP ... but of the current translation of generator expressions to ... And also your example when defining a generator expression in a class ...
    (comp.lang.python)
  • Re: Iterating generator from C
    ... generator without hitting this bug? ... This would be possible if you can control how the ... I'm trying to improve PostgreSQL's stored procedure language PL/Python and this software can be used everywhere. ... It would make the bug even more resistent :-) ...
    (comp.lang.python)
  • Re: What can kill a voltage regulator?
    ... I have tried one of those Bosch solid state volt regs with success on a '71 ... I usually polarize the generator and suggest you do that to your current one ... reg were built new by BOSCH, they were built in Mexico, ... but I'm still getting use to the quarks of this bug (I had a '68 for ...
    (rec.autos.makers.vw.aircooled)