Skip to content

Conversation

rivos-eblot
Copy link

No description provided.

As Verilator is run from a temporary directory rather than the one which
the script is launched from:

1. when an alternative artifact path is specified, it should be stored as
an absolute path,
2. RAM/ROM/eFlash/OTP file paths should be stored as absolute paths

Beware that the memory initializer functions seem to silently ignore any
invalid file path.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
@rivos-eblot rivos-eblot force-pushed the dev/ebl/vtor_abs_path branch from 84e2951 to 45974a8 Compare October 10, 2025 10:34
@rivos-eblot
Copy link
Author

rivos-eblot commented Oct 13, 2025

It seems that //sw/device/tests/crypto:symmetric_keygen_functest_sim_qemu_sival_rom_ext keeps failing

Copy link

@AlexJones0 AlexJones0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

It seems that //sw/device/tests/crypto:symmetric_keygen_functest_sim_qemu_sival_rom_ext keeps failing

This test is failing because it checks for the quality of the randomness, which is sometimes not good enough in the QEMU model. This passes consistently for me locally on the latest earlgrey_1.0.0/ot-9.2.0 checkouts, but given it is failing in CI feel free to ignore the failure (and ideally, mark it flaky in the tests file).

Comment on lines 276 to 277
# for some reason, Verilator ouput log message to stdout
# not stderr

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# for some reason, Verilator ouput log message to stdout
# not stderr
# for some reason, Verilator outputs log messages to stdout,
# not stderr

@rivos-eblot
Copy link
Author

rivos-eblot commented Oct 13, 2025

LGTM.

It seems that //sw/device/tests/crypto:symmetric_keygen_functest_sim_qemu_sival_rom_ext keeps failing

This test is failing because it checks for the quality of the randomness, which is sometimes not good enough in the QEMU model. This passes consistently for me locally on the latest earlgrey_1.0.0/ot-9.2.0 checkouts, but given it is failing in CI feel free to ignore the failure (and ideally, mark it flaky in the tests file).

Oh ok, thanks for the details. There is a feature (I need to dig into the code as I wrote it but already forgot about it) in the entropy stack that deals with something that could be worth to check: I forgot the context, but as it may (too much) time to get proper entropy in QEMU, this was causing trouble with some tests or some apps. Therefore, there is a feature that triggers in if no entropy cannot be made available fast enough at boot that bypasses the full entropy stack and delivers low-quality entropy. However I think this was only triggered at boot up stage, not at runtime. Maybe the feature is bugged. Although I guess that if entropy quality measurement is done within the entropy_src, several registers (health tests, etc.) are not implemented at all.

@rivos-eblot rivos-eblot force-pushed the dev/ebl/vtor_abs_path branch from 45974a8 to 7745fb2 Compare October 13, 2025 09:51
… the logger

OpenTitan Verilator wrapper silently ignores:

1. Any unknown argument from the command line
2. Invalid file paths to initialize memory device (if a non-existing file is submitted,
    simulation begins anyway with an unexpected outcome)

However invalid path are reported as a mere warning on the standard output stream,
from the $readmemh Verilog function. Add a special filter to extract Verilator message
out of the verbose Verilator wrapper output so the issue can be signaled back to the
user.

Also disable CLI command line simplification when debug mode is enabled, to track
the exact file path of each initialized file in this mode.

Side note: OT wrapper relies on the file extension to figure out the type of a file,
not its content.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
@rivos-eblot rivos-eblot force-pushed the dev/ebl/vtor_abs_path branch from 7745fb2 to d496957 Compare October 13, 2025 09:51
@AlexJones0
Copy link

AlexJones0 commented Oct 13, 2025

I forgot the context, but as it may (too much) time to get proper entropy in QEMU, this was causing trouble with some tests or some apps. Therefore, there is a feature that triggers in if no entropy cannot be made available fast enough at boot that bypasses the full entropy stack and delivers low-quality entropy.

Are you referring to e.g. ot_otp_dj_fake_entropy, or something in the entropy complex stack itself? I'm aware of the former, and in fact we get a non-fatal error log for every test run on Earlgrey because it always needs to fake some entropy on boot 😅

@rivos-eblot
Copy link
Author

Are you referring to e.g. ot_otp_dj_fake_entropy,

Yes, this one, you better know my code than I do :)

I'm aware of the former, and in fact we get a non-fatal error log for every test run on Earlgrey because it always needs to fake some entropy on boot 😅

Maybe we need to change this to a trace then. It was mostly informative. I initially used an error_report not to forget this "feature" in case it would have led to some other bugs, but it seems safe.

Is the test reporting bad entropy using some of the advance entropy_src monitoring (and unimplemented) registers or is the test checking entropy quality on its own? As the entropy stack implements all the complex entropy processing stages, I hope it's only the monitoring registers that are not implemented.

Sorry about this full off-topic thread.

@AlexJones0
Copy link

AlexJones0 commented Oct 13, 2025

Is the test reporting bad entropy using some of the advance entropy_src monitoring (and unimplemented) registers or is the test checking entropy quality on its own?

On its own, as part of the test it generates symmetric keys and then does a basic statistical check by counting the number of 0 and 1 bits in the keyblob. If they aren't roughly similar, the test fails. It does this for AES, KMAC and HMAC. I guess we might expect this to sometimes because of the lack of masking with entropy in e.g. KMAC.

(sorry, I should have been more clear it was the randomness in the generated keys and not necessarily the entropy stack itself).

@rivos-eblot
Copy link
Author

(sorry, I should have been more clear it was the randomness in the generated keys and not necessarily the entropy stack itself).

Ok, much clearer. If I get it right, you are referring to QEMU setting a half of the key share to 0, while setting the other half to the actual keyshare value(?). Could we simply "randomize" the first half with a random number and XOR-ing the second half with the first half?

@rivos-eblot rivos-eblot merged commit f373fa4 into lowRISC:ot-9.2.0 Oct 13, 2025
15 of 16 checks passed
@rivos-eblot rivos-eblot deleted the dev/ebl/vtor_abs_path branch October 13, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants