summaryrefslogtreecommitdiff
path: root/sys/dev/random
Commit message (Collapse)AuthorAgeFilesLines
* This commit was manufactured by cvs2svn to create tagrelease/5.5.0_cvscvs2svn2006-05-2310-10/+10
| | | | | | 'RELENG_5_5_0_RELEASE'. This commit was manufactured to restore the state of the 5.5-RELEASE image.
* MFC 1.3: check that we have at least a 586 class CPU before probingIan Dowse2005-02-121-0/+3
| | | | | | | | | for Nehemiah random number generation hardware. PR: i386/75686 Notes: svn path=/stable/5/; revision=141748
* Merge randomdev_soft.c:1.5, 1.6, 1.7 from HEAD to RELENG_5:Robert Watson2004-11-291-58/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ---------------------------- revision 1.7 date: 2004/11/03 10:02:50; author: rwatson; state: Exp; lines: +11 -14 (1) Move from O(n) list copies to O(1) list concatenation, which is supported for STAILQ via STAILQ_CONCAT(). (2) Maintain a count of the number of entries in the thread-local entropy fifo so that we can keep the other fifo counts in synch. MFC after: 3 weeks MFC with: randomdev_soft.c revisions 1.5 and 1.6 Suggested by: jhb (1) ---------------------------- revision 1.6 date: 2004/10/12 14:57:14; author: rwatson; state: Exp; lines: +6 -0 Assert that the entropy source category provided by a caller submitting entropy is valid, as an invalid source will cause dereferencing of an array of queues to an incorrect memory location. ---------------------------- revision 1.5 date: 2004/10/09 22:04:13; author: rwatson; state: Exp; lines: +41 -50 Modify entropy harvesting locking strategy: - Trade off granularity to reduce overhead, since the current model doesn't appear to reduce contention substantially: move to a single harvest mutex protecting harvesting queues, rather than one mutex per source plus a mutex for the free list. - Reduce mutex operations in a harvesting event to 2 from 4, and maintain lockless read to avoid mutex operations if the queue is full. - When reaping harvested entries from the queue, move all entries from the queue at once, and when done with them, insert them all into a thread-local queue for processing; then insert them all into the empty fifo at once. This reduces O(4n) mutex operations to O(2) mutex operations per wakeup. In the future, we may want to look at re-introducing granularity, although perhaps at the granularity of the source rather than the source class; both the new and old strategies would cause contention between different instances of the same source (i.e., multiple network interfaces). Reviewed by: markm Also merge subr_witness.c:1.182 from HEAD to RELENG_5: date: 2004/10/11 08:26:18; author: rwatson; state: Exp; lines: +1 -2 Add entropy harvest mutex to hard-coded spin lock witness lock order, remove previous entropy harvesting mutex names as they are no longer present. Commit to this file was ommitted when randomdev_soft.c:1.5 was made. Feet shot: Robert Huff <roberthuff at rcn dot com> Notes: svn path=/stable/5/; revision=138182
* MFC: Don't adjust the random device kthread's priority to PUSER whenJohn Baldwin2004-11-241-2/+4
| | | | | | | sleeping. Notes: svn path=/stable/5/; revision=138050
* Perform a lockless read to test whether an entropy havesting fifo isRobert Watson2004-08-111-0/+4
| | | | | | | | | | | | | full, avoiding the cost of mutex operations if it is. We re-test once the mutex is acquired to make sure it's still true before doing the -modify-write part of the read-modify-write. Note that due to the maximum fifo depth being pretty deep, this is unlikely to improve harvesting performance yet. Approved by: markm Notes: svn path=/head/; revision=133465
* Add module versions.Mark Murray2004-08-021-0/+1
| | | | Notes: svn path=/head/; revision=133036
* Start the entropy device insecure/unblocked. I'll be handing overMark Murray2004-07-182-5/+3
| | | | | | | | | | responsibility for critical randomness requirements (like sshd) to rc.d/* Requested by: many Notes: svn path=/head/; revision=132346
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPPoul-Henning Kamp2004-07-151-0/+4
| | | | | | | | | | | for unknown events. A number of modules return EINVAL in this instance, and I have left those alone for now and instead taught MOD_QUIESCE to accept this as "didn't do anything". Notes: svn path=/head/; revision=132199
* Trim a few things from the dmesg output and stick them under bootverbose toJohn Baldwin2004-07-011-1/+3
| | | | | | | | | | cut down on the clutter including PCI interrupt routing, MTRR, pcibios, etc. Discussed with: USENIX Cabal Notes: svn path=/head/; revision=131398
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-6/+6
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Add some missing <sys/module.h> includes which are masked by thePoul-Henning Kamp2004-05-301-0/+1
| | | | | | | one on death-row in <sys/kernel.h> Notes: svn path=/head/; revision=129876
* Add a Davies-Meyer style hash to the output. This is still pureMark Murray2004-04-171-11/+123
| | | | | | | | | | | Nehemiah chip, but the work is all done in hardware. There are three opportunities to add other entropy; the Data Buffer, the Cipher's IV and the Cipher's key. A future commit will exploit these opportunities. Notes: svn path=/head/; revision=128368
* More removal of the abortive locking code; malloc buffers whenMark Murray2004-04-171-4/+12
| | | | | | | needed, rather than potentially reusing contents. Notes: svn path=/head/; revision=128367
* Attempts to make this device Giant-free were ill-conceived asMark Murray2004-04-162-14/+9
| | | | | | | | | | | uiomove(9) is not properly locked. So, return to NEEDGIANT mode. Later, when uiomove is finely locked, I'll revisit. While I'm here, provide some temporary debugging output to help catch blocking startups. Notes: svn path=/head/; revision=128321
* Default to harvesting everything. This is to help give a fasterMark Murray2004-04-162-4/+4
| | | | | | | | startup. harvesting can be turned OFF in etc/rc.d/* if it is a burden. Notes: svn path=/head/; revision=128320
* Fix "sleeping without a mutex" panic.Mark Murray2004-04-121-3/+6
| | | | Notes: svn path=/head/; revision=128151
* Fix pc98 build.Yoshihiro Takahashi2004-04-111-3/+3
| | | | Notes: svn path=/head/; revision=128109
* Reorganise the entropy device so that high-yield entropy sourcesMark Murray2004-04-0912-421/+788
| | | | | | | | | | can more easily be used INSTEAD OF the hard-working Yarrow. The only hardware source used at this point is the one inside the VIA C3 Nehemiah (Stepping 3 and above) CPU. More sources will be added in due course. Contributions welcome! Notes: svn path=/head/; revision=128059
* kthread_exit() no longer requires Giant, so don't force callers to acquireJohn Baldwin2004-03-051-1/+0
| | | | | | | | | Giant just to call kthread_exit(). Requested by: many Notes: svn path=/head/; revision=126674
* Device megapatch 4/6:Poul-Henning Kamp2004-02-211-0/+2
| | | | | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. Notes: svn path=/head/; revision=126080
* Correct the cleanup of the alias dev_t for /dev/urandom: being anPoul-Henning Kamp2004-02-121-3/+1
| | | | | | | | | | alias it depends on the aliased dev_t and disappears automatically when that is removed. Submitted by: "Bjoern A. Zeeb" <bzeeb+freebsd@zabbadoz.net> Notes: svn path=/head/; revision=125746
* Fix a major faux pas of mine. I was causing 2 very bad things toMark Murray2003-11-201-12/+56
| | | | | | | | | | | | | | | | | | happen in interrupt context; 1) sleep locks, and 2) malloc/free calls. 1) is fixed by using spin locks instead. 2) is fixed by preallocating a FIFO (implemented with a STAILQ) and using elements from this FIFO instead. This turns out to be rather fast. OK'ed by: re (scottl) Thanks to: peter, jhb, rwatson, jake Apologies to: * Notes: svn path=/head/; revision=122917
* Overhaul the entropy device:Mark Murray2003-11-175-123/+101
| | | | | | | | | | | | | | | | | | | | | o Each source gets its own queue, which is a FIFO, not a ring buffer. The FIFOs are implemented with the sys/queue.h macros. The separation is so that a low entropy/high rate source can't swamp the harvester with low-grade entropy and destroy the reseeds. o Each FIFO is limited to 256 (set as a macro, so adjustable) events queueable. Full FIFOs are ignored by the harvester. This is to prevent memory wastage, and helps to keep the kernel thread CPU usage within reasonable limits. o There is no need to break up the event harvesting into ${burst} sized chunks, so retire that feature. o Break the device away from its roots with the memory device, and allow it to get its major number automagically. Notes: svn path=/head/; revision=122871
* - Implement selwakeuppri() which allows raising the priority of aSeigo Tanimura2003-11-091-1/+1
| | | | | | | | | | | | | | | | thread being waken up. The thread waken up can run at a priority as high as after tsleep(). - Replace selwakeup()s with selwakeuppri()s and pass appropriate priorities. - Add cv_broadcastpri() which raises the priority of the broadcast threads. Used by selwakeuppri() if collision occurs. Not objected in: -arch, -current Notes: svn path=/head/; revision=122352
* Make sure we get all user-written input. This simplifies theMark Murray2003-11-021-14/+5
| | | | | | | | | | code considerably. Submitted by: (forgotten) [I'll happily acknowledge the submitter if he owns up!] Notes: svn path=/head/; revision=121895
* Use __FBSDID().David E. O'Brien2003-08-244-4/+12
| | | | | | | Also some minor style cleanups. Notes: svn path=/head/; revision=119418
* Change the sleep identifier to "-" where random normally sleeps.Poul-Henning Kamp2003-07-021-1/+1
| | | | Notes: svn path=/head/; revision=117149
* Gigacommit to improve device-driver source compatibility betweenPoul-Henning Kamp2003-03-031-14/+8
| | | | | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl) Notes: svn path=/head/; revision=111815
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-2/+2
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove srandom():Andrey A. Chernov2003-02-051-6/+1
| | | | | | | | | | | 1) It is already called in init_main.c:proc0_post() 2) It is called each time read_random_phony() called, because "initialized" variable is never set to 1. Approved by: markm Notes: svn path=/head/; revision=110404
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-2/+2
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Fix a buffer overrun in /dev/random which, due to the nature of theMark Murray2002-12-121-3/+4
| | | | | | | | | | | | kernel memory allocator, is harmless. This could be a problem for other systems, though. I've modified Darren's patch a little. Original patch by: Darren Schack, Isilon Systems, Inc <darrens@isilon.com> Also analysed by: SGI, and in particular Divy Le Ray of SGI OK'ed by: re(rwatson) Notes: svn path=/head/; revision=107789
* Some kernel threads try to do significant work, and the default KSTACK_PAGESScott Long2002-10-021-1/+1
| | | | | | | | | | | | | | | | doesn't give them enough stack to do much before blowing away the pcb. This adds MI and MD code to allow the allocation of an alternate kstack who's size can be speficied when calling kthread_create. Passing the value 0 prevents the alternate kstack from being created. Note that the ia64 MD code is missing for now, and PowerPC was only partially written due to the pmap.c being incomplete there. Though this patch does not modify anything to make use of the alternate kstack, acpi and usb are good candidates. Reviewed by: jake, peter, jhb Notes: svn path=/head/; revision=104354
* Remove #ifdef'ed Giant mutex wrappers round debugging statements.Mark Murray2002-09-212-10/+0
| | | | Notes: svn path=/head/; revision=103765
* No functional change. Fix comments and whitespace.Mark Murray2002-09-211-4/+3
| | | | Notes: svn path=/head/; revision=103763
* Upgrade the random device to use a "real" hash instead of buildingMark Murray2002-07-153-54/+11
| | | | | | | | | | | | | one out of a block cipher. This has 2 advantages: 1) The code is _much_ simpler 2) We aren't committing our security to one algorithm (much as we may think we trust AES). While I'm here, make an explicit reseed do a slow reseed instead of a fast; this is in line with what the original paper suggested. Notes: svn path=/head/; revision=100082
* Fix really dumb braino of mine; cast a sizeof() to an int, which it isMark Murray2002-04-211-1/+1
| | | | | | | being compared to, not size_t, which it already is. Notes: svn path=/head/; revision=95197
* Change callers of mtx_init() to pass in an appropriate lock type name. InJohn Baldwin2002-04-041-1/+1
| | | | | | | | | | most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64 Notes: svn path=/head/; revision=93818
* Change the suser() API to take advantage of td_ucred as well as do aJohn Baldwin2002-04-011-2/+2
| | | | | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@ Notes: svn path=/head/; revision=93593
* Provide infrastructure for harvesting SWI entropy.Mark Murray2002-03-031-0/+3
| | | | Notes: svn path=/head/; revision=91601
* Massive lint-inspired cleanup.Mark Murray2002-03-036-70/+84
| | | | | | | | | | Remove unneeded includes. Deal with unused function arguments. Resolve a boatload of signed/unsigned imcompatabilities. Etc. Notes: svn path=/head/; revision=91600
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredJohn Baldwin2002-02-271-2/+2
| | | | | | | reference. Notes: svn path=/head/; revision=91406
* Staticise the random_state array.Mike Smith2002-01-102-5/+3
| | | | | | | Reviewed by: markm Notes: svn path=/head/; revision=89170
* o Modify open() and close() for /dev/random to use securelevel_gt() insteadRobert Watson2001-09-261-6/+16
| | | | | | | | | of direct securelevel variable checks. Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=83976
* Use the passed in thread to selrecord() instead of curthread.John Baldwin2001-09-211-1/+1
| | | | Notes: svn path=/head/; revision=83805
* KSE Milestone 2Julian Elischer2001-09-121-7/+8
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Fix a minor buglet/typo here that gcc3 complains about.Peter Wemm2001-09-101-1/+1
| | | | Notes: svn path=/head/; revision=83267
* Fix type warnings.Mark Murray2001-07-201-4/+8
| | | | | | | PR: 29101 Notes: svn path=/head/; revision=80032
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inMark Murray2001-05-011-6/+8
| | | | | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations) Notes: svn path=/head/; revision=76166
* Catch up to header include changes:John Baldwin2001-03-282-0/+2
| | | | | | | | - <sys/mutex.h> now requires <sys/systm.h> - <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h> Notes: svn path=/head/; revision=74914