From 9ee449fd0152dab11883c024dbafd5cfebef9b42 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 18 Sep 2018 15:58:36 +0200 Subject: 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. --- src/crypto/zinc/chacha20/chacha20.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/crypto/zinc/chacha20/chacha20.c') 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; } -- cgit v1.2.3-59-g8ed1b