random: early initialization of ChaCha constants
authorDominik Brodowski <linux@dominikbrodowski.net>
Fri, 31 Dec 2021 08:26:08 +0000 (09:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2022 09:46:30 +0000 (11:46 +0200)
commit4d4b3fc01e0fe47688ab082cdc1780673fb81ec0
tree876470e8538cc81a7537c5abe8923095bbeb1b2c
parent84647efd92bfb03569b12751d00ed0cde0b49b2d
random: early initialization of ChaCha constants

commit 96562f286884e2db89c74215b199a1084b5fb7f7 upstream.

Previously, the ChaCha constants for the primary pool were only
initialized in crng_initialize_primary(), called by rand_initialize().
However, some randomness is actually extracted from the primary pool
beforehand, e.g. by kmem_cache_create(). Therefore, statically
initialize the ChaCha constants for the primary pool.

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <linux-crypto@vger.kernel.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/random.c
include/crypto/chacha20.h