]> git.baikalelectronics.ru Git - kernel.git/commit
random: document crng_fast_key_erasure() destination possibility
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 18 Apr 2022 18:57:31 +0000 (20:57 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 25 Apr 2022 15:26:40 +0000 (17:26 +0200)
commit6f4322e7beb676a060ba213ea8ec53066a51e4af
tree7cf2ca0c064d7f735504e82602b310029daa1b68
parentb9f8d2f498fe4c118f5c77a2789962e442c78a90
random: document crng_fast_key_erasure() destination possibility

This reverts 258bb822fd17 ("random: use memmove instead of memcpy for
remaining 32 bytes"), which was made on a totally bogus basis. The thing
it was worried about overlapping came from the stack, not from one of
its arguments, as Eric pointed out.

But the fact that this confusion even happened draws attention to the
fact that it's a bit non-obvious that the random_data parameter can
alias chacha_state, and in fact should do so when the caller can't rely
on the stack being cleared in a timely manner. So this commit documents
that.

Reported-by: Eric Biggers <ebiggers@kernel.org>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
drivers/char/random.c