diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-07 03:53:32 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-07 03:59:44 +0200 |
commit | 2d9f583e5ceb3ec38b28678d935c107a339cf6cd (patch) | |
tree | 4a9e576dfd2416fc3740e55a5076f2211aba807e | |
parent | 6548aad834639990f407a24a5de38c2eb435dae9 (diff) |
crypto: disable broken implementations in selftests
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/crypto/zinc/selftest/run.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/crypto/zinc/selftest/run.h b/src/crypto/zinc/selftest/run.h index 4cbafe2..99079a0 100644 --- a/src/crypto/zinc/selftest/run.h +++ b/src/crypto/zinc/selftest/run.h @@ -13,9 +13,8 @@ static inline bool selftest_run(const char *name, bool (*selftest)(void), bool *const nobs[], unsigned int nobs_len) { - unsigned long subset = 0, set = 0; + unsigned long set = 0, subset = 0, largest_subset = 0; unsigned int i; - bool ret = true; BUILD_BUG_ON(!__builtin_constant_p(nobs_len) || nobs_len >= BITS_PER_LONG); @@ -29,21 +28,21 @@ static inline bool selftest_run(const char *name, bool (*selftest)(void), do { for (i = 0; i < nobs_len; ++i) *nobs[i] = (subset >> i) & 1; - if (!selftest()) { - pr_err("%s self-test combo 0x%lx: FAIL\n", name, + if (selftest()) + largest_subset = max(subset, largest_subset); + else + pr_err("%s self-test combination 0x%lx: FAIL\n", name, subset); - ret = false; - } subset = (subset - set) & set; } while (subset); for (i = 0; i < nobs_len; ++i) - *nobs[i] = (set >> i) & 1; + *nobs[i] = (largest_subset >> i) & 1; - if (ret) + if (largest_subset == set) pr_info("%s self-tests: pass\n", name); - return !WARN_ON(!ret); + return !WARN_ON(largest_subset != set); } #endif |