From 721ce839c7c49ecca90b66a4523be0e6e29c057e Mon Sep 17 00:00:00 2001 From: obrien Date: Mon, 29 Jul 2013 20:26:27 +0000 Subject: Decouple yarrow from random(4) device. * Make Yarrow an optional kernel component -- enabled by "YARROW_RNG" option. The files sha2.c, hash.c, randomdev_soft.c and yarrow.c comprise yarrow. * random(4) device doesn't really depend on rijndael-*. Yarrow, however, does. * Add random_adaptors.[ch] which is basically a store of random_adaptor's. random_adaptor is basically an adapter that plugs in to random(4). random_adaptor can only be plugged in to random(4) very early in bootup. Unplugging random_adaptor from random(4) is not supported, and is probably a bad idea anyway, due to potential loss of entropy pools. We currently have 3 random_adaptors: + yarrow + rdrand (ivy.c) + nehemeiah * Remove platform dependent logic from probe.c, and move it into corresponding registration routines of each random_adaptor provider. probe.c doesn't do anything other than picking a specific random_adaptor from a list of registered ones. * If the kernel doesn't have any random_adaptor adapters present then the creation of /dev/random is postponed until next random_adaptor is kldload'ed. * Fix randomdev_soft.c to refer to its own random_adaptor, instead of a system wide one. Submitted by: arthurmesh@gmail.com, obrien Obtained from: Juniper Networks Reviewed by: obrien --- sys/modules/Makefile | 5 +++++ sys/modules/random/Makefile | 12 +----------- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'sys/modules') diff --git a/sys/modules/Makefile b/sys/modules/Makefile index d26dacc..063aa04 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -254,6 +254,7 @@ SUBDIR= \ ${_opensolaris} \ oce \ ${_padlock} \ + ${_padlock_rng} \ patm \ ${_pccard} \ ${_pcfclock} \ @@ -280,6 +281,7 @@ SUBDIR= \ ${_random} \ rc4 \ ${_rdma} \ + ${_rdrand_rng} \ re \ reiserfs \ rl \ @@ -364,11 +366,14 @@ 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/random/Makefile b/sys/modules/random/Makefile index ad14899..a4882ba 100644 --- a/sys/modules/random/Makefile +++ b/sys/modules/random/Makefile @@ -1,19 +1,9 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../dev/random -.PATH: ${.CURDIR}/../../crypto/rijndael -.PATH: ${.CURDIR}/../../crypto/sha2 KMOD= random SRCS= randomdev.c probe.c -.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}/../.. +SRCS+= bus_if.h device_if.h opt_cpu.h .include -- cgit v1.1