[nitpicking] abort in arc4random?

2014-12-17 Thread Lorenzo Beretta
getentropy*.c: cannot call abort() because some systems have unsafe 
corefiles

arc4random.c: if(_rs_allocate(...) == -1) abort();

Am I missing any difference between the two cases? 
(brain,cvsweb,google+gmane weren't any help)




Re: improve srandomdev

2014-07-16 Thread Lorenzo Beretta

On 07/13/2014 06:31 PM, Jean-Philippe Ouellet wrote:

On Sun, Jul 13, 2014 at 04:03:53PM +0200, Brent Cook wrote:

On Jul 13, 2014, at 3:58 PM, Ted Unangst t...@tedunangst.com wrote:

@@ -411,6 +404,9 @@ static long
random_l(void)
{
int32_t i;
+
+   if (use_arc4random)
+   return arc4random()  0x7fff;


return arc4random() % ((unsigned)RAND_MAX + 1) ?


No. RAND_MAX is for rand() not random().

 From posix for random():
 The random() function shall use a non-linear additive feedback
 random-number generator employing a default state array size of
 31 long integers to return successive pseudo-random numbers in
 the range from 0 to 2^31 - 1.

This fwiw means that srandomdev needed fixing anyway, since a LFG needs 
at least one of the elements in the stare array to be odd (or, since 
random right shifts one position, at least one element with one of the 
two lowest bits set).
True, the chances of both happening are __ridiculously__ small, but hey, 
aren't openbsd devs paranoid? :)