diff options
Diffstat (limited to 'sys')
82 files changed, 134 insertions, 524 deletions
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index dbd76d6..17990a3 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -295,7 +295,6 @@ device loop # Network loopback device random # Entropy device options PADLOCK_RNG # VIA Padlock RNG options RDRAND_RNG # Intel Bull Mountain RNG -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. diff --git a/sys/arm/conf/AC100 b/sys/arm/conf/AC100 index a3c6826..d368bdf 100644 --- a/sys/arm/conf/AC100 +++ b/sys/arm/conf/AC100 @@ -61,7 +61,6 @@ options MUTEX_DEBUG # Pseudo devices device random -options YARROW_RNG # Yarrow software RNG device pty device loop device md diff --git a/sys/arm/conf/ARMADAXP b/sys/arm/conf/ARMADAXP index f7be570..54aa635 100644 --- a/sys/arm/conf/ARMADAXP +++ b/sys/arm/conf/ARMADAXP @@ -61,7 +61,6 @@ options KDB_TRACE # Pseudo devices device random -options YARROW_RNG # Yarrow software RNG device pty device loop device md diff --git a/sys/arm/conf/ARNDALE b/sys/arm/conf/ARNDALE index 3bd8a2f..1864f33 100644 --- a/sys/arm/conf/ARNDALE +++ b/sys/arm/conf/ARNDALE @@ -88,7 +88,6 @@ options ROOTDEVNAME=\"ufs:/dev/da0\" device loop device random -options YARROW_RNG # Yarrow software RNG device pty device md device gpio diff --git a/sys/arm/conf/ATMEL b/sys/arm/conf/ATMEL index 6aa6a3e..eb3dd7d 100644 --- a/sys/arm/conf/ATMEL +++ b/sys/arm/conf/ATMEL @@ -134,7 +134,6 @@ device geom_map # GEOM partition mapping # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. diff --git a/sys/arm/conf/AVILA b/sys/arm/conf/AVILA index 9397f39..4246462 100644 --- a/sys/arm/conf/AVILA +++ b/sys/arm/conf/AVILA @@ -107,7 +107,6 @@ device if_bridge device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG # Wireless NIC cards device wlan # 802.11 support diff --git a/sys/arm/conf/BEAGLEBONE b/sys/arm/conf/BEAGLEBONE index b8f54c7..997a62f 100644 --- a/sys/arm/conf/BEAGLEBONE +++ b/sys/arm/conf/BEAGLEBONE @@ -90,7 +90,6 @@ device pty device snp device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG # I2C support device iicbus diff --git a/sys/arm/conf/BWCT b/sys/arm/conf/BWCT index 9df78e4..4c6a1f1 100644 --- a/sys/arm/conf/BWCT +++ b/sys/arm/conf/BWCT @@ -68,7 +68,6 @@ options NO_FFS_SNAPSHOT options NO_SWAPPING device loop device random -options YARROW_RNG # Yarrow software RNG device ether device vlan device uart diff --git a/sys/arm/conf/CAMBRIA b/sys/arm/conf/CAMBRIA index 43fde27..377f45d 100644 --- a/sys/arm/conf/CAMBRIA +++ b/sys/arm/conf/CAMBRIA @@ -110,7 +110,6 @@ device if_bridge device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG # Wireless NIC cards device wlan # 802.11 support diff --git a/sys/arm/conf/CNS11XXNAS b/sys/arm/conf/CNS11XXNAS index cb4c210..e66e2bb 100644 --- a/sys/arm/conf/CNS11XXNAS +++ b/sys/arm/conf/CNS11XXNAS @@ -102,7 +102,6 @@ device loop device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG #options ARM_USE_SMALL_ALLOC diff --git a/sys/arm/conf/CRB b/sys/arm/conf/CRB index 25ed432..d9b0a4e 100644 --- a/sys/arm/conf/CRB +++ b/sys/arm/conf/CRB @@ -105,7 +105,6 @@ options DDB #Enable the kernel debugger options XSCALE_CACHE_READ_WRITE_ALLOCATE device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG device iopwdog options ARM_USE_SMALL_ALLOC diff --git a/sys/arm/conf/CUBIEBOARD b/sys/arm/conf/CUBIEBOARD index f514244..179b383 100644 --- a/sys/arm/conf/CUBIEBOARD +++ b/sys/arm/conf/CUBIEBOARD @@ -92,7 +92,6 @@ device pty device snp device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG # I2C support #device iicbus @@ -131,3 +130,4 @@ device miibus options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=cubieboard.dts + diff --git a/sys/arm/conf/DB-78XXX b/sys/arm/conf/DB-78XXX index afe71af..f3e62f5 100644 --- a/sys/arm/conf/DB-78XXX +++ b/sys/arm/conf/DB-78XXX @@ -55,7 +55,6 @@ device pci device loop device md device random -options YARROW_RNG # Yarrow software RNG # Serial ports device uart diff --git a/sys/arm/conf/DB-88F5XXX b/sys/arm/conf/DB-88F5XXX index f113e30..50ca24e 100644 --- a/sys/arm/conf/DB-88F5XXX +++ b/sys/arm/conf/DB-88F5XXX @@ -54,7 +54,6 @@ device pci device md device loop device random -options YARROW_RNG # Yarrow software RNG # Serial ports device uart diff --git a/sys/arm/conf/DB-88F6XXX b/sys/arm/conf/DB-88F6XXX index f32aa59..cf508ad 100644 --- a/sys/arm/conf/DB-88F6XXX +++ b/sys/arm/conf/DB-88F6XXX @@ -55,7 +55,6 @@ device pci device loop device md device random -options YARROW_RNG # Yarrow software RNG # Serial ports device uart diff --git a/sys/arm/conf/DOCKSTAR b/sys/arm/conf/DOCKSTAR index 5142b84..25c0121 100644 --- a/sys/arm/conf/DOCKSTAR +++ b/sys/arm/conf/DOCKSTAR @@ -46,7 +46,6 @@ options KDB # Pseudo devices device md device random -options YARROW_RNG # Yarrow software RNG device loop # Serial ports diff --git a/sys/arm/conf/DREAMPLUG-1001 b/sys/arm/conf/DREAMPLUG-1001 index b39b636..442cde0 100644 --- a/sys/arm/conf/DREAMPLUG-1001 +++ b/sys/arm/conf/DREAMPLUG-1001 @@ -62,7 +62,6 @@ device loop #Network loopback device md #Memory/malloc disk device pty #BSD-style compatibility pseudo ttys device random #Entropy device -options YARROW_RNG # Yarrow software RNG device tun #Packet tunnel. device ether #Required for all ethernet devices device vlan #802.1Q VLAN support diff --git a/sys/arm/conf/EA3250 b/sys/arm/conf/EA3250 index 6fb0dfe..89d9fa4 100644 --- a/sys/arm/conf/EA3250 +++ b/sys/arm/conf/EA3250 @@ -54,7 +54,6 @@ device loop device md device pty device random -options YARROW_RNG # Yarrow software RNG # Serial ports device uart diff --git a/sys/arm/conf/EB9200 b/sys/arm/conf/EB9200 index b3ebc61..0570699 100644 --- a/sys/arm/conf/EB9200 +++ b/sys/arm/conf/EB9200 @@ -60,7 +60,6 @@ options SX_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING device random -options YARROW_RNG # Yarrow software RNG device loop device ether device uart diff --git a/sys/arm/conf/EFIKA_MX b/sys/arm/conf/EFIKA_MX index 07c0630..71edb8c 100644 --- a/sys/arm/conf/EFIKA_MX +++ b/sys/arm/conf/EFIKA_MX @@ -96,7 +96,6 @@ device bpf # Berkeley packet filter # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support #device vlan # 802.1Q VLAN support #device tun # Packet tunnel. diff --git a/sys/arm/conf/EP80219 b/sys/arm/conf/EP80219 index 1d6b87d..a112fe1 100644 --- a/sys/arm/conf/EP80219 +++ b/sys/arm/conf/EP80219 @@ -101,7 +101,6 @@ options DDB #Enable the kernel debugger options XSCALE_CACHE_READ_WRITE_ALLOCATE device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG options ARM_USE_SMALL_ALLOC # Floppy drives diff --git a/sys/arm/conf/ETHERNUT5 b/sys/arm/conf/ETHERNUT5 index 8a68249..ef52bc6 100644 --- a/sys/arm/conf/ETHERNUT5 +++ b/sys/arm/conf/ETHERNUT5 @@ -126,7 +126,6 @@ device geom_map # GEOM partition mapping # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support #device vlan # 802.1Q VLAN support #device tun # Packet tunnel. diff --git a/sys/arm/conf/GUMSTIX b/sys/arm/conf/GUMSTIX index b752daa..11fe6a9 100644 --- a/sys/arm/conf/GUMSTIX +++ b/sys/arm/conf/GUMSTIX @@ -88,4 +88,3 @@ options DDB #Enable the kernel debugger device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG diff --git a/sys/arm/conf/HL200 b/sys/arm/conf/HL200 index fb980ef..415cbc9 100644 --- a/sys/arm/conf/HL200 +++ b/sys/arm/conf/HL200 @@ -65,7 +65,6 @@ options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING device random -options YARROW_RNG # Yarrow software RNG device loop device ether device uart diff --git a/sys/arm/conf/HL201 b/sys/arm/conf/HL201 index a2eee41..1294f1a 100644 --- a/sys/arm/conf/HL201 +++ b/sys/arm/conf/HL201 @@ -67,7 +67,6 @@ options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING device random -options YARROW_RNG # Yarrow software RNG device loop device ether device uart @@ -130,3 +129,4 @@ device pass # Passthrough device (direct SCSI access) #device wlan_tkip # 802.11 TKIP support #device wlan_amrr # AMRR transmit rate control algorithm options ROOTDEVNAME=\"ufs:da0s1a\" + diff --git a/sys/arm/conf/IQ31244 b/sys/arm/conf/IQ31244 index 91fbe22..1eb4a20 100644 --- a/sys/arm/conf/IQ31244 +++ b/sys/arm/conf/IQ31244 @@ -106,7 +106,6 @@ options DDB #Enable the kernel debugger options XSCALE_CACHE_READ_WRITE_ALLOCATE device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG options ARM_USE_SMALL_ALLOC # Floppy drives diff --git a/sys/arm/conf/KB920X b/sys/arm/conf/KB920X index e8639b4..7cf56d8 100644 --- a/sys/arm/conf/KB920X +++ b/sys/arm/conf/KB920X @@ -66,7 +66,6 @@ options SX_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING device random -options YARROW_RNG # Yarrow software RNG device loop device ether device uart diff --git a/sys/arm/conf/LN2410SBC b/sys/arm/conf/LN2410SBC index e7ccc6e..8d2a585 100644 --- a/sys/arm/conf/LN2410SBC +++ b/sys/arm/conf/LN2410SBC @@ -62,7 +62,6 @@ options SX_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING device random -options YARROW_RNG # Yarrow software RNG device loop device ether @@ -84,3 +83,4 @@ device ohci device umass device scbus # SCSI bus (required for da) device da # Direct Access (disks) + diff --git a/sys/arm/conf/NSLU b/sys/arm/conf/NSLU index 43eee38..0980e4d 100644 --- a/sys/arm/conf/NSLU +++ b/sys/arm/conf/NSLU @@ -105,7 +105,6 @@ device loop device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG #options ARM_USE_SMALL_ALLOC diff --git a/sys/arm/conf/PANDABOARD b/sys/arm/conf/PANDABOARD index ae3b965..788a0ed 100644 --- a/sys/arm/conf/PANDABOARD +++ b/sys/arm/conf/PANDABOARD @@ -110,7 +110,6 @@ device md #options MD_ROOT_SIZE=7560 device random # Entropy device -options YARROW_RNG # Yarrow software RNG # USB support device usb diff --git a/sys/arm/conf/QILA9G20 b/sys/arm/conf/QILA9G20 index d0c5793..50d9a37 100644 --- a/sys/arm/conf/QILA9G20 +++ b/sys/arm/conf/QILA9G20 @@ -77,7 +77,6 @@ options NO_SWAPPING #options DIAGNOSTIC device random -options YARROW_RNG # Yarrow software RNG device loop device bpf device ether diff --git a/sys/arm/conf/RPI-B b/sys/arm/conf/RPI-B index f8d53f3..251bf55 100644 --- a/sys/arm/conf/RPI-B +++ b/sys/arm/conf/RPI-B @@ -86,7 +86,6 @@ options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG # USB support device usb diff --git a/sys/arm/conf/SAM9260EK b/sys/arm/conf/SAM9260EK index d48bb55..08b308d 100644 --- a/sys/arm/conf/SAM9260EK +++ b/sys/arm/conf/SAM9260EK @@ -134,7 +134,6 @@ device mmcsd # MMC/SD memory card # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support #device vlan # 802.1Q VLAN support #device tun # Packet tunnel. diff --git a/sys/arm/conf/SAM9G20EK b/sys/arm/conf/SAM9G20EK index dce47b6..e173f01 100644 --- a/sys/arm/conf/SAM9G20EK +++ b/sys/arm/conf/SAM9G20EK @@ -76,7 +76,6 @@ options NO_SWAPPING #options DIAGNOSTIC device random -options YARROW_RNG # Yarrow software RNG device loop device bpf device ether diff --git a/sys/arm/conf/SAM9X25EK b/sys/arm/conf/SAM9X25EK index 80337a8..6cdeac6 100644 --- a/sys/arm/conf/SAM9X25EK +++ b/sys/arm/conf/SAM9X25EK @@ -77,7 +77,6 @@ options NO_SWAPPING #options DIAGNOSTIC device random -options YARROW_RNG # Yarrow software RNG device pty device loop device bpf @@ -151,3 +150,4 @@ device miibus #device wlan_ccmp # 802.11 CCMP support #device wlan_tkip # 802.11 TKIP support #device wlan_amrr # AMRR transmit rate control algorithm + diff --git a/sys/arm/conf/SHEEVAPLUG b/sys/arm/conf/SHEEVAPLUG index 12634cc..c6bd901 100644 --- a/sys/arm/conf/SHEEVAPLUG +++ b/sys/arm/conf/SHEEVAPLUG @@ -45,7 +45,6 @@ options KDB # Pseudo devices device random -options YARROW_RNG # Yarrow software RNG device loop # Serial ports diff --git a/sys/arm/conf/SN9G45 b/sys/arm/conf/SN9G45 index c826723..123136b 100644 --- a/sys/arm/conf/SN9G45 +++ b/sys/arm/conf/SN9G45 @@ -76,7 +76,6 @@ options NO_SWAPPING #options DIAGNOSTIC device random -options YARROW_RNG # Yarrow software RNG device loop device bpf device ether diff --git a/sys/arm/conf/TS7800 b/sys/arm/conf/TS7800 index dd97791..79e9dba 100644 --- a/sys/arm/conf/TS7800 +++ b/sys/arm/conf/TS7800 @@ -48,7 +48,6 @@ device pci device md device loop device random -options YARROW_RNG # Yarrow software RNG # Serial ports device uart diff --git a/sys/arm/conf/VERSATILEPB b/sys/arm/conf/VERSATILEPB index f81653a..b12009dc0 100644 --- a/sys/arm/conf/VERSATILEPB +++ b/sys/arm/conf/VERSATILEPB @@ -94,7 +94,6 @@ options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required device md device random # Entropy device -options YARROW_RNG # Yarrow software RNG # Flattened Device Tree options FDT diff --git a/sys/arm/conf/ZEDBOARD b/sys/arm/conf/ZEDBOARD index 2944220..1008125 100644 --- a/sys/arm/conf/ZEDBOARD +++ b/sys/arm/conf/ZEDBOARD @@ -66,7 +66,6 @@ options KDB device loop device random -options YARROW_RNG # Yarrow software RNG device ether device if_cgem # Zynq-7000 gig ethernet device device mii diff --git a/sys/conf/NOTES b/sys/conf/NOTES index eb67ee6..3f84222 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1132,9 +1132,6 @@ options VFS_AIO # Cryptographically secure random number generator; /dev/random device random -# Yarrow software RNG adapter for random -options YARROW_RNG - # The system memory devices; /dev/mem, /dev/kmem device mem diff --git a/sys/conf/files b/sys/conf/files index f98c2c9..a748f08 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -540,8 +540,8 @@ crypto/des/des_ecb.c optional crypto | ipsec | netsmb crypto/des/des_setkey.c optional crypto | ipsec | netsmb crypto/rc4/rc4.c optional netgraph_mppc_encryption | kgssapi crypto/rijndael/rijndael-alg-fst.c optional crypto | geom_bde | \ - ipsec | yarrow_rng | wlan_ccmp -crypto/rijndael/rijndael-api-fst.c optional geom_bde | yarrow_rng + ipsec | random | wlan_ccmp +crypto/rijndael/rijndael-api-fst.c optional geom_bde | random crypto/rijndael/rijndael-api.c optional crypto | ipsec | wlan_ccmp crypto/sha1.c optional carp | crypto | ipsec | \ netgraph_mppc_encryption | sctp @@ -2030,12 +2030,11 @@ rt2860.fw optional rt2860fw | ralfw \ no-obj no-implicit-rule \ clean "rt2860.fw" dev/random/harvest.c standard -dev/random/hash.c optional yarrow_rng +dev/random/hash.c optional random dev/random/probe.c optional random -dev/random/random_adaptors.c standard dev/random/randomdev.c optional random -dev/random/randomdev_soft.c optional yarrow_rng -dev/random/yarrow.c optional yarrow_rng +dev/random/randomdev_soft.c optional random +dev/random/yarrow.c optional random dev/rc/rc.c optional rc dev/re/if_re.c optional re dev/rndtest/rndtest.c optional rndtest diff --git a/sys/conf/options b/sys/conf/options index de695cb..d9057cc 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -905,6 +905,3 @@ RACCT opt_global.h # Resource Limits RCTL opt_global.h - -# Software random number generators for random(4) -YARROW_RNG opt_dontuse.h diff --git a/sys/dev/random/ivy.c b/sys/dev/random/ivy.c index 0b8da12..f81c148 100644 --- a/sys/dev/random/ivy.c +++ b/sys/dev/random/ivy.c @@ -28,19 +28,16 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_cpu.h" + +#ifdef RDRAND_RNG + #include <sys/param.h> #include <sys/time.h> -#include <sys/kernel.h> #include <sys/lock.h> -#include <sys/module.h> #include <sys/mutex.h> #include <sys/selinfo.h> #include <sys/systm.h> - -#include <machine/md_var.h> -#include <machine/specialreg.h> - -#include <dev/random/random_adaptors.h> #include <dev/random/randomdev.h> #define RETRY_COUNT 10 @@ -49,7 +46,7 @@ static void random_ivy_init(void); static void random_ivy_deinit(void); static int random_ivy_read(void *, int); -struct random_adaptor random_ivy = { +struct random_systat random_ivy = { .ident = "Hardware, Intel IvyBridge+ RNG", .init = random_ivy_init, .deinit = random_ivy_deinit, @@ -117,32 +114,4 @@ random_ivy_read(void *buf, int c) return (c - count); } -static int -rdrand_modevent(module_t mod, int type, void *unused) -{ - - switch (type) { - case MOD_LOAD: - if (cpu_feature2 & CPUID2_RDRAND) { - random_adaptor_register("rdrand", &random_ivy); - EVENTHANDLER_INVOKE(random_adaptor_attach, &random_ivy); - return (0); - } else { -#ifndef KLD_MODULE - if (bootverbose) #endif - printf( - "%s: RDRAND feature is not present on this CPU\n", - random_ivy.ident); -#ifdef KLD_MODULE - return (ENXIO); -#else - return (0); -#endif - } - } - - return (EINVAL); -} - -RANDOM_ADAPTOR_MODULE(random_rdrand, rdrand_modevent, 1); diff --git a/sys/dev/random/nehemiah.c b/sys/dev/random/nehemiah.c index e811115..f3afa89 100644 --- a/sys/dev/random/nehemiah.c +++ b/sys/dev/random/nehemiah.c @@ -28,20 +28,19 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_cpu.h" + +#ifdef PADLOCK_RNG + #include <sys/param.h> #include <sys/time.h> #include <sys/lock.h> #include <sys/mutex.h> -#include <sys/module.h> #include <sys/selinfo.h> #include <sys/systm.h> -#include <sys/kernel.h> #include <machine/pcb.h> -#include <machine/md_var.h> -#include <machine/specialreg.h> -#include <dev/random/random_adaptors.h> #include <dev/random/randomdev.h> #define RANDOM_BLOCK_SIZE 256 @@ -51,7 +50,7 @@ static void random_nehemiah_init(void); static void random_nehemiah_deinit(void); static int random_nehemiah_read(void *, int); -struct random_adaptor random_nehemiah = { +struct random_systat random_nehemiah = { .ident = "Hardware, VIA Nehemiah", .init = random_nehemiah_init, .deinit = random_nehemiah_deinit, @@ -209,33 +208,4 @@ random_nehemiah_read(void *buf, int c) return (c); } -static int -nehemiah_modevent(module_t mod, int type, void *unused) -{ - - switch (type) { - case MOD_LOAD: - if (via_feature_rng & VIA_HAS_RNG) { - random_adaptor_register("nehemiah", &random_nehemiah); - EVENTHANDLER_INVOKE(random_adaptor_attach, - &random_nehemiah); - return (0); - } else { -#ifndef KLD_MODULE - if (bootverbose) #endif - printf( - "%s: VIA RNG feature is not present on this CPU\n", - random_nehemiah.ident); -#ifdef KLD_MODULE - return (ENXIO); -#else - return (0); -#endif - } - } - - return (EINVAL); -} - -RANDOM_ADAPTOR_MODULE(nehemiah, nehemiah_modevent, 1); diff --git a/sys/dev/random/probe.c b/sys/dev/random/probe.c index 7039b92..d9e70de 100644 --- a/sys/dev/random/probe.c +++ b/sys/dev/random/probe.c @@ -28,35 +28,66 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#if defined(__amd64__) || defined(__i386__) +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) #include "opt_cpu.h" #endif +#include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/malloc.h> +#include <sys/random.h> #include <sys/selinfo.h> +#include <sys/sysctl.h> + +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#include <machine/cpufunc.h> +#include <machine/cputypes.h> +#include <machine/md_var.h> +#include <machine/specialreg.h> +#endif -#include <dev/random/random_adaptors.h> #include <dev/random/randomdev.h> +#include <dev/random/randomdev_soft.h> + +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#ifdef PADLOCK_RNG +extern struct random_systat random_nehemiah; +#endif +#ifdef RDRAND_RNG +extern struct random_systat random_ivy; +#endif +#endif void -random_ident_hardware(struct random_adaptor **adaptor) +random_ident_hardware(struct random_systat **systat) { - struct random_adaptor *tmp; - int enable; - /* Set default to software (yarrow) */ - *adaptor = random_adaptor_get("yarrow"); + /* Set default to software */ + *systat = &random_yarrow; /* Then go looking for hardware */ - enable = 1; - TUNABLE_INT_FETCH("hw.nehemiah_rng_enable", &enable); - if (enable && (tmp = random_adaptor_get("nehemiah"))) - *adaptor = tmp; - - enable = 1; - TUNABLE_INT_FETCH("hw.ivy_rng_enable", &enable); - if (enable && (tmp = random_adaptor_get("rdrand"))) - *adaptor = tmp; +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#ifdef PADLOCK_RNG + if (via_feature_rng & VIA_HAS_RNG) { + int enable; + + enable = 1; + TUNABLE_INT_FETCH("hw.nehemiah_rng_enable", &enable); + if (enable) + *systat = &random_nehemiah; + } +#endif +#ifdef RDRAND_RNG + if (cpu_feature2 & CPUID2_RDRAND) { + int enable; + + enable = 1; + TUNABLE_INT_FETCH("hw.ivy_rng_enable", &enable); + if (enable) + *systat = &random_ivy; + } +#endif +#endif } diff --git a/sys/dev/random/random_adaptors.c b/sys/dev/random/random_adaptors.c deleted file mode 100644 index b10efb3..0000000 --- a/sys/dev/random/random_adaptors.c +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * Copyright (c) 2013 Arthur Mesh <arthurmesh@gmail.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/lock.h> -#include <sys/selinfo.h> -#include <sys/sysctl.h> -#include <sys/sx.h> -#include <sys/malloc.h> -#include <sys/queue.h> -#include <sys/libkern.h> - -#include <dev/random/random_adaptors.h> -#include <dev/random/randomdev.h> - -LIST_HEAD(adaptors_head, random_adaptors); -static struct adaptors_head adaptors = LIST_HEAD_INITIALIZER(adaptors); -static struct sx adaptors_lock; /* need a sleepable lock */ - -/* List for the dynamic sysctls */ -static struct sysctl_ctx_list random_clist; - -MALLOC_DEFINE(M_RANDOM_ADAPTORS, "random_adaptors", "Random adaptors buffers"); - -int -random_adaptor_register(const char *name, struct random_adaptor *rsp) -{ - struct random_adaptors *rpp; - - KASSERT(name != NULL && rsp != NULL, ("invalid input to %s", __func__)); - - rpp = malloc(sizeof(struct random_adaptors), M_RANDOM_ADAPTORS, M_WAITOK); - rpp->name = name; - rpp->rsp = rsp; - - sx_xlock(&adaptors_lock); - LIST_INSERT_HEAD(&adaptors, rpp, entries); - sx_xunlock(&adaptors_lock); - - return (0); -} - -struct random_adaptor * -random_adaptor_get(const char *name) -{ - struct random_adaptors *rpp; - struct random_adaptor *rsp; - - rsp = NULL; - - sx_slock(&adaptors_lock); - - LIST_FOREACH(rpp, &adaptors, entries) - if (strcmp(rpp->name, name) == 0) - rsp = rpp->rsp; - - sx_sunlock(&adaptors_lock); - - return (rsp); -} - -static void -random_adaptors_deinit(void *unused) -{ - - sx_destroy(&adaptors_lock); - sysctl_ctx_free(&random_clist); -} - -#define NO_ADAPTORS "<no loaded adaptors>" -static int -random_sysctl_adaptors_handler(SYSCTL_HANDLER_ARGS) -{ - struct random_adaptors *rpp; - int error; - - error = 0; - - sx_slock(&adaptors_lock); - - if (LIST_EMPTY(&adaptors)) - error = SYSCTL_OUT(req, NO_ADAPTORS, strlen(NO_ADAPTORS)); - - LIST_FOREACH(rpp, &adaptors, entries) { - error = SYSCTL_OUT(req, " ", 1); - if (!error) - error = SYSCTL_OUT(req, rpp->name, strlen(rpp->name)); - if (error) - break; - } - - sx_sunlock(&adaptors_lock); - - return (error); -} - -static void -random_adaptors_init(void *unused) -{ - - SYSCTL_PROC(_kern_random, OID_AUTO, adaptors, - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, random_sysctl_adaptors_handler, "", - "Random Number Generator adaptors"); - - sx_init(&adaptors_lock, "random_adaptors"); -} - -SYSCTL_NODE(_kern, OID_AUTO, random, CTLFLAG_RW, 0, "Random Number Generator"); - -SYSINIT(random_adaptors, SI_SUB_DRIVERS, SI_ORDER_FIRST, random_adaptors_init, - NULL); -SYSUNINIT(random_adaptors, SI_SUB_DRIVERS, SI_ORDER_FIRST, - random_adaptors_deinit, NULL); diff --git a/sys/dev/random/random_adaptors.h b/sys/dev/random/random_adaptors.h deleted file mode 100644 index 6c106df..0000000 --- a/sys/dev/random/random_adaptors.h +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * Copyright (c) 2013 Arthur Mesh <arthurmesh@gmail.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef __RANDOM_ADAPTORS_H__ -#define __RANDOM_ADAPTORS_H__ - -#include <sys/eventhandler.h> - -struct random_adaptors { - LIST_ENTRY(random_adaptors) entries; /* list of providesr */ - const char *name; /* name of random adaptor */ - struct random_adaptor *rsp; -}; - -struct random_adaptor *random_adaptor_get(const char *); -int random_adaptor_register(const char *, struct random_adaptor *); - -/* - * random_adaptor's should be registered prior to - * random module (SI_SUB_DRIVERS/SI_ORDER_MIDDLE) - */ -#define RANDOM_ADAPTOR_MODULE(name, modevent, ver) \ - static moduledata_t name##_mod = { \ - #name, \ - modevent, \ - 0 \ - }; \ - DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, \ - SI_ORDER_SECOND); \ - MODULE_VERSION(name, ver); \ - MODULE_DEPEND(name, random, 1, 1, 1); - -typedef void (*random_adaptor_attach_hook)(void *, struct random_adaptor *); -EVENTHANDLER_DECLARE(random_adaptor_attach, random_adaptor_attach_hook); - -/* kern.random sysctls */ -#ifdef SYSCTL_DECL /* from sysctl.h */ -SYSCTL_DECL(_kern_random); -#endif /* SYSCTL_DECL */ - -#endif /* __RANDOM_ADAPTORS_H__ */ diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index eeef425..18b17d8 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -70,15 +70,12 @@ static struct cdevsw random_cdevsw = { .d_name = "random", }; -static struct random_adaptor *random_adaptor; -static eventhandler_tag attach_tag; -static int random_inited; - +struct random_systat *random_systat; /* For use with make_dev(9)/destroy_dev(9). */ static struct cdev *random_dev; -/* Used to fake out unused random calls in random_adaptor */ +/* Used to fake out unused random calls in random_systat */ void random_null_func(void) { @@ -91,8 +88,8 @@ random_close(struct cdev *dev __unused, int flags, int fmt __unused, { if ((flags & FWRITE) && (priv_check(td, PRIV_RANDOM_RESEED) == 0) && (securelevel_gt(td->td_ucred, 0) == 0)) { - (*random_adaptor->reseed)(); - random_adaptor->seeded = 1; + (*random_systat->reseed)(); + random_systat->seeded = 1; arc4rand(NULL, 0, 1); /* Reseed arc4random as well. */ } @@ -107,8 +104,8 @@ random_read(struct cdev *dev __unused, struct uio *uio, int flag) void *random_buf; /* Blocking logic */ - if (!random_adaptor->seeded) - error = (*random_adaptor->block)(flag); + if (!random_systat->seeded) + error = (*random_systat->block)(flag); /* The actual read */ if (!error) { @@ -117,7 +114,7 @@ random_read(struct cdev *dev __unused, struct uio *uio, int flag) while (uio->uio_resid > 0 && !error) { c = MIN(uio->uio_resid, PAGE_SIZE); - c = (*random_adaptor->read)(random_buf, c); + c = (*random_systat->read)(random_buf, c); error = uiomove(random_buf, c, uio); } @@ -142,7 +139,7 @@ random_write(struct cdev *dev __unused, struct uio *uio, int flag __unused) error = uiomove(random_buf, c, uio); if (error) break; - (*random_adaptor->write)(random_buf, c); + (*random_systat->write)(random_buf, c); } free(random_buf, M_TEMP); @@ -175,37 +172,14 @@ random_poll(struct cdev *dev __unused, int events, struct thread *td) int revents = 0; if (events & (POLLIN | POLLRDNORM)) { - if (random_adaptor->seeded) + if (random_systat->seeded) revents = events & (POLLIN | POLLRDNORM); else - revents = (*random_adaptor->poll) (events,td); + revents = (*random_systat->poll) (events,td); } return (revents); } -static void -random_initialize(void *p, struct random_adaptor *s) -{ - if (random_inited) { - printf("random: <%s> already initialized\n", - random_adaptor->ident); - return; - } - - random_adaptor = s; - - (s->init)(); - - printf("random: <%s> initialized\n", s->ident); - - random_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &random_cdevsw, - RANDOM_MINOR, NULL, UID_ROOT, GID_WHEEL, 0666, "random"); - make_dev_alias(random_dev, "urandom"); /* XXX Deprecated */ - - /* mark random(4) as initialized, to avoid being called again */ - random_inited = 1; -} - /* ARGSUSED */ static int random_modevent(module_t mod __unused, int type, void *data __unused) @@ -214,29 +188,23 @@ random_modevent(module_t mod __unused, int type, void *data __unused) switch (type) { case MOD_LOAD: - random_ident_hardware(&random_adaptor); - - if (random_adaptor == NULL) { - printf( - "random: No random adaptor attached, postponing initialization\n"); - attach_tag = EVENTHANDLER_REGISTER(random_adaptor_attach, - random_initialize, NULL, EVENTHANDLER_PRI_ANY); - } else { - random_initialize(NULL, random_adaptor); - } + random_ident_hardware(&random_systat); + (*random_systat->init)(); + + if (bootverbose) + printf("random: <entropy source, %s>\n", + random_systat->ident); + + random_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &random_cdevsw, + RANDOM_MINOR, NULL, UID_ROOT, GID_WHEEL, 0666, "random"); + make_dev_alias(random_dev, "urandom"); /* XXX Deprecated */ break; case MOD_UNLOAD: - if (random_adaptor != NULL) { - (*random_adaptor->deinit)(); - destroy_dev(random_dev); - } - /* Unregister the event handler */ - if (attach_tag != NULL) { - EVENTHANDLER_DEREGISTER(random_adaptor_attach, - attach_tag); - } + (*random_systat->deinit)(); + + destroy_dev(random_dev); break; diff --git a/sys/dev/random/randomdev.h b/sys/dev/random/randomdev.h index 75b2c19..deb6831 100644 --- a/sys/dev/random/randomdev.h +++ b/sys/dev/random/randomdev.h @@ -38,7 +38,7 @@ typedef void random_write_func_t(void *, int); typedef int random_poll_func_t(int, struct thread *); typedef void random_reseed_func_t(void); -struct random_adaptor { +struct random_systat { struct selinfo rsel; const char *ident; int seeded; @@ -51,5 +51,7 @@ struct random_adaptor { random_reseed_func_t *reseed; }; -extern void random_ident_hardware(struct random_adaptor **); +extern struct random_systat *random_systat; + +extern void random_ident_hardware(struct random_systat **); extern void random_null_func(void); diff --git a/sys/dev/random/randomdev_soft.c b/sys/dev/random/randomdev_soft.c index e2a3925..ac48214 100644 --- a/sys/dev/random/randomdev_soft.c +++ b/sys/dev/random/randomdev_soft.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include <sys/kthread.h> #include <sys/lock.h> #include <sys/malloc.h> -#include <sys/module.h> #include <sys/mutex.h> #include <sys/poll.h> #include <sys/proc.h> @@ -51,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <machine/cpu.h> -#include <dev/random/random_adaptors.h> #include <dev/random/randomdev.h> #include <dev/random/randomdev_soft.h> @@ -65,7 +63,7 @@ static int random_yarrow_poll(int event,struct thread *td); static int random_yarrow_block(int flag); static void random_yarrow_flush_reseed(void); -struct random_adaptor random_yarrow = { +struct random_systat random_yarrow = { .ident = "Software, Yarrow", .init = random_yarrow_init, .deinit = random_yarrow_deinit, @@ -105,7 +103,7 @@ static int random_kthread_control = 0; static struct proc *random_kthread_proc; /* List for the dynamic sysctls */ -static struct sysctl_ctx_list random_clist; +struct sysctl_ctx_list random_clist; /* ARGSUSED */ static int @@ -122,20 +120,25 @@ random_yarrow_init(void) { int error, i; struct harvest *np; - struct sysctl_oid *random_sys_o, *random_sys_harvest_o; + struct sysctl_oid *random_o, *random_sys_o, *random_sys_harvest_o; enum esource e; - random_yarrow_init_alg(&random_clist); + random_o = SYSCTL_ADD_NODE(&random_clist, + SYSCTL_STATIC_CHILDREN(_kern), + OID_AUTO, "random", CTLFLAG_RW, 0, + "Software Random Number Generator"); + + random_yarrow_init_alg(&random_clist, random_o); random_sys_o = SYSCTL_ADD_NODE(&random_clist, - SYSCTL_STATIC_CHILDREN(_kern_random), + SYSCTL_CHILDREN(random_o), OID_AUTO, "sys", CTLFLAG_RW, 0, "Entropy Device Parameters"); SYSCTL_ADD_PROC(&random_clist, SYSCTL_CHILDREN(random_sys_o), OID_AUTO, "seeded", CTLTYPE_INT | CTLFLAG_RW, - &random_yarrow.seeded, 1, random_check_boolean, "I", + &random_systat->seeded, 1, random_check_boolean, "I", "Seeded State"); random_sys_harvest_o = SYSCTL_ADD_NODE(&random_clist, @@ -359,10 +362,10 @@ random_yarrow_write(void *buf, int count) void random_yarrow_unblock(void) { - if (!random_yarrow.seeded) { - random_yarrow.seeded = 1; - selwakeuppri(&random_yarrow.rsel, PUSER); - wakeup(&random_yarrow); + if (!random_systat->seeded) { + random_systat->seeded = 1; + selwakeuppri(&random_systat->rsel, PUSER); + wakeup(random_systat); } (void)atomic_cmpset_int(&arc4rand_iniseed_state, ARC4_ENTR_NONE, ARC4_ENTR_HAVE); @@ -374,10 +377,10 @@ random_yarrow_poll(int events, struct thread *td) int revents = 0; mtx_lock(&random_reseed_mtx); - if (random_yarrow.seeded) + if (random_systat->seeded) revents = events & (POLLIN | POLLRDNORM); else - selrecord(td, &random_yarrow.rsel); + selrecord(td, &random_systat->rsel); mtx_unlock(&random_reseed_mtx); return revents; @@ -391,12 +394,12 @@ random_yarrow_block(int flag) mtx_lock(&random_reseed_mtx); /* Blocking logic */ - while (!random_yarrow.seeded && !error) { + while (!random_systat->seeded && !error) { if (flag & O_NONBLOCK) error = EWOULDBLOCK; else { printf("Entropy device is blocking.\n"); - error = msleep(&random_yarrow, + error = msleep(random_systat, &random_reseed_mtx, PUSER | PCATCH, "block", 0); } @@ -417,30 +420,3 @@ random_yarrow_flush_reseed(void) random_yarrow_reseed(); } - -static int -yarrow_modevent(module_t mod, int type, void *unused) -{ - - switch (type) { - case MOD_LOAD: - random_adaptor_register("yarrow", &random_yarrow); - /* - * For statically built kernels that contain both random.ko and - * *_rng.ko, this event handler will do nothing, since - * random.ko is loaded after *_rng.ko's, and hence hasn't yet - * registered for this event. - * - * In case where both random.ko and *_rng.ko are built as - * modules, random.ko is loaded prior to *_rng.ko's (by - * dependency). This event handler is there to delay creation - * of /dev/{u,}random and attachment of this *_rng.ko. - */ - EVENTHANDLER_INVOKE(random_adaptor_attach, &random_yarrow); - return (0); - } - - return (EINVAL); -} - -RANDOM_ADAPTOR_MODULE(yarrow, yarrow_modevent, 1); diff --git a/sys/dev/random/randomdev_soft.h b/sys/dev/random/randomdev_soft.h index 2007694..489d45a 100644 --- a/sys/dev/random/randomdev_soft.h +++ b/sys/dev/random/randomdev_soft.h @@ -72,10 +72,10 @@ void random_process_event(struct harvest *event); void random_yarrow_reseed(void); void random_yarrow_unblock(void); -void random_yarrow_init_alg(struct sysctl_ctx_list *); +void random_yarrow_init_alg(struct sysctl_ctx_list *, struct sysctl_oid *); void random_yarrow_deinit_alg(void); -extern struct random_adaptor random_yarrow; +extern struct random_systat random_yarrow; extern struct mtx random_reseed_mtx; /* If this was c++, this would be a template */ diff --git a/sys/dev/random/yarrow.c b/sys/dev/random/yarrow.c index 09f079a..6f631bb 100644 --- a/sys/dev/random/yarrow.c +++ b/sys/dev/random/yarrow.c @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include <crypto/sha2/sha2.h> #include <dev/random/hash.h> -#include <dev/random/random_adaptors.h> #include <dev/random/randomdev_soft.h> #include <dev/random/yarrow.h> @@ -102,7 +101,7 @@ random_process_event(struct harvest *event) } void -random_yarrow_init_alg(struct sysctl_ctx_list *clist) +random_yarrow_init_alg(struct sysctl_ctx_list *clist, struct sysctl_oid *in_o) { int i; struct sysctl_oid *random_yarrow_o; @@ -111,7 +110,7 @@ random_yarrow_init_alg(struct sysctl_ctx_list *clist) * have a very good clue about what they do! */ random_yarrow_o = SYSCTL_ADD_NODE(clist, - SYSCTL_STATIC_CHILDREN(_kern_random), + SYSCTL_CHILDREN(in_o), OID_AUTO, "yarrow", CTLFLAG_RW, 0, "Yarrow Parameters"); diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index 643c085..93f23db 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -309,7 +309,6 @@ device loop # Network loopback device random # Entropy device options PADLOCK_RNG # VIA Padlock RNG options RDRAND_RNG # Intel Bull Mountain RNG -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. diff --git a/sys/i386/conf/XBOX b/sys/i386/conf/XBOX index d10fcd4..fb6a5c1 100644 --- a/sys/i386/conf/XBOX +++ b/sys/i386/conf/XBOX @@ -62,7 +62,6 @@ device pass # Passthrough device (direct ATA/SCSI access) # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support #device tun # Packet tunnel. #device md # Memory "disks" diff --git a/sys/i386/conf/XEN b/sys/i386/conf/XEN index f90dd81..bcc9f19 100644 --- a/sys/i386/conf/XEN +++ b/sys/i386/conf/XEN @@ -76,7 +76,6 @@ device pci # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device tun # Packet tunnel. device md # Memory "disks" @@ -91,3 +90,4 @@ options AH_SUPPORT_AR5416 # Be aware of the administrative consequences of enabling this! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter + diff --git a/sys/ia64/conf/GENERIC b/sys/ia64/conf/GENERIC index ee4b652..cb51617 100644 --- a/sys/ia64/conf/GENERIC +++ b/sys/ia64/conf/GENERIC @@ -198,7 +198,6 @@ device loop # Network loopback device md # Memory "disks" device puc # Multi I/O cards and multi-channel UARTs device random # Entropy device -options YARROW_RNG # Yarrow software RNG device tun # Packet tunnel. device uart # Serial port (UART) device vlan # 802.1Q VLAN support diff --git a/sys/mips/conf/AR71XX_BASE b/sys/mips/conf/AR71XX_BASE index a5d4bbf..69b10a2 100644 --- a/sys/mips/conf/AR71XX_BASE +++ b/sys/mips/conf/AR71XX_BASE @@ -24,7 +24,7 @@ makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols # Build these as modules so small platform builds will have the # modules already built. -makeoptions MODULES_OVERRIDE="random yarrow_rng gpio ar71xx if_gif if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr ath ath_pci" +makeoptions MODULES_OVERRIDE="random gpio ar71xx if_gif if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr ath ath_pci" options DDB options KDB @@ -115,7 +115,6 @@ device ether device md device bpf device random -options YARROW_RNG # Yarrow software RNG device if_bridge device gif # ip[46] in ip[46] tunneling protocol device gre # generic encapsulation - only for IPv4 in IPv4 though atm diff --git a/sys/mips/conf/AR724X_BASE b/sys/mips/conf/AR724X_BASE index f74a693..7ffadb1 100644 --- a/sys/mips/conf/AR724X_BASE +++ b/sys/mips/conf/AR724X_BASE @@ -25,7 +25,7 @@ makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols # Build these as modules so small platform builds will have the # modules already built. -makeoptions MODULES_OVERRIDE="random yarrow_rng gpio ar71xx if_gif if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr ath ath_pci hwpmc cam" +makeoptions MODULES_OVERRIDE="random gpio ar71xx if_gif if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr ath ath_pci hwpmc cam" options DDB options KDB diff --git a/sys/mips/conf/AR91XX_BASE b/sys/mips/conf/AR91XX_BASE index ad81bee..a84474d 100644 --- a/sys/mips/conf/AR91XX_BASE +++ b/sys/mips/conf/AR91XX_BASE @@ -20,7 +20,7 @@ files "../atheros/files.ar71xx" hints "AR91XX_BASE.hints" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -makeoptions MODULES_OVERRIDE="random yarrow_rng gpio ar71xx if_gif if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr ath ath_ahb hwpmc" +makeoptions MODULES_OVERRIDE="random gpio ar71xx if_gif if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr ath ath_ahb hwpmc" options DDB options KDB @@ -113,7 +113,6 @@ device ether device md device bpf device random -options YARROW_RNG # Yarrow software RNG device if_bridge device gpio device gpioled diff --git a/sys/mips/conf/AR933X_BASE b/sys/mips/conf/AR933X_BASE index 8de1a47..282f3b3 100644 --- a/sys/mips/conf/AR933X_BASE +++ b/sys/mips/conf/AR933X_BASE @@ -20,7 +20,7 @@ files "../atheros/files.ar71xx" hints "AR933X_BASE.hints" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -# makeoptions MODULES_OVERRIDE="random yarrow_rng gpio ar71xx if_gif if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr ath ath_ahb hwpmc" +# makeoptions MODULES_OVERRIDE="random gpio ar71xx if_gif if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr ath ath_ahb hwpmc" makeoptions MODULES_OVERRIDE="" options DDB @@ -119,7 +119,6 @@ device ether device md device bpf device random -options YARROW_RNG # Yarrow software RNG device if_bridge device gpio device gpioled diff --git a/sys/mips/conf/BERI_TEMPLATE b/sys/mips/conf/BERI_TEMPLATE index 46f61f1..f4d53ca 100644 --- a/sys/mips/conf/BERI_TEMPLATE +++ b/sys/mips/conf/BERI_TEMPLATE @@ -55,5 +55,4 @@ device md device ether device loop device random -options YARROW_RNG # Yarrow software RNG device snp diff --git a/sys/mips/conf/DIR-825 b/sys/mips/conf/DIR-825 index 352d91a..62189cfc 100644 --- a/sys/mips/conf/DIR-825 +++ b/sys/mips/conf/DIR-825 @@ -20,7 +20,6 @@ hints "DIR-825.hints" # Since the kernel image must fit inside 1024KiB, we have to build almost # everything as modules. nodevice random -nooptions YARROW_RNG nodevice gpio nodevice gpioled nodevice gif diff --git a/sys/mips/conf/GXEMUL b/sys/mips/conf/GXEMUL index 0d91d3ac..ea58622 100644 --- a/sys/mips/conf/GXEMUL +++ b/sys/mips/conf/GXEMUL @@ -51,7 +51,6 @@ device gxemul_ether # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device tun # Packet tunnel. device md # Memory "disks" diff --git a/sys/mips/conf/OCTEON1 b/sys/mips/conf/OCTEON1 index 6227fa8..dfe5208 100644 --- a/sys/mips/conf/OCTEON1 +++ b/sys/mips/conf/OCTEON1 @@ -256,7 +256,6 @@ device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. diff --git a/sys/mips/conf/PB92 b/sys/mips/conf/PB92 index f7d5e91..2ca7cfe 100644 --- a/sys/mips/conf/PB92 +++ b/sys/mips/conf/PB92 @@ -22,7 +22,7 @@ options AR71XX_ENV_UBOOT # who already are using it without modifying the default flash layout) # we need to cut down on a lot of things. -makeoptions MODULES_OVERRIDE="ath ath_pci ath_ahb bridgestp if_bridge if_gif if_gre random yarrow_rng wlan wlan_acl wlan_amrr wlan_ccmp wlan_rssadapt wlan_tkip wlan_wep wlan_xauth usb ar71xx" +makeoptions MODULES_OVERRIDE="ath ath_pci ath_ahb bridgestp if_bridge if_gif if_gre random wlan wlan_acl wlan_amrr wlan_ccmp wlan_rssadapt wlan_tkip wlan_wep wlan_xauth usb ar71xx" hints "PB92.hints" include "../atheros/std.ar71xx" diff --git a/sys/mips/conf/RT305X b/sys/mips/conf/RT305X index 8471690..6527782 100644 --- a/sys/mips/conf/RT305X +++ b/sys/mips/conf/RT305X @@ -24,7 +24,7 @@ makeoptions MIPS_LITTLE_ENDIAN=defined makeoptions KERNLOADADDR=0x80001000 # Don't build any modules yet. -makeoptions MODULES_OVERRIDE="wlan_xauth wlan_wep wlan_tkip wlan_acl wlan_amrr wlan_ccmp wlan_rssadapt random yarrow_rng if_bridge bridgestp msdosfs md ipfw dummynet libalias geom/geom_label ufs usb/uplcom usb/u3g usb/umodem usb/umass usb/ucom cam zlib" +makeoptions MODULES_OVERRIDE="wlan_xauth wlan_wep wlan_tkip wlan_acl wlan_amrr wlan_ccmp wlan_rssadapt random if_bridge bridgestp msdosfs md ipfw dummynet libalias geom/geom_label ufs usb/uplcom usb/u3g usb/umodem usb/umass usb/ucom cam zlib" makeoptions RT3052F include "../rt305x/std.rt305x" @@ -90,7 +90,6 @@ options MROUTING # Multicast routing options IPFIREWALL_DEFAULT_TO_ACCEPT device random -options YARROW_RNG # Yarrow software RNG device loop # RT3050F, RT3052F have only pseudo PHYs, so mii not required device rt diff --git a/sys/mips/conf/XLR64 b/sys/mips/conf/XLR64 index 486ce77..1db8d85 100644 --- a/sys/mips/conf/XLR64 +++ b/sys/mips/conf/XLR64 @@ -84,7 +84,6 @@ device uart # Pseudo device loop device random -options YARROW_RNG # Yarrow software RNG device md device bpf diff --git a/sys/mips/conf/XLRN32 b/sys/mips/conf/XLRN32 index 5ad65bd..d81eaf9 100644 --- a/sys/mips/conf/XLRN32 +++ b/sys/mips/conf/XLRN32 @@ -85,7 +85,6 @@ device uart # Pseudo device loop device random -options YARROW_RNG # Yarrow software RNG device md device bpf diff --git a/sys/mips/conf/std.SWARM b/sys/mips/conf/std.SWARM index 5edd5a2..0405b0a 100644 --- a/sys/mips/conf/std.SWARM +++ b/sys/mips/conf/std.SWARM @@ -42,7 +42,6 @@ device loop device ether device md device random -options YARROW_RNG # Yarrow software RNG options USB_DEBUG device usb diff --git a/sys/mips/conf/std.XLP b/sys/mips/conf/std.XLP index aa1042d..bf5fbe8 100644 --- a/sys/mips/conf/std.XLP +++ b/sys/mips/conf/std.XLP @@ -65,7 +65,6 @@ makeoptions FDT_DTS_FILE=xlp-basic.dts # Pseudo device loop device random -options YARROW_RNG # Yarrow software RNG device md device bpf diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 71794fc..bd263e9 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -254,7 +254,6 @@ SUBDIR= \ ${_opensolaris} \ oce \ ${_padlock} \ - ${_padlock_rng} \ patm \ ${_pccard} \ ${_pcfclock} \ @@ -281,7 +280,6 @@ SUBDIR= \ ${_random} \ rc4 \ ${_rdma} \ - ${_rdrand_rng} \ re \ reiserfs \ rl \ @@ -365,14 +363,11 @@ SUBDIR= \ ${_x86bios} \ ${_xe} \ xl \ - yarrow_rng \ ${_zfs} \ zlib \ .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" _filemon= filemon -_padlock_rng= padlock_rng -_rdrand_rng= rdrand_rng .endif .if ${MACHINE_CPUARCH} != "powerpc" && ${MACHINE_CPUARCH} != "arm" && \ diff --git a/sys/modules/padlock_rng/Makefile b/sys/modules/padlock_rng/Makefile deleted file mode 100644 index 5c96c20..0000000 --- a/sys/modules/padlock_rng/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../dev/random - -KMOD= padlock_rng - -SRCS+= \ - nehemiah.c - -.include <bsd.kmod.mk> diff --git a/sys/modules/random/Makefile b/sys/modules/random/Makefile index a4882ba..ad14899 100644 --- a/sys/modules/random/Makefile +++ b/sys/modules/random/Makefile @@ -1,9 +1,19 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../dev/random +.PATH: ${.CURDIR}/../../crypto/rijndael +.PATH: ${.CURDIR}/../../crypto/sha2 KMOD= random SRCS= randomdev.c probe.c -SRCS+= bus_if.h device_if.h opt_cpu.h +.if ${MACHINE} == "amd64" || ${MACHINE} == "i386" +SRCS+= nehemiah.c +SRCS+= ivy.c +.endif +SRCS+= randomdev_soft.c yarrow.c hash.c +SRCS+= rijndael-alg-fst.c rijndael-api-fst.c sha2.c +SRCS+= bus_if.h device_if.h vnode_if.h opt_cpu.h + +CFLAGS+= -I${.CURDIR}/../.. .include <bsd.kmod.mk> diff --git a/sys/modules/rdrand_rng/Makefile b/sys/modules/rdrand_rng/Makefile deleted file mode 100644 index 2cfd3fd..0000000 --- a/sys/modules/rdrand_rng/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../dev/random - -KMOD= rdrand_rng - -SRCS+= \ - ivy.c - -.include <bsd.kmod.mk> diff --git a/sys/modules/yarrow_rng/Makefile b/sys/modules/yarrow_rng/Makefile deleted file mode 100644 index 0974cba..0000000 --- a/sys/modules/yarrow_rng/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../dev/random -.PATH: ${.CURDIR}/../../crypto/rijndael - -KMOD= yarrow_rng - -SRCS+= \ - hash.c \ - randomdev_soft.c \ - rijndael-alg-fst.c \ - rijndael-api-fst.c \ - yarrow.c - -SRCS+= bus_if.h device_if.h - -CFLAGS+= -I${.CURDIR}/../.. - -.include <bsd.kmod.mk> diff --git a/sys/pc98/conf/GENERIC b/sys/pc98/conf/GENERIC index b291946..7386c1f 100644 --- a/sys/pc98/conf/GENERIC +++ b/sys/pc98/conf/GENERIC @@ -217,7 +217,6 @@ options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC index 8049e40..d91e00d 100644 --- a/sys/powerpc/conf/GENERIC +++ b/sys/powerpc/conf/GENERIC @@ -144,7 +144,6 @@ device fxp # Intel EtherExpress PRO/100B (82557, 82558) # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 888b3c0..1cdf195 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -141,7 +141,6 @@ device fxp # Intel EtherExpress PRO/100B (82557, 82558) # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. diff --git a/sys/powerpc/conf/MPC85XX b/sys/powerpc/conf/MPC85XX index ccf5297..e222ddb 100644 --- a/sys/powerpc/conf/MPC85XX +++ b/sys/powerpc/conf/MPC85XX @@ -76,7 +76,6 @@ device pass device pci device quicc device random -options YARROW_RNG # Yarrow software RNG #device rl device scbus device scc diff --git a/sys/powerpc/conf/WII b/sys/powerpc/conf/WII index 2777cf5..e4d61b2 100644 --- a/sys/powerpc/conf/WII +++ b/sys/powerpc/conf/WII @@ -72,7 +72,6 @@ makeoptions SC_DFLT_FONT=cp437 # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. diff --git a/sys/sparc64/conf/GENERIC b/sys/sparc64/conf/GENERIC index 5959dbb..ad8f429 100644 --- a/sys/sparc64/conf/GENERIC +++ b/sys/sparc64/conf/GENERIC @@ -215,7 +215,6 @@ device ath_rate_sample # SampleRate tx rate control for ath # Pseudo devices. device loop # Network loopback device random # Entropy device -options YARROW_RNG # Yarrow software RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. |