]> git.baikalelectronics.ru Git - kernel.git/commit
siphash: use one source of truth for siphash permutations
authorJason A. Donenfeld <Jason@zx2c4.com>
Sat, 7 May 2022 12:03:46 +0000 (14:03 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 18 May 2022 13:53:52 +0000 (15:53 +0200)
commitb7065131ae2ce5b45d26ac80d9ec5e553f7eb095
tree151a956250ad489a31c98047f24ea82fa157a1a8
parentaca3efaf4ca9bc9a77d7b0134e186d47d7481f54
siphash: use one source of truth for siphash permutations

The SipHash family of permutations is currently used in three places:

- siphash.c itself, used in the ordinary way it was intended.
- random32.c, in a construction from an anonymous contributor.
- random.c, as part of its fast_mix function.

Each one of these places reinvents the wheel with the same C code, same
rotation constants, and same symmetry-breaking constants.

This commit tidies things up a bit by placing macros for the
permutations and constants into siphash.h, where each of the three .c
users can access them. It also leaves a note dissuading more users of
them from emerging.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
drivers/char/random.c
include/linux/prandom.h
include/linux/siphash.h
lib/siphash.c