linux/arch/s390
Harald Freudenberger ff98cc986a s390/crypto: add arch_get_random_long() support
The random longs to be pulled by arch_get_random_long() are
prepared in an 4K buffer which is filled from the NIST 800-90
compliant s390 drbg. By default the random long buffer is refilled
256 times before the drbg itself needs a reseed. The reseed of the
drbg is done with 32 bytes fetched from the high quality (but slow)
trng which is assumed to deliver 100% entropy. So the 32 * 8 = 256
bits of entropy are spread over 256 * 4KB = 1MB serving 131072
arch_get_random_long() invocations before reseeded.

How often the 4K random long buffer is refilled with the drbg
before the drbg is reseeded can be adjusted. There is a module
parameter 's390_arch_rnd_long_drbg_reseed' accessible via
  /sys/module/arch_random/parameters/rndlong_drbg_reseed
or as kernel command line parameter
  arch_random.rndlong_drbg_reseed=<value>
This parameter tells how often the drbg fills the 4K buffer before
it is re-seeded by fresh entropy from the trng.
A value of 16 results in reseeding the drbg at every 16 * 4 KB = 64
KB with 32 bytes of fresh entropy pulled from the trng. So a value
of 16 would result in 256 bits entropy per 64 KB.
A value of 256 results in 1MB of drbg output before a reseed of the
drbg is done. So this would spread the 256 bits of entropy among 1MB.
Setting this parameter to 0 forces the reseed to take place every
time the 4K buffer is depleted, so the entropy rises to 256 bits
entropy per 4K or 0.5 bit entropy per arch_get_random_long().  With
setting this parameter to negative values all this effort is
disabled, arch_get_random long() returns false and thus indicating
that the arch_get_random_long() feature is disabled at all.

arch_get_random_long() is used by random.c among others to provide
an initial hash value to be mixed with the entropy pool on every
random data pull. For about 64 bytes read from /dev/urandom there
is one call to arch_get_random_long(). So these additional random
long values count for performance of /dev/urandom with measurable
but low penalty.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Juergen Christ <jchrist@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2020-12-10 21:02:08 +01:00
..
appldata s390/appldata: use struct_size() helper 2020-06-29 16:32:34 +02:00
boot s390/boot: add build-id to decompressor 2020-12-09 21:02:07 +01:00
configs s390/mm: add debug user asce support 2020-11-23 12:01:12 +01:00
crypto s390/crypto: add arch_get_random_long() support 2020-12-10 21:02:08 +01:00
hypfs fs_parse: fold fs_parameter_desc/fs_parameter_spec 2020-02-07 14:48:37 -05:00
include s390/crypto: add arch_get_random_long() support 2020-12-10 21:02:08 +01:00
kernel s390/smp: perform initial CPU reset also for SMT siblings 2020-12-09 21:02:08 +01:00
kvm mm/gup: remove task_struct pointer for all gup code 2020-08-12 10:58:04 -07:00
lib s390/mm: add debug user asce support 2020-11-23 12:01:12 +01:00
mm s390/mm: use invalid asce instead of kernel asce 2020-11-23 12:01:12 +01:00
net s390/bpf: Fix multiple tail calls 2020-09-14 18:21:31 -07:00
oprofile s390/unwind: introduce stack unwind API 2019-05-02 13:54:11 +02:00
pci s390/mm: remove set_fs / rework address space handling 2020-11-23 12:01:12 +01:00
purgatory s390/kexec_file: fix diag308 subcode when loading crash kernel 2020-12-09 21:02:07 +01:00
tools .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Kbuild s390/numa: move code to arch/s390/kernel 2020-08-11 18:16:55 +02:00
Kconfig s390/Kconfig: default PCI_NR_FUNCTIONS to 512 2020-11-30 14:10:49 +01:00
Kconfig.debug s390/mm: add debug user asce support 2020-11-23 12:01:12 +01:00
Makefile s390/decompressor: add stacktrace support 2020-11-20 19:19:11 +01:00