selftests: vDSO: open code basic chacha instead of linking to libsodium
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 28 Aug 2024 13:49:32 +0000 (15:49 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 13 Sep 2024 15:28:35 +0000 (17:28 +0200)
commit7fe5b3e4e7a61f3640d7645c434ac8c982f1388e
tree10dc19ffe6bd21bd25dc432d4654a0598e484237
parent6fd13b282f62bd840f2410692deaa23a42fd91fa
selftests: vDSO: open code basic chacha instead of linking to libsodium

Linking to libsodium makes building this test annoying in cross
compilation environments and is just way too much. Since this is just a
basic correctness test, simply open code a simple, unoptimized, dumb
chacha, rather than linking to libsodium.

This also fixes a correctness issue on big endian systems. The kernel's
random.c doesn't bother doing a le32_to_cpu operation on the random
bytes that are passed as the key, and consequently neither does
vgetrandom-chacha.S. However, libsodium's chacha _does_ do this, since
it takes the key as an array of bytes. This meant that the test was
broken on big endian systems, which this commit rectifies.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
tools/testing/selftests/vDSO/Makefile
tools/testing/selftests/vDSO/vdso_test_chacha.c