summaryrefslogtreecommitdiff
path: root/src/lib/libc/crypt/arc4random.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* fix math screwup that reintroduced a bias for upper_bounds in rangedjm2008-06-041-2/+2
| | | | | | | (2^30,2^31). Nothing in the tree yet requests random numbers bounded by this range. report jakob!deraadt; ok deraadt@
* diff from djm@ committed at his request:otto2008-03-161-1/+63
| | | | | | | | | | | | | | 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@
* - make arc4random*() functions thread safe. Use a custom spinlock functionkurt2008-01-011-41/+56
| | | | | | | | | | | instead of the generic pthread macros since free(3) uses __arc4_getbyte() when freeing small sized allocations and the generic pthread macros call malloc(3). - eliminate passing pointers to a static variable with global scope (rs) for additional code clarity and reduction. - shlib minor bumps for libc and libpthread due to new functions. From andreas@ with some bits from me. okay tedu@ marc@ w/some spot checking from millert@
* provide an libc internal interface to get random bytes, to be used by mallocotto2007-02-121-3/+12
| | | | to get random data without calling getpid(), ok millert@ deraadt@
* Use sysctl(KERN_ARND) to get n bytes, instead of just 4 at a timeotto2005-11-301-9/+2
| | | | | | | and remove fallback code. If somebody is dumb enough to make the sysctl fail using systrace, he deserves what he gets. Saves 7 syscalls on process startup. looks good miod@ ok deraadt@ tedu@
* Change email address for author, at his request.kjell2005-06-061-2/+2
|
* Change license to standard OpenBSD boilerplate, with permissionkjell2005-06-061-6/+15
| | | | from original author (David Mazieres)
* use the new fat random sysctl to get initial state. (fallback to looping).tedu2005-06-041-12/+14
| | | | stir after eating 400000 words. ok + input deraadt
* kill spaceshshoexer2004-11-021-3/+3
| | | | ok djm@
* Discard first 256 bytes of keystream, as per recommendation indjm2003-11-261-1/+10
| | | | | "Weaknesses in the Key Scheduling Algorithm of RC4", Fluhrer, Mantin and Shamir. ok itojun@
* just use sysctl for stirring. thread safe and can't fail.tedu2003-08-161-23/+10
| | | | ok deraadt and co.
* ansification; checked by pvalderaadt2003-06-111-18/+9
|
* re-stir if pid changes; markus & mederaadt2003-02-141-3/+5
|
* License clarification from David Mazieres, ok deraadt@pvalchev2001-06-051-3/+2
|
* Set j = i after arc4random key schedule to be more like arc4 stream cipher;deraadt1999-09-281-1/+2
| | | | from conversations between various people
* if /dev/arandom is not available for seeding, use data from sysctlprovos1999-06-291-5/+22
| | | | kern.arandom.
* $OpenBSD$niklas1998-03-221-1/+1
|
* Clean up some -Wall flowers.millert1997-07-091-2/+3
|
* arc4random() number generator, for use with things like RPC xid's.dm1996-12-281-0/+175