]> git.ipfire.org Git - thirdparty/systemd.git/commit - docs/RANDOM_SEEDS.md
random-util: remove RDRAND usage
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 7 Mar 2022 05:15:44 +0000 (22:15 -0700)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 14 Mar 2022 19:47:13 +0000 (19:47 +0000)
commitffa047a03e4c5f6bd3af73b7eecb99cd230fe204
treeec7d89170b956d63cb5ac04a4e77251d77aea7bc
parente28770e3674c42365eb22adf35a556e8cccb9bfb
random-util: remove RDRAND usage

/dev/urandom is seeded with RDRAND. Calling genuine_random_bytes(...,
..., 0) will use /dev/urandom as a last resort. Hence, we gain nothing
here by having our own RDRAND wrapper, because /dev/urandom already is
based on RDRAND output, even before /dev/urandom has fully initialized.

Furthermore, RDRAND is not actually fast! And on each successive
generation of new x86 CPUs, from both AMD and Intel, it just gets
slower.

This commit simplifies things by just using /dev/urandom in cases where
we before might use RDRAND, since /dev/urandom will always have RDRAND
mixed in as part of it.

And above where I say "/dev/urandom", what I actually mean is
GRND_INSECURE, which is the same thing but won't generate warnings in
dmesg.
NEWS
docs/ENVIRONMENT.md
docs/PORTING_TO_NEW_ARCHITECTURES.md
docs/RANDOM_SEEDS.md
src/basic/random-util.c
src/basic/random-util.h
src/libsystemd/sd-id128/sd-id128.c
src/test/test-random-util.c
src/udev/net/link-config.c