Skip to content

Commit

Permalink
[test] Fix lack of entropy for wycheproof test
Browse files Browse the repository at this point in the history
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 <awill@opentitan.org>
  • Loading branch information
a-will authored and timothytrippel committed Sep 1, 2023
1 parent c6801a1 commit 13c735c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sw/device/tests/crypto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions sw/device/tests/crypto/rsa_3072_verify_functest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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++) {
Expand Down

0 comments on commit 13c735c

Please sign in to comment.