Add a new self test to entropy module
The self test is a quick way to check at startup whether the entropy
sources are functioning correctly. The self test only polls 8 bytes
from the default entropy source and performs the following checks:
- The bytes are not all 0x00 or 0xFF.
- The hardware does not return an error when polled.
- The entropy does not provide data in a patter. Only check pattern
at byte, word and long word sizes.
diff --git a/programs/test/selftest.c b/programs/test/selftest.c
index 89c6616..62fa5fb 100644
--- a/programs/test/selftest.c
+++ b/programs/test/selftest.c
@@ -375,6 +375,12 @@
{
suites_failed++;
}
+#if !defined(MBEDTLS_TEST_NULL_ENTROPY) && defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
+ if( mbedtls_entropy_self_test_bias( v ) != 0)
+ {
+ suites_failed++;
+ }
+#endif
suites_tested++;
#endif