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

Integration docs: Add recommended TRNG self-test thresholds. #569

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/CaliptraIntegrationSpecification.md
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,33 @@ The ROM and firmware currently time out on the TRNG interface after 250,000
attempts to read a DONE bit. This bit is set in the architectural registers, as
referenced in 3 in the preceding list.

## Recommended TRNG self-test thresholds

The default TRNG thresholds should be tuned to match the entropy estimate of the
noise source (H). For example:

$α = 2^{-40}$ (recommended)\
$H = 0.5$ (example)\
$W = 2048$ (constant in ROM/hw)

`CPTRA_iTRNG_ENTROPY_CONFIG0.high_threshold` = $1 + critbinom(W, 2^{-H}, 1 - α)$ [^1]\
`CPTRA_iTRNG_ENTROPY_CONFIG0.high_threshold` = $1 + critbinom(2048, 2^{-H}, 1 - 2^{-40})$\
`CPTRA_iTRNG_ENTROPY_CONFIG0.high_threshold` = 1591

`CPTRA_iTRNG_ENTROPY_CONFIG0.low_threshold` = W - `CPTRA_iTRNG_ENTROPY_CONFIG0.high_threshold`\
`CPTRA_iTRNG_ENTROPY_CONFIG0.low_threshold` = 2048 - `CPTRA_iTRNG_ENTROPY_CONFIG0.high_threshold`\
`CPTRA_iTRNG_ENTROPY_CONFIG0.low_threshold` = 457

$$RcThresh = \frac{-log_2(α)}{H} + 1$$

$$RcThresh = \frac{40}{H} + 1$$

$$RcThresh = 81$$

`CPTRA_iTRNG_ENTROPY_CONFIG1.repetition_count` = $RcThresh$ = 81

[^1]: The critbinom function is implemented by most spreadsheet applications.

# SRAM implementation

## Overview
Expand Down
Loading