summaryrefslogtreecommitdiffstats
path: root/sys/dev/random
Commit message (Collapse)AuthorAgeFilesLines
* Rename the kthread_xxx (e.g. kthread_create()) callsjulian2007-10-202-3/+3
| | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls.
* Don't save SYSCTL_ADD_*() results in a local variable just to throw themrwatson2007-05-281-15/+9
| | | | | | | | away; preserve the ones that are needed for further calls in the init function and ignore the rest entirely. Found with: Coverity Prevent(tm) CID: 563
* Rather than repeatedly setting and discarding local variable 'o' basedrwatson2007-05-271-9/+7
| | | | | | | | on the return values of various run-time sysctl additions, just ignore the return value. Found with: Coverity Prevent(tm) CID: 562
* Use pause() rather than tsleep() on stack variables and function pointers.jhb2007-02-271-1/+1
|
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-061-1/+2
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Now even more style(9)ish.mr2006-07-131-1/+1
| | | | Submitted by: pjd
* Use the already stored VIA RNG probe informationmr2006-07-131-1/+1
| | | | | | | | instead of probing again. Adjust style(9) somewhat in probe.c Reviewed by: pjd MFC after: 1 week
* Use the already stored VIA RNG probe informationmr2006-07-121-13/+4
| | | | | | instead of probing again. MFC after: 1 week
* Change msleep() and tsleep() to not alter the calling thread's priorityjhb2006-04-171-4/+2
| | | | | | | | | | | | if the specified priority is zero. This avoids a race where the calling thread could read a snapshot of it's current priority, then a different thread could change the first thread's priority, then the original thread would call sched_prio() inside msleep() undoing the change made by the second thread. I used a priority of zero as no thread that calls msleep() or tsleep() should be specifying a priority of zero anyway. The various places that passed 'curthread->td_priority' or some variant as the priority now pass 0.
* Remove GIANT from device random.ps2005-12-206-16/+69
| | | | Submitted by: ups
* malloc.h relies on param.h for a definition of MAXCPU. I guess that there isscottl2005-05-301-0/+1
| | | | | other header pollution that makes this work right now, but it falls over when doing a RELENG_5 -> HEAD upgrade.
* Revert to the more correct array size, and correct a KASSERT tomarkm2005-03-291-2/+2
| | | | | | | | only allow proper values. ENTROPYSOURCE is a maxval+1, not an allowable number. Suggested loose protons in the solution: phk Prefers to keep the pH close to seven: markm
* Fix off-by-one (too little!) array size problem.phk2005-03-181-1/+1
| | | | Detected by: Coverity (ID#661)
* stop including rijndael-api-fst.h from rijndael.h.ume2005-03-112-2/+2
| | | | this is required to integrate opencrypto into crypto.
* netchild's mega-patch to isolate compiler dependencies into a centraljoerg2005-03-021-2/+2
| | | | | | | | | | | | | | | | place. This moves the dependency on GCC's and other compiler's features into the central sys/cdefs.h file, while the individual source files can then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42. By now, GCC and ICC (the Intel compiler) have been actively tested on IA32 platforms by netchild. Extension to other compilers is supposed to be possible, of course. Submitted by: netchild Reviewed by: various developers on arch@, some time ago
* Check that we have at least a 586-class CPU before calling do_cpuid().iedowse2005-02-061-0/+3
| | | | | | | | This fixes booting on a number of 486 processors. PR: i386/75686 Reviewed by: markm MFC after: 1 week
* Check O_NONBLOCK not IO_NDELAY.phk2004-12-222-3/+1
| | | | Don't include vnode.h
* Don't change the priority to PUSER when sleeping, just keep the currentjhb2004-11-051-2/+4
| | | | priority.
* (1) Move from O(n) list copies to O(1) list concatenation, which isrwatson2004-11-031-14/+11
| | | | | | | | | | | 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)
* Annotate that get_cyclecount() can be expensive on some platforms,rwatson2004-10-181-0/+4
| | | | | which juxtaposes nicely with the comment just above on how the harvest function must be cheap.
* Assert that the entropy source category provided by a caller submittingrwatson2004-10-121-0/+6
| | | | | entropy is valid, as an invalid source will cause dereferencing of an array of queues to an incorrect memory location.
* Modify entropy harvesting locking strategy:rwatson2004-10-091-50/+41
| | | | | | | | | | | | | | | | | | | | | | | | | - 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
* Perform a lockless read to test whether an entropy havesting fifo isrwatson2004-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
* Add module versions.markm2004-08-021-0/+1
|
* Start the entropy device insecure/unblocked. I'll be handing overmarkm2004-07-182-5/+3
| | | | | | | responsibility for critical randomness requirements (like sshd) to rc.d/* Requested by: many
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPphk2004-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".
* Trim a few things from the dmesg output and stick them under bootverbose tojhb2004-07-011-1/+3
| | | | | | | cut down on the clutter including PCI interrupt routing, MTRR, pcibios, etc. Discussed with: USENIX Cabal
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-6/+6
| | | | Bump __FreeBSD_version accordingly.
* Add some missing <sys/module.h> includes which are masked by thephk2004-05-301-0/+1
| | | | one on death-row in <sys/kernel.h>
* Add a Davies-Meyer style hash to the output. This is still puremarkm2004-04-171-12/+124
| | | | | | | | 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.
* More removal of the abortive locking code; malloc buffers whenmarkm2004-04-171-4/+12
| | | | needed, rather than potentially reusing contents.
* Attempts to make this device Giant-free were ill-conceived asmarkm2004-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.
* Default to harvesting everything. This is to help give a fastermarkm2004-04-162-4/+4
| | | | | startup. harvesting can be turned OFF in etc/rc.d/* if it is a burden.
* Fix "sleeping without a mutex" panic.markm2004-04-121-3/+6
|
* Fix pc98 build.nyan2004-04-111-3/+3
|
* Reorganise the entropy device so that high-yield entropy sourcesmarkm2004-04-0912-422/+789
| | | | | | | 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!
* kthread_exit() no longer requires Giant, so don't force callers to acquirejhb2004-03-051-1/+0
| | | | | | Giant just to call kthread_exit(). Requested by: many
* Device megapatch 4/6:phk2004-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.
* Correct the cleanup of the alias dev_t for /dev/urandom: being anphk2004-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>
* Fix a major faux pas of mine. I was causing 2 very bad things tomarkm2003-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: *
* Overhaul the entropy device:markm2003-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.
* - Implement selwakeuppri() which allows raising the priority of atanimura2003-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
* Make sure we get all user-written input. This simplifies themarkm2003-11-021-14/+5
| | | | | | | code considerably. Submitted by: (forgotten) [I'll happily acknowledge the submitter if he owns up!]
* Use __FBSDID().obrien2003-08-244-4/+12
| | | | Also some minor style cleanups.
* Change the sleep identifier to "-" where random normally sleeps.phk2003-07-021-1/+1
|
* Gigacommit to improve device-driver source compatibility betweenphk2003-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)
* Back out M_* changes, per decision of the TRB.imp2003-02-191-2/+2
| | | | Approved by: trb
* Remove srandom():ache2003-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
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-2/+2
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Fix a buffer overrun in /dev/random which, due to the nature of themarkm2002-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)
OpenPOWER on IntegriCloud