freebsd-skq/sys/dev
Conrad Meyer d0d71d818c random(4): Generalize algorithm-independent APIs
At a basic level, remove assumptions about the underlying algorithm (such as
output block size and reseeding requirements) from the algorithm-independent
logic in randomdev.c.  Chacha20 does not have many of the restrictions that
AES-ICM does as a PRF (Pseudo-Random Function), because it has a cipher
block size of 512 bits.  The motivation is that by generalizing the API,
Chacha is not penalized by the limitations of AES.

In READ_RANDOM_UIO, first attempt to NOWAIT allocate a large enough buffer
for the entire user request, or the maximal input we'll accept between
signal checking, whichever is smaller.  The idea is that the implementation
of any randomdev algorithm is then free to divide up large requests in
whatever fashion it sees fit.

As part of this, two responsibilities from the "algorithm-generic" randomdev
code are pushed down into the Fortuna ra_read implementation (and any other
future or out-of-tree ra_read implementations):

  1. If an algorithm needs to rekey every N bytes, it is responsible for
  handling that in ra_read(). (I.e., Fortuna's 1MB rekey interval for AES
  block generation.)

  2. If an algorithm uses a block cipher that doesn't tolerate partial-block
  requests (again, e.g., AES), it is also responsible for handling that in
  ra_read().

Several APIs are changed from u_int buffer length to the more canonical
size_t.  Several APIs are changed from taking a blockcount to a bytecount,
to permit PRFs like Chacha20 to directly generate quantities of output that
are not multiples of RANDOM_BLOCKSIZE (AES block size).

The Fortuna algorithm is changed to NOT rekey every 1MiB when in Chacha20
mode (kern.random.use_chacha20_cipher="1").  This is explicitly supported by
the math in FS&K §9.4 (Ferguson, Schneier, and Kohno; "Cryptography
Engineering"), as well as by their conclusion: "If we had a block cipher
with a 256-bit [or greater] block size, then the collisions would not
have been an issue at all."

For now, continue to break up reads into PAGE_SIZE chunks, as they were
before.  So, no functional change, mostly.

Reviewed by:	markm
Approved by:	secteam(delphij)
Differential Revision:	https://reviews.freebsd.org/D20312
2019-06-17 15:09:12 +00:00
..
aac Make uniqueifier match the module definition. 2019-05-24 01:43:29 +00:00
aacraid Make aacraid(4) working on ASR8805 & ASR8402 in particular. This patch 2019-05-22 04:51:08 +00:00
acpi_support Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
acpica acpi_dock(4): Notify devd(8) on dock status change. 2019-05-31 15:44:33 +00:00
adb Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
adlink
ae FCP-101: ae(4) is sufficently popular to be moved to the keep list. 2019-05-16 15:22:17 +00:00
age
agp
ahci ahci: Check if bus is cache-coherent 2019-05-10 16:43:53 +00:00
aic7xxx [aic7xxx] Use correct product name 29320LPE instead of non-existent 39320LPE 2019-01-19 05:31:48 +00:00
al_eth
alc
ale
alpm
altera o Rewrite softdma_process_tx() of Altera SoftDMA engine driver 2019-04-29 16:27:15 +00:00
amd_ecc_inject
amdgpio amdgpio: small formatting cleanup 2019-05-24 06:07:33 +00:00
amdpm
amdsbwd Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
amdsmb
amdsmn amdtemp(4): Add support for Family 15h, Model >=60h 2019-01-12 22:36:33 +00:00
amdtemp amdtemp(4): Add support for Family 15h, Model >=60h 2019-01-12 22:36:33 +00:00
amr
an
arcmsr
asmc asmc: Add support for Mac mini 2,1 2019-02-25 21:59:01 +00:00
ata GC ATA_REQUEST_TIMEOUT option remnants 2019-02-16 01:48:38 +00:00
ath [ath_hal] Fix queue bits a bit 2019-05-28 18:05:10 +00:00
atkbdc Add macOS-like three finger drag trackpad gesture to psm(4) 2019-06-16 03:06:05 +00:00
auxio
axgbe
bce
beri Fix off-by-one error in BERI virtio driver 2019-02-11 07:42:32 +00:00
bfe
bge Remove unused define. 2019-05-17 13:08:12 +00:00
bhnd Fix format/arg mismatch 2019-01-25 21:38:28 +00:00
bktr
bnxt
bvm
bwi Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
bwn Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
bxe
cadence Add support for Cadence network controller found in HiFive Unleashed board. 2019-04-24 13:44:30 +00:00
cardbus Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
cas
ce
cesa
cfe
cfi Fix AMD type flash write operations, and display chip information at boot 2019-03-24 06:28:25 +00:00
chromebook_platform
ciss Don't print the request we may be aborting in ciss_notify_abort as 2019-06-13 05:19:42 +00:00
cmx Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
coretemp Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
cp
cpuctl Mitigations for Microarchitectural Data Sampling. 2019-05-14 17:02:20 +00:00
cpufreq Improve cpufreq_dt. 2019-03-19 14:34:53 +00:00
ctau Fix two errors reported by PVS Studio: V646 Consider inspecting the 2019-05-26 12:41:03 +00:00
cx
cxgb cxgb(4): Netdump: only reference allocated qsets 2019-03-01 01:57:22 +00:00
cxgbe Fix debug trace after removal of pdu_overhead. 2019-06-07 21:30:11 +00:00
cy
cyapa
dc
dcons Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
dme Update dme(4) to reflect that it will not be removed due to FCP-101. 2019-05-08 19:05:58 +00:00
dpaa
dpms
drm2 Replace uses of vm_page_unwire(m, PQ_NONE) with vm_page_unwire_noq(m). 2019-06-07 18:23:29 +00:00
dwc
e1000 o Avoid determining the MAC class (LEM/EM or IGB) - possibly even multiple 2019-05-07 08:31:54 +00:00
efidev efirt efi_enter(): Release acquired locks and restore FPU ownership if 2019-06-03 15:41:45 +00:00
ena Update ENA version to v2.0.0 2019-05-30 13:52:32 +00:00
esp
et
etherswitch Do not overwrite the RGMII bits in the CPU port register of Switch. 2019-06-06 21:25:46 +00:00
evdev Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
exca
extres Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
fb Include eventhandler.h in more compilation units 2019-05-21 01:18:43 +00:00
fdc
fdt cpsw: use phy-handle in FDT to find PHY address 2019-04-03 21:01:53 +00:00
ffec
filemon Remove unused argument to priv_check_cred. 2018-12-11 19:32:16 +00:00
firewire Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
flash Use the new FDTCOMPAT_PNP_INFO() macro to define SPIBUS_FDT_PNP_INFO(). 2019-05-23 15:59:50 +00:00
fxp Remove a use of a negative array index from fxp(4). 2018-12-19 04:54:32 +00:00
gem
glxiic
glxsb
gpio Zero the GPIO regulator pins memory. 2019-06-06 20:54:09 +00:00
gxemul
hdmi Include eventhandler.h in more compilation units 2019-05-21 01:18:43 +00:00
hifn
hme
hpt27xx
hptiop
hptmv
hptnr
hptrr
hwpmc Don't refer to the cpu variable in a KASSERT before initializing it. 2019-06-06 15:18:23 +00:00
hyperv
ic
ichiic Catch up with r338948. 2018-12-17 21:34:09 +00:00
ichsmb Add some Cannon Lake chipset IDs. 2019-03-20 17:27:00 +00:00
ichwd Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
ida Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
if_ndis Fix compilation with 'option NDISAPI + device ndis' and 2019-01-30 11:40:12 +00:00
iicbus revert r273728 and parts of r306589, iicbus no-stop by default feature 2019-05-29 09:08:20 +00:00
iir Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
imcsmb Remove unecessary "All rights reserved" from files under my or Panasas's 2019-01-30 16:55:00 +00:00
intel
intpm intpm: change translation of HBA error status to smbus(4) errors 2019-03-22 10:38:22 +00:00
io
ioat Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
ipmi The current IPMI KCS code is waiting 100us for all transitions (roughly 2019-06-12 16:06:31 +00:00
ips Add the likely missing braces in ips(4). This is found by gcc warning that 2019-05-29 18:11:17 +00:00
ipw Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
isci isci(4): Use controller->lock for busdma tags. 2019-03-12 16:49:08 +00:00
iscsi Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
iscsi_initiator Include eventhandler.h in more compilation units 2019-05-21 01:18:43 +00:00
iser
isl
ismt
isp Fix FC-Tape bugs caused in part by r345008. 2019-05-24 17:58:29 +00:00
ispfw
iwi urtw(4), otus(4), iwi(4): allow to set non-default MAC address via ifconfig(8) 2019-04-10 08:17:56 +00:00
iwm Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
iwn Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
ixgbe Include ktr.h in more compilation units 2019-05-21 20:38:48 +00:00
ixl Add the missing braces to fix the code not guarded by the if clause and has 2019-05-30 20:42:36 +00:00
jedec_dimm Teach jedec_dimm(4) to be more forgiving of non-fatal errors. 2019-03-27 21:50:01 +00:00
jme
kbd
kbdmux evdev: Use console lock as evdev lock for all supported keyboard drivers. 2018-10-27 20:22:41 +00:00
ksyms ksyms: Fixup symbols for powerpc in the kernel, not just modules 2019-05-20 02:41:09 +00:00
le
led Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
lge
liquidio Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
malo Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
mbox
mc146818
md When using the force option to shut down a memory-disk device, 2019-03-31 21:34:58 +00:00
mdio
mem
mfi Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
mge
mii Add driver for Xilinx AXI Ethernet tri-mode (10/100/1000 Mb/s) MAC found 2019-05-08 15:36:57 +00:00
mk48txx
mlx Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
mlx4 Include eventhandler.h in more compilation units 2019-05-21 01:18:43 +00:00
mlx5 Make sure the DMA tags get freed in mlx5en(4). 2019-06-04 08:06:51 +00:00
mlxfw Initial version of Mellanox in-kernel firmware upgrade support. 2019-05-08 10:49:05 +00:00
mly
mmc Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
mmcnull
mn
mpr Fix busy status leak in case of incorrect passthrough args. 2019-05-30 14:13:09 +00:00
mps Fix busy status leak in case of incorrect passthrough args. 2019-05-30 14:13:09 +00:00
mpt
mrsas add mrsas_shutdown method 2019-05-23 12:51:13 +00:00
msk
mthca
mvs
mwl Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
mxge
my
nand
nctgpio
neta Update mvneta/e6000sw for new DSA Device Tree Bindings 2019-03-23 02:48:47 +00:00
netfpga10g/nf10bmac
netmap Add two missing eventhandler.h headers 2019-05-21 00:04:19 +00:00
nfe Add support for the nForce MCP89 adapter. 2018-12-14 18:16:35 +00:00
nfsmb
nge
nmdm Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
ntb Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
null List-ify kernel dump device configuration 2019-05-06 18:24:07 +00:00
nvd Fix GCC build, failed due to false integer overflow in r343562. 2019-01-29 20:50:29 +00:00
nvdimm nvdimm: Provide nvdimm location information 2019-06-06 20:12:04 +00:00
nvme Fix nda(4) PCIe link status output 2019-06-07 18:34:48 +00:00
nvram
nvram2env
oce Fix array out of bound panic introduced in r306219. 2019-05-28 18:32:04 +00:00
ocs_fc Fixed issues reported by coverity scan. 2019-01-23 17:34:01 +00:00
ofw Define macros making it easier to define bus-specific pnpinfo for FDT systems. 2019-05-23 15:47:30 +00:00
otus urtw(4), otus(4), iwi(4): allow to set non-default MAC address via ifconfig(8) 2019-04-10 08:17:56 +00:00
ow Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
pbio
pccard Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
pccbb Remove All Rights Reserved 2019-02-05 21:37:34 +00:00
pcf pcf(4): fix parentheses in if condition 2019-01-27 15:19:28 +00:00
pci Only respond to the PCIe Attention Button if a device is already plugged in. 2019-06-05 04:58:42 +00:00
pms Fix a scribbler in the PMS driver. 2019-03-11 14:26:45 +00:00
powermac_nvram
ppbus
ppc
proto proto: change device permissions to 0600 2018-11-22 16:55:09 +00:00
psci PSCI: Don't take missing implementation of psci get_version() as fatal. 2019-03-19 15:42:11 +00:00
pst
pty
puc Remove All Rights Reserved 2019-02-05 21:37:34 +00:00
pwm Add back a const qualifier I somehow fumbled away between test-building 2019-06-17 03:48:44 +00:00
qlnx qlnxr(4), qlnxe(4): Unbreak gcc build 2019-02-01 23:04:45 +00:00
qlxgb
qlxgbe
qlxge
quicc
ral Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
random random(4): Generalize algorithm-independent APIs 2019-06-17 15:09:12 +00:00
rc Drop "All rights reserved" from my copyright statements. 2019-03-06 22:11:45 +00:00
rccgpio
re
rl
rndtest
rp
rt
rtwn Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
safe
sbni
scc Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
sdhci Add support for the GPIO SD Card VCC regulator/switch and the GPIO SD Card 2019-06-10 21:50:07 +00:00
sdio Add SDIO support. 2019-06-08 16:26:56 +00:00
sec
sfxge sfxge(4): use n Tx queues instead of n + 2 on EF10 HW 2018-12-10 09:36:05 +00:00
sge
siis
sio Remove All Rights Reserved 2019-02-05 21:37:34 +00:00
sis
sk
smartpqi Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
smbus
smc
snp
sound Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
speaker
spibus Use the new FDTCOMPAT_PNP_INFO() macro to define SPIBUS_FDT_PNP_INFO(). 2019-05-23 15:59:50 +00:00
ste
stge
sym
syscons Attempt to fix build breakage in r344458. 2019-02-26 09:44:10 +00:00
tcp_log Regularize the Netflix copyright 2019-02-04 21:28:25 +00:00
tdfx
terasic Fix off-by-one (page) errors in checks in d_mmap methods of several drivers. 2018-12-02 18:30:58 +00:00
ti Replace uses of vm_page_unwire(m, PQ_NONE) with vm_page_unwire_noq(m). 2019-06-07 18:23:29 +00:00
tpm Improve tpm20 style 2019-04-16 02:46:21 +00:00
trm
tsec
twa remove the 4GB boundary requirement on PCI DMA segments 2019-04-19 13:43:33 +00:00
twe
tws Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
uart Some devices take undesired actions when RTS and DTR are 2019-06-12 18:07:04 +00:00
ubsec
usb Some devices take undesired actions when RTS and DTR are 2019-06-12 18:07:04 +00:00
veriexec Add a new ioctl for the larger params struct that includes the label. 2019-05-17 19:27:07 +00:00
vge
viapm
viawd Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
videomode
virtio virtio(4): Add PNP match metadata for virtio devices 2019-06-04 02:37:11 +00:00
vkbd Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
vmware Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
vnic
vr
vt vt efifb: add suspend/resume calls 2019-05-21 18:42:36 +00:00
vte
watchdog Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
wbwd
wi Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
wpi Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
wtap Fix ieee80211_radiotap(9) usage in wireless drivers: 2019-03-11 01:27:01 +00:00
xdma Don't copy the data from bounce buffer back to the mbuf if channel does 2019-05-29 16:01:34 +00:00
xen Replace uses of vm_page_unwire(m, PQ_NONE) with vm_page_unwire_noq(m). 2019-06-07 18:23:29 +00:00
xilinx Add driver for the Xilinx AXI Direct Memory Access (AXI DMA) controller 2019-05-08 15:43:17 +00:00
xl
xz Modularize xz. 2019-02-26 19:55:03 +00:00