diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -310,7 +310,6 @@ dev/ntb/test/ntb_tool.c optional ntb_tool dev/nvram/nvram.c optional nvram isa dev/random/ivy.c optional rdrand_rng !random_loadable -dev/random/nehemiah.c optional padlock_rng !random_loadable dev/qat_c2xxx/qat.c optional qat_c2xxx dev/qat_c2xxx/qat_ae.c optional qat_c2xxx dev/qat_c2xxx/qat_c2xxx.c optional qat_c2xxx diff --git a/sys/dev/random/fenestrasX/fx_pool.c b/sys/dev/random/fenestrasX/fx_pool.c --- a/sys/dev/random/fenestrasX/fx_pool.c +++ b/sys/dev/random/fenestrasX/fx_pool.c @@ -182,9 +182,6 @@ [RANDOM_PURE_RDRAND] = { .entc_cls = &fxrng_hi_pull, }, - [RANDOM_PURE_NEHEMIAH] = { - .entc_cls = &fxrng_hi_pull, - }, [RANDOM_PURE_RNDTEST] = { .entc_cls = &fxrng_garbage, }, diff --git a/sys/dev/random/nehemiah.c b/sys/dev/random/nehemiah.c deleted file mode 100644 --- a/sys/dev/random/nehemiah.c +++ /dev/null @@ -1,132 +0,0 @@ -/*- - * Copyright (c) 2013-2015 Mark R V Murray - * Copyright (c) 2013 David E. O'Brien - * 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. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -static u_int random_nehemiah_read(void *, u_int); - -static const struct random_source random_nehemiah = { - .rs_ident = "VIA Nehemiah Padlock RNG", - .rs_source = RANDOM_PURE_NEHEMIAH, - .rs_read = random_nehemiah_read -}; - -/* This H/W source never stores more than 8 bytes in one go */ -/* ARGSUSED */ -static __inline size_t -VIA_RNG_store(void *buf) -{ - uint32_t retval = 0; - uint32_t rate = 0; - - __asm __volatile( - "movl $0,%%edx\n\t" - ".byte 0x0f, 0xa7, 0xc0" - : "=a" (retval), "+d" (rate), "+D" (buf) - : - : "memory" - ); - if (rate == 0) - return (retval&0x1f); - return (0); -} - -/* It is specifically allowed that buf is a multiple of sizeof(long) */ -static u_int -random_nehemiah_read(void *buf, u_int c) -{ - uint8_t *b; - size_t count, ret; - uint64_t tmp; - - fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); - b = buf; - for (count = c; count > 0; count -= ret) { - ret = MIN(VIA_RNG_store(&tmp), count); - memcpy(b, &tmp, ret); - b += ret; - } - fpu_kern_leave(curthread, NULL); - - return (c); -} - -static int -nehemiah_modevent(module_t mod, int type, void *unused) -{ - int error = 0; - - switch (type) { - case MOD_LOAD: - if (via_feature_rng & VIA_HAS_RNG) { - random_source_register(&random_nehemiah); - printf("random: fast provider: \"%s\"\n", random_nehemiah.rs_ident); - } - break; - - case MOD_UNLOAD: - if (via_feature_rng & VIA_HAS_RNG) { - random_source_deregister(&random_nehemiah); - } - break; - - case MOD_SHUTDOWN: - break; - - default: - error = EOPNOTSUPP; - break; - - } - - return (error); -} - -static moduledata_t nehemiah_mod = { - "nehemiah", - nehemiah_modevent, - 0 -}; - -DECLARE_MODULE(nehemiah, nehemiah_mod, SI_SUB_RANDOM, SI_ORDER_FOURTH); -MODULE_VERSION(nehemiah, 1); -MODULE_DEPEND(nehemiah, random_harvestq, 1, 1, 1); diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -666,7 +666,6 @@ [RANDOM_PURE_GLXSB] = "PURE_GLXSB", [RANDOM_PURE_HIFN] = "PURE_HIFN", [RANDOM_PURE_RDRAND] = "PURE_RDRAND", - [RANDOM_PURE_NEHEMIAH] = "PURE_NEHEMIAH", [RANDOM_PURE_RNDTEST] = "PURE_RNDTEST", [RANDOM_PURE_VIRTIO] = "PURE_VIRTIO", [RANDOM_PURE_BROADCOM] = "PURE_BROADCOM", diff --git a/sys/modules/padlock_rng/Makefile b/sys/modules/padlock_rng/Makefile deleted file mode 100644 --- a/sys/modules/padlock_rng/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PATH: ${SRCTOP}/sys/dev/random - -KMOD= padlock_rng -SRCS= nehemiah.c -SRCS+= bus_if.h device_if.h - -CFLAGS+= -I${SRCTOP}/sys - -.include diff --git a/sys/sys/random.h b/sys/sys/random.h --- a/sys/sys/random.h +++ b/sys/sys/random.h @@ -94,7 +94,6 @@ RANDOM_PURE_GLXSB, RANDOM_PURE_HIFN, RANDOM_PURE_RDRAND, - RANDOM_PURE_NEHEMIAH, RANDOM_PURE_RNDTEST, RANDOM_PURE_VIRTIO, RANDOM_PURE_BROADCOM, diff --git a/sys/x86/conf/NOTES b/sys/x86/conf/NOTES --- a/sys/x86/conf/NOTES +++ b/sys/x86/conf/NOTES @@ -541,7 +541,6 @@ device vpd device asmc device tpm -device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device aesni # AES-NI OpenCrypto module device ossl # OpenSSL OpenCrypto module