From 65ee1929a802c08ece43ec1edff99172a1128b8a Mon Sep 17 00:00:00 2001 From: Alexander Williams Date: Wed, 9 Aug 2023 10:35:50 -0700 Subject: [PATCH] [test] Fix lack of entropy for wycheproof test The test did not initialize the entropy complex to auto mode, and it would exhaust the available, finite entropy generated during boot, leading to freezing and timeouts. Add this test back to the FPGA suite. Signed-off-by: Alexander Williams --- sw/device/tests/crypto/BUILD | 6 +++--- sw/device/tests/crypto/rsa_3072_verify_functest.c | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sw/device/tests/crypto/BUILD b/sw/device/tests/crypto/BUILD index eaaf5e4613d122..e8f7feb0eae3a4 100644 --- a/sw/device/tests/crypto/BUILD +++ b/sw/device/tests/crypto/BUILD @@ -177,8 +177,7 @@ opentitan_functest( name = "rsa_3072_verify_functest_wycheproof", srcs = ["rsa_3072_verify_functest.c"], cw310 = cw310_params( - timeout = "long", - tags = ["broken"], # FIXME #16805 hangs at vector 170 + timeout = "moderate", ), targets = [ "cw310_test_rom", @@ -187,10 +186,10 @@ opentitan_functest( ], verilator = verilator_params( timeout = "eternal", - tags = ["broken"], # FIXME #16805 hangs at vector 165 after ~3h ), deps = [ ":rsa_3072_verify_testvectors_wycheproof_header", + "//sw/device/lib/crypto/drivers:entropy", "//sw/device/lib/crypto/drivers:hmac", "//sw/device/lib/crypto/drivers:otbn", "//sw/device/lib/crypto/impl/rsa:rsa_3072_verify", @@ -214,6 +213,7 @@ opentitan_functest( ), deps = [ ":rsa_3072_verify_testvectors_hardcoded_header", + "//sw/device/lib/crypto/drivers:entropy", "//sw/device/lib/crypto/drivers:hmac", "//sw/device/lib/crypto/drivers:otbn", "//sw/device/lib/crypto/impl/rsa:rsa_3072_verify", diff --git a/sw/device/tests/crypto/rsa_3072_verify_functest.c b/sw/device/tests/crypto/rsa_3072_verify_functest.c index 7c607a42e2aa73..d35119e342d855 100644 --- a/sw/device/tests/crypto/rsa_3072_verify_functest.c +++ b/sw/device/tests/crypto/rsa_3072_verify_functest.c @@ -3,6 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "sw/device/lib/base/memory.h" +#include "sw/device/lib/crypto/drivers/entropy.h" #include "sw/device/lib/crypto/drivers/otbn.h" #include "sw/device/lib/crypto/impl/rsa/rsa_3072_verify.h" #include "sw/device/lib/runtime/log.h" @@ -60,6 +61,9 @@ bool test_main(void) { // Stays true only if all tests pass. bool result = true; + // Set entropy complex to auto mode. + CHECK_STATUS_OK(entropy_complex_init()); + // The definition of `RULE_NAME` comes from the autogen Bazel rule. LOG_INFO("Starting rsa_3072_verify_test:%s", RULE_NAME); for (uint32_t i = 0; i < RSA_3072_VERIFY_NUM_TESTS; i++) {