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

[lc_ctrl] Use unique diversification values #21372

Merged
merged 7 commits into from
Feb 16, 2024

Conversation

msfschaffner
Copy link
Contributor

@msfschaffner msfschaffner commented Feb 14, 2024

This makes the diversification values fed to the keymgr unique for each group of life cycle states.

Fixes #14047


This is dependent on #21320 - only the last commit is relevant. We merge all commits from #21320 with this PR however, since CI load is currently very high and that reduces turnaround time for the collection of changes. Note that #21320 has been approved separately already.

@msfschaffner msfschaffner self-assigned this Feb 14, 2024
@msfschaffner msfschaffner requested a review from a team as a code owner February 14, 2024 19:26
@msfschaffner msfschaffner requested review from marnovandermaas and removed request for a team February 14, 2024 19:26
@msfschaffner msfschaffner force-pushed the lc-ctrl-div-const branch 2 times, most recently from 6948d41 to c3140fd Compare February 14, 2024 19:31
@msfschaffner msfschaffner removed the request for review from marnovandermaas February 14, 2024 19:31
@msfschaffner msfschaffner requested review from cfrantz and a team as code owners February 14, 2024 19:37
@msfschaffner msfschaffner removed request for cfrantz and a team February 14, 2024 19:38
@msfschaffner msfschaffner force-pushed the lc-ctrl-div-const branch 5 times, most recently from 7d17c8d to 09c1060 Compare February 14, 2024 20:16
@msfschaffner msfschaffner force-pushed the lc-ctrl-div-const branch 4 times, most recently from 0f8ec7d to a191e1c Compare February 15, 2024 07:02
This addresses the design side of lowRISC#18250

Signed-off-by: Michael Schaffner <[email protected]>
This addresses the block-level DV parts of lowRISC#18250.

Signed-off-by: Michael Schaffner <[email protected]>
When we are in RMA or PROD_END state, we can't inject a transition
error since the only valid transition is into SCRAP (and that transition
is always allowed, no matter the transition counter).

While we make sure to not initialize the DUT with RMA or PROD_END if we
intend to inject such an error, it can happen that we end up in one of
these states when running multiple transactions back-to-back. In those
cases we need to catch the corner case and make sure we skip the
life cycle transition attempt.

Signed-off-by: Michael Schaffner <[email protected]>
Some CSR accesses via JTAG take a long time, hence the timeout
in wait_to_issue_reset() needs to be higher so that the function
does not error out unexpectedly.

Signed-off-by: Michael Schaffner <[email protected]>
Besides being able to test the volatile RAW unlock mechanism,
we should also be able to test whether the case where that
mechanism has been disabled in HW.

This patch adds a plusarg that allows to parameterize the test with our
expectation.

In production silicon this mechanism should be disabled, for example.

Signed-off-by: Michael Schaffner <[email protected]>
parameter lc_keymgr_div_t RndCnstLcKeymgrDivProduction = LcKeymgrDivWidth'(3),
parameter lc_keymgr_div_t RndCnstLcKeymgrDivRma = LcKeymgrDivWidth'(4),
parameter lc_token_mux_t RndCnstInvalidTokens = {TokenMuxBits{1'b1}},
parameter bit SecVolatileRawUnlockEn = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the parameters for these diversification values are defined here and input into lc_ctrl_fsm and are just not in the package file, because they will be fed from the netlist constants?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, in order to use the random constant mechanism, these need to be defined as instantiation parameters so that we can feed them in from the top-level. This way, we can also make sure that different instances of the same block get different values. This is not important for LC_CTRL, but it is useful for other modules like ROM_CTRL or SRAM_CTRL that may be instantiated multiple times.

hw/ip/lc_ctrl/doc/interfaces.md Outdated Show resolved Hide resolved
@@ -77,7 +77,13 @@
randcount: "128",
randtype: "data",
}
{ name: "RndCnstLcKeymgrDivTestDevRma",
{ name: "RndCnstLcKeymgrDivTestUnlocked",
desc: "Compile-time random bits for lc state group diversification value",
Copy link
Contributor

@gdessouky gdessouky Feb 15, 2024

Choose a reason for hiding this comment

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

Nit: it's intuitive from the name, but can probably also add the name of the lc state in the description of each of these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes good point, let me make those descriptions a bit more informative.

@msfschaffner msfschaffner force-pushed the lc-ctrl-div-const branch 2 times, most recently from 9f8b4c4 to 1a1c45b Compare February 15, 2024 19:22
Copy link
Contributor

@vogelpi vogelpi left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks @msfschaffner .

// Check for any error bits set - however, we exclude the status that
// we are looking for in this comparison, since otherwise this
// function would just bail.
if polled_status.intersects(LcCtrlStatus::ERRORS & !status) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@timothytrippel FYI - this is needed so that we can wait for specific error statuses.

This updates the manuf_cp_volatile_unlock_raw test so that
we can indicate whether we expect the target to support volatile RAW
unlock or not.

Signed-off-by: Michael Schaffner <[email protected]>
This makes the diversification values fed to the keymgr
unique for each group of life cycle states.

Fixes lowRISC#14047

Signed-off-by: Michael Schaffner <[email protected]>
@msfschaffner msfschaffner merged commit 60650e0 into lowRISC:master Feb 16, 2024
32 checks passed
Copy link
Contributor

@andreaskurth andreaskurth left a comment

Choose a reason for hiding this comment

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

Post-merge LGTM 👍

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.

[lc_ctrl] keymgr div key inconsistency
5 participants