Commit Graph

24 Commits

Author SHA1 Message Date
tls 3afd44cf08 First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>.  This change includes
the following:

	An initial cleanup and minor reorganization of the entropy pool
	code in sys/dev/rnd.c and sys/dev/rndpool.c.  Several bugs are
	fixed.  Some effort is made to accumulate entropy more quickly at
	boot time.

	A generic interface, "rndsink", is added, for stream generators to
	request that they be re-keyed with good quality entropy from the pool
	as soon as it is available.

	The arc4random()/arc4randbytes() implementation in libkern is
	adjusted to use the rndsink interface for rekeying, which helps
	address the problem of low-quality keys at boot time.

	An implementation of the FIPS 140-2 statistical tests for random
	number generator quality is provided (libkern/rngtest.c).  This
	is based on Greg Rose's implementation from Qualcomm.

	A new random stream generator, nist_ctr_drbg, is provided.  It is
	based on an implementation of the NIST SP800-90 CTR_DRBG by
	Henric Jungheim.  This generator users AES in a modified counter
	mode to generate a backtracking-resistant random stream.

	An abstraction layer, "cprng", is provided for in-kernel consumers
	of randomness.  The arc4random/arc4randbytes API is deprecated for
	in-kernel use.  It is replaced by "cprng_strong".  The current
	cprng_fast implementation wraps the existing arc4random
	implementation.  The current cprng_strong implementation wraps the
	new CTR_DRBG implementation.  Both interfaces are rekeyed from
	the entropy pool automatically at intervals justifiable from best
	current cryptographic practice.

	In some quick tests, cprng_fast() is about the same speed as
	the old arc4randbytes(), and cprng_strong() is about 20% faster
	than rnd_extract_data().  Performance is expected to improve.

	The AES code in src/crypto/rijndael is no longer an optional
	kernel component, as it is required by cprng_strong, which is
	not an optional kernel component.

	The entropy pool output is subjected to the rngtest tests at
	startup time; if it fails, the system will reboot.  There is
	approximately a 3/10000 chance of a false positive from these
	tests.  Entropy pool _input_ from hardware random numbers is
	subjected to the rngtest tests at attach time, as well as the
	FIPS continuous-output test, to detect bad or stuck hardware
	RNGs; if any are detected, they are detached, but the system
	continues to run.

	A problem with rndctl(8) is fixed -- datastructures with
	pointers in arrays are no longer passed to userspace (this
	was not a security problem, but rather a major issue for
	compat32).  A new kernel will require a new rndctl.

	The sysctl kern.arandom() and kern.urandom() nodes are hooked
	up to the new generators, but the /dev/*random pseudodevices
	are not, yet.

	Manual pages for the new kernel interfaces are forthcoming.
2011-11-19 22:51:18 +00:00
dyoung 1ef37665bc Change spaces to tabs and remove some unnecessary parentheses. No
functional change intended.
2009-09-04 18:10:08 +00:00
dyoung 786bda7e17 Expand <dev/usb/usb_port.h> definitions, and lightly unifdef(1). 2009-09-04 17:53:12 +00:00
dyoung 0089c8a0c9 Cosmetic: good-bye, excessive #ifdef'age. 2008-05-22 01:21:18 +00:00
is 257a88e757 Move from workqueue to an explicit kthread for setting the multicast
filter, as suggested by cube@. Actual code review by cube@.
This way, a backport of the fix to netbsd-4 is possible.
2008-01-16 12:33:54 +00:00
cube 55f21981d9 workqueue(9) has the non-evident limitation that the caller cannot reuse
the same struct work before workqueue(9) has internally started to work on
the task.

So to make sure that doesn't happen, provide a semaphore not to run the
workqueue multiple times.  It might be clearer just skip using workqueue(9)
and use a thread for about everything, but oh well, I leave that to
someone else.

Now is@ can yank his USB-to-Ethernet adapter while the interface is up.
2008-01-12 22:32:51 +00:00
ad 5a24480bf8 lockmgr -> mutex 2007-12-05 07:15:53 +00:00
is a2f7b2e007 aue_ioctl() for the murpose of adding/deleting multicast addresses is called
from interupt context. Defer its processing to a workqueue(9).
This fixes PR 34521.
2006-09-15 10:47:34 +00:00
augustss a969ff5460 Add a reference counter to avoid blowing away the softc while frobbing
the MII registers.
2001-10-10 02:14:16 +00:00
augustss cc0b3cc208 Add support for Pegasus II adapters (from Linux).
Add a bunch of adapters.
2001-07-16 18:33:13 +00:00
augustss cbcea5e84c Do mii frobbing in process context.
Now we can finally get rid of the evil USBD_NO_TSLEEP hack in the aue driver.
2001-04-13 11:17:11 +00:00
augustss 26f708a5a3 Handle the Linksys USB100H1 like the other Linksys adapters.
Restructure the code a little.
2000-05-06 20:38:59 +00:00
augustss a94b555441 Put a ratecheck on error messages from the interrupt pipe. 2000-04-04 20:16:19 +00:00
augustss 2c3137dc38 Add forgotten OpenBSD fix. 2000-03-30 16:38:55 +00:00
augustss a25e27e1eb Some OpenBSD portability fixes. 2000-03-29 18:24:52 +00:00
augustss c06b1c683d Remove unused macros. 2000-03-24 22:13:23 +00:00
augustss 0069eba19b Some cleanup and renaming of the callouts used in USB drivers. 2000-03-24 22:03:28 +00:00
thorpej fc96443d15 New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
  resource allocation.
- Insertion and removal of callouts is constant time, important as
  this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
2000-03-23 07:01:25 +00:00
augustss 3218dd992d Protect the use of bpf_mtap so bpf isn't needed.
aue: Limit the number of error messages at disconnect by using ratecheck().
2000-03-01 19:00:51 +00:00
augustss 6fa8665eeb Handle detach that happens before attach has finished. (Reported by mycroft.) 2000-02-17 18:42:21 +00:00
augustss aae9ac7e11 Generate usb events on attach and detach.
Handle rnd stuff correctly.
2000-02-02 13:19:44 +00:00
augustss 9cd4bf4652 Remove the hack that handled truncated transfers. 2000-01-28 00:29:53 +00:00
augustss 8d1b47c24d Poll the interrupt pipe every 100 ms instead of every 1 ms. The interrupt
pipe is only used to collect statistics so it seems rather stupid to bog
down the processor by doing this every ms.
2000-01-19 00:25:23 +00:00
augustss b4e8010107 Add initial version of a driver for the ADMtek AN986 Pegasus USB to
Ethernet chip.
Written by Bill Paul, <wpaul@ee.columbia.edu>, for FreeBSD.
Massaged by Lennart Augustsson.
XXX Needs a thread to avoid a the gruesome USBD_NO_TSLEEP hack.
2000-01-16 13:45:56 +00:00