OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
CVS: cvs.openbsd.org: src

From: Otto Moerbeek (ottocvs.openbsd.org)
Date: Sun Mar 16 2008 - 14:47:44 CDT


CVSROOT: /cvs
Module name: src
Changes by: ottocvs.openbsd.org 2008/03/16 13:47:43

Modified files:
        lib/libc/crypt : arc4random.3 arc4random.c
        include : stdlib.h

Log message:
diff from djm committed at his request:

introduce two new APIs for requesting strong random numbers:

arc4random_buf() - fill an arbitrary memory range with random numbers

arc4random_uniform() - return a uniformly distributed random number
below
a specified upper bound, avoiding the bias that comes from a naive
"arc4random() % upper_bound" construction.

these mirror similarly-named functions in the kernel;
lots of discussion deraadt mcbride