5 #include "sw/device/tests/otbn_randomness_impl.h"
11 #include "sw/device/lib/testing/test_framework/check.h"
21 static const otbn_addr_t kVarIters =
OTBN_ADDR_T_INIT(randomness, iterations);
23 static const otbn_addr_t kVarFailIdx =
OTBN_ADDR_T_INIT(randomness, fail_idx);
25 static const otbn_addr_t kVarUrndOut =
OTBN_ADDR_T_INIT(randomness, urnd_out);
30 static void print_uint256(dif_otbn_t *otbn,
const otbn_addr_t var,
32 uint32_t data[32 /
sizeof(uint32_t)];
34 LOG_INFO(
"%s0x%08x%08x%08x%08x%08x%08x%08x%08x", prefix, data[7], data[6],
35 data[5], data[4], data[3], data[2], data[1], data[0]);
38 void otbn_randomness_test_start(dif_otbn_t *otbn, uint32_t iters) {
39 otbn_randomness_test_prepare(otbn, iters);
43 void otbn_randomness_test_prepare(dif_otbn_t *otbn, uint32_t iters) {
46 uint32_t rv = UINT32_MAX;
54 bool otbn_randomness_test_end(dif_otbn_t *otbn,
bool skip_otbn_done_check) {
55 if (!skip_otbn_done_check) {
64 LOG_ERROR(
"ERROR: Test with index %d failed.", fail_idx);
70 void otbn_randomness_test_log_results(dif_otbn_t *otbn) {
71 print_uint256(otbn, kVarRndOut,
"rnd = ");
72 print_uint256(otbn, kVarUrndOut,
"urnd = ");