diff options
| author | Andrew Turner <andrew@FreeBSD.org> | 2023-11-15 17:42:02 +0000 |
|---|---|---|
| committer | Andrew Turner <andrew@FreeBSD.org> | 2023-11-15 18:05:08 +0000 |
| commit | 9eecef052155646fbc5f8f533b952b372572d06a (patch) | |
| tree | b2d0e5a3e6a6e75534f20e9ef419ab0d9a6d4f22 /sys/modules | |
| parent | 61f14f1da37b4e6db8f9efe40c6b544c855fb9bd (diff) | |
Add an Armv8 rndr random number provider
Armv8.5 adds an optional random number generator. This is implemented
as two special registers one to read a random number, the other to
re-seed the entropy pool before reading a random number. Both registers
will set the condition flags to tell the caller they can't produce a
random number in a reasonable amount of time.
Without a signal to reseed the entropy pool use the latter register
to provide random numbers to the kernel pool. If at a later time we
had a way to tell the provider if it needs to reseed or not we could
use the former.
On an Amazon AWS Graviton3 VM this never failed, however this may not
be the case on low end CPUs so retry reading the random number 10 times
before returning an error.
Reviewed by: imp, delphij (csprng)
Sponsored by: The FreeBSD Foundation
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D35411
Diffstat (limited to 'sys/modules')
| -rw-r--r-- | sys/modules/Makefile | 2 | ||||
| -rw-r--r-- | sys/modules/armv8_rng/Makefile | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 3eff75312fd3..f9079498dc1f 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -41,6 +41,7 @@ SUBDIR= \ ${_arcmsr} \ ${_allwinner} \ ${_armv8crypto} \ + ${_armv8_rng} \ ${_asmc} \ ata \ ath \ @@ -674,6 +675,7 @@ _cxgb= cxgb .if ${MACHINE_CPUARCH} == "aarch64" _armv8crypto= armv8crypto +_armv8_rng= armv8_rng _dpaa2= dpaa2 _sff= sff _em= em diff --git a/sys/modules/armv8_rng/Makefile b/sys/modules/armv8_rng/Makefile new file mode 100644 index 000000000000..29d2907aed06 --- /dev/null +++ b/sys/modules/armv8_rng/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/random + +KMOD= armv8_rng +SRCS= armv8rng.c +SRCS+= bus_if.h device_if.h + +CFLAGS+= -I${SRCTOP}/sys + +.include <bsd.kmod.mk> |
