Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete ITRNG health test documentation #1688

Open
akash-singh-NV opened this issue Aug 6, 2024 · 9 comments
Open

Incomplete ITRNG health test documentation #1688

akash-singh-NV opened this issue Aug 6, 2024 · 9 comments

Comments

@akash-singh-NV
Copy link

Current spec does not document which ITRNG health tests are enabled by Caliptra ROM in version and how are relevant thresholds calculated and passed from SOC integrator. It is important to document these because any inconsistencies would make Caliptra unusable due to ROM dependencies.

@varuns-nvidia varuns-nvidia transferred this issue from chipsalliance/Caliptra Sep 24, 2024
@varuns-nvidia
Copy link

@mhatrevi @jhand2 could you help with documenting the TRNG health tests in the ROM spec?

@jhand2
Copy link
Collaborator

jhand2 commented Sep 24, 2024

Health test thresholds are set here but I don't know how they were chosen. @korran do you know?

The health tests are are done by the IP are briefly described here.

It looks like we support 2 health checks (the two that are supported by the OpenTitan IP we use):

  • Repetition Count Test
  • Adaptive Proportion Test

The documentation for that IP lists two other checks ("Bucket and Markov tests"), but I don't see anything in ROM that configures them. Is anyone else on the thread able to confirm that these are not enabled?

@jhand2
Copy link
Collaborator

jhand2 commented Sep 24, 2024

It looks like Kor has also created this PR with some guidance chipsalliance/caliptra-rtl#569. Does this cover what you're looking for?

@akash-singh-NV
Copy link
Author

Kor's PR covers this to an extent. We also need to specify -

  1. How ITRNG interprets 4 bit raw noise data - binary symbols vs 4-bit symbols ?
  2. RCT implementation in Caliptra 1.x ITRNG + ROM combination is slightly different from expected. Ideally a programmed threshold of N should result in failure when ITRNG sees N identical bits (assuming binary noise source) or N identical 4 bit symbols (assuming non binary 4 bit noise source). However, Caliptra 1.x implementation will flag a failure if ITRNG sees N repetitions on any of the 4 bit lines.

@varuns-nvidia
Copy link

@howardtr for the above questions

@akash-singh-NV
Copy link
Author

Pinging @howardtr

@korran
Copy link
Collaborator

korran commented Oct 23, 2024

  1. How ITRNG interprets 4 bit raw noise data - binary symbols vs 4-bit symbols ?

The ROM is setting threshold_scope=TRUE, which IIUC is equivalent to serializing the 4-bit values to a 1-bit stream and running the tests on that. Would need to write tests that stick one of the channels to confirm this understanding, and I don't have time to do that now.

To do this properly we probably need to allow vendors to configure THRESHOLD_SCOPE and RNG_BIT_ENABLE depending on the nature of their noise source.

@korran
Copy link
Collaborator

korran commented Oct 23, 2024

However, Caliptra 1.x implementation will flag a failure if ITRNG sees N repetitions on any of the 4 bit lines.

Are you sure? The threshold_scope docs indicate otherwise:

https://chipsalliance.github.io/caliptra-rtl/main/internal-regs/?p=clp.entropy_src_reg.CONF#THRESHOLD_SCOPE.desc

@akash-singh-NV
Copy link
Author

However, Caliptra 1.x implementation will flag a failure if ITRNG sees N repetitions on any of the 4 bit lines.

Are you sure? The threshold_scope docs indicate otherwise:

https://chipsalliance.github.io/caliptra-rtl/main/internal-regs/?p=clp.entropy_src_reg.CONF#THRESHOLD_SCOPE.desc

Yes, looking at the RTL : https://github.com/chipsalliance/caliptra-rtl/blob/main/src/entropy_src/rtl/entropy_src_repcnt_ht.sv.

Also, threshold_scope doesn't apply to RCT. It applies only to APT and Markov tests as per the doc.

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

No branches or pull requests

4 participants