diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-09-18 15:58:36 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-09-18 16:33:11 +0200 |
commit | db4436a27611248669b675c06869a73240bfd4f9 (patch) | |
tree | 56d29e057a23d0cbb4f568661c87dc576c61341f /src/crypto/zinc/chacha20 | |
parent | c10704254d5147ecc076df8ce79ae338c7e4f76a (diff) |
chacha20: add independent self test
This was already tested from the chacha20poly1305 test, but it's useful
to be able to test this in isolation too.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/zinc/chacha20')
-rw-r--r-- | src/crypto/zinc/chacha20/chacha20.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/crypto/zinc/chacha20/chacha20.c b/src/crypto/zinc/chacha20/chacha20.c index ef2404f..a7c7adc 100644 --- a/src/crypto/zinc/chacha20/chacha20.c +++ b/src/crypto/zinc/chacha20/chacha20.c @@ -172,6 +172,8 @@ void hchacha20(u8 derived_key[CHACHA20_KEY_SIZE], } EXPORT_SYMBOL(hchacha20); +#include "../selftest/chacha20.h" + static bool nosimd __initdata = false; #ifndef COMPAT_ZINC_IS_A_MODULE @@ -182,6 +184,10 @@ static int __init mod_init(void) { if (!nosimd) chacha20_fpu_init(); +#ifdef DEBUG + if (!chacha20_selftest()) + return -ENOTRECOVERABLE; +#endif return 0; } |