summaryrefslogtreecommitdiff
path: root/sys/libkern/arc4random.c
Commit message (Collapse)AuthorAgeFilesLines
* Lock down arc4random so it can be safely called w/o Giant.Mike Silbersack2003-08-151-17/+26
| | | | | | | | | Minor code reorganization was required, but the only functional change was that the first 1024 bytes of output are thrown out after each reseed, rather than just the initial seed. Notes: svn path=/head/; revision=118938
* Use __FBSDID().David E. O'Brien2003-06-111-2/+3
| | | | Notes: svn path=/head/; revision=116189
* Slight overhaul of arc4random() and friends.Poul-Henning Kamp2002-10-111-22/+27
| | | | | | | | | | | | | | | | | | | | | | One bug fixed: Use getmicrouptime() to trigger reseeds so that we cannot be tricked by a clock being stepped backwards. Express parameters in natural units and with natural names. Don't use struct timeval more than we need to. Various stylistic and readability polishing. Introduce arc4rand(void *ptr, u_int len, int reseed) function which returns a stream of pseudo-random bytes, observing the automatic reseed criteria as well as allowing forced reseeds. Rewrite arc4random() in terms of arc4rand(). Sponsored by: DARPA & NAI Labs. Notes: svn path=/head/; revision=104900
* Fixed some typos, verboseness and misformatting in comments.Bruce Evans2001-08-301-10/+8
| | | | Notes: svn path=/head/; revision=82565
* Minor improvements to arc4random():Mike Silbersack2001-08-301-4/+29
| | | | | | | | | | | | | | - Decrease reseeding interval from every 64 to every 16384 runs to reduce entropy usage. - Add time based reseeding. (Every 5 minutes.) - Throw away the first 256 words of output as suggested in "Weaknesses in the Key Scheduling Algorithm of RC4." Reviewed by: Mark Murray MFC After: jkh says ok Notes: svn path=/head/; revision=82543
* Recouple arc4random(9) to the entropy device. This works whether theMark Murray2000-12-021-2/+4
| | | | | | | | | | entropy device is loaded or not. If the entropy device is NOT loaded, the the quality of perturbations supplied by this will suffer. Notes: svn path=/head/; revision=69520
* Back out previous revision now that sys/random.h is properly fixed.John Baldwin2000-09-111-2/+0
| | | | Notes: svn path=/head/; revision=65754
* Add #include's of sys/proc.h and sys/param.h to silence a warning.John Baldwin2000-09-111-0/+2
| | | | Notes: svn path=/head/; revision=65724
* Comment out unavailable call. This needs to be revisited when the entropyMark Murray2000-06-251-3/+4
| | | | | | | | device is complete. Reviewed by: dfr Notes: svn path=/head/; revision=62072
* In the extremely miniscule chance that read_random returns <= 0, don't tryDan Moschuk1999-11-291-2/+6
| | | | | | | and use that return code as a modulus (panics are bad, mmmkay?) Notes: svn path=/head/; revision=53893
* Address the concerns of the ``randomness'' of the initial PRNG. Now, weDan Moschuk1999-11-281-14/+32
| | | | | | | | | | use bits from /dev/random to stir the S-box. Also add an internal counter to keep the S-box stirred on a regular basis. Reviewed by: msmith Notes: svn path=/head/; revision=53864
* Introduce OpenBSD-like Random PIDs. Controlled by a sysctl knobDan Moschuk1999-11-281-0/+89
(kern.randompid), which is currently defaulted off. Use ARC4 (RC4) for our random number generation, which will not get me executed for violating crypto laws; a Good Thing(tm). Reviewed and Approved by: bde, imp Notes: svn path=/head/; revision=53842