5 #include "sw/device/lib/base/status.h"
6 #include "sw/device/lib/crypto/drivers/entropy.h"
9 #include "sw/device/lib/testing/randomness_quality.h"
10 #include "sw/device/lib/testing/test_framework/check.h"
15 #define MODULE_ID MAKE_MODULE_ID('t', 's', 't')
17 OTTF_DEFINE_TEST_CONFIG();
19 static const uint32_t kTestSeed[12] = {
20 0x73bec010, 0x9262474c, 0x16a30f76, 0x531b51de, 0x2ee494e5, 0xdfec9db3,
21 0xcb7a879d, 0x5600419c, 0xca79b0b0, 0xdda33b5c, 0xa468649e, 0xdf5d73fa};
24 static const uint32_t kExpOutput[16] = {
25 0xd1c07cd9, 0x5af8a7f1, 0x1012c84c, 0xe48bb8cb, 0x87189e99, 0xd40fccb1,
26 0x771c619b, 0xdf82ab22, 0x80b1dc2f, 0x2581f391, 0x64f7ac0c, 0x510494b3,
27 0xa43c41b7, 0xdb17514c, 0x87b107ae, 0x793e01c5,
36 .data = (
const unsigned char *)kTestSeed,
37 .len =
sizeof(kTestSeed),
43 uint32_t actual_output_words[
ARRAYSIZE(kExpOutput)];
45 .data = actual_output_words,
58 TRY_CHECK_ARRAYS_EQ(kExpOutput, actual_output_words,
ARRAYSIZE(kExpOutput));
59 TRY_CHECK_ARRAYS_EQ(kExpOutput, kExpOutput, 0);
69 uint32_t output_data[1024];
77 return randomness_quality_monobit_test(
78 (
unsigned char *)output_data,
sizeof(output_data),
79 kRandomnessQualitySignificanceOnePercent);
86 CHECK_STATUS_OK(entropy_complex_init());
87 CHECK_STATUS_OK(entropy_complex_check());
91 return status_ok(result);