random: initialize ChaCha20 constants with correct endianness
authorEric Biggers <ebiggers@google.com>
Mon, 22 Mar 2021 05:13:47 +0000 (22:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2022 09:46:30 +0000 (11:46 +0200)
commit84647efd92bfb03569b12751d00ed0cde0b49b2d
tree0c616210705b0f0be90765923ec593efe472cd78
parent048cc34c4cdf82ff5aeebf474de4f23f5def8313
random: initialize ChaCha20 constants with correct endianness

commit a181e0fdb2164268274453b5b291589edbb9b22d upstream.

On big endian CPUs, the ChaCha20-based CRNG is using the wrong
endianness for the ChaCha20 constants.

This doesn't matter cryptographically, but technically it means it's not
ChaCha20 anymore.  Fix it to always use the standard constants.

Cc: linux-crypto@vger.kernel.org
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
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