Skip to content

Commit b5e4152

Browse files
committed
[hw,lc_ctrl,rtl] Only consider lc_ctrl tokens to be secret
Signed-off-by: Robert Schilling <[email protected]>
1 parent 0469d01 commit b5e4152

23 files changed

+279
-606
lines changed

hw/ip/lc_ctrl/dv/cov/lc_ctrl_volatile_unlock_enabled_unr_exclude.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ Condition 4 "3444895930" "((lc_state_q == LcStRaw) && (trans_target_i == {lc_ctr
12461246
ANNOTATION: "VC_COV_UNR"
12471247
Condition 4 "3444895930" "((lc_state_q == LcStRaw) && (trans_target_i == {lc_ctrl_state_pkg::DecLcStateNumRep {DecLcStTestUnlocked0}}) && ((!trans_invalid_error_o))) 1 -1" (3 "110")
12481248
ANNOTATION: "VC_COV_UNR"
1249-
Condition 7 "2326366313" "(unhashed_token_i == lc_ctrl_state_pkg::RndCnstRawUnlockTokenHashed) 1 -1" (1 "0")
1249+
Condition 7 "2326366313" "(unhashed_token_i == lc_ctrl_token_pkg::RndCnstRawUnlockTokenHashed) 1 -1" (1 "0")
12501250
ANNOTATION: "VC_COV_UNR"
12511251
Condition 8 "1288749660" "((lc_cnt_q == LcCnt0) ? LcCnt1 : lc_cnt_q) 1 -1" (2 "1")
12521252
ANNOTATION: "VC_COV_UNR"

hw/ip/lc_ctrl/dv/env/seq_lib/lc_ctrl_errors_vseq.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@ class lc_ctrl_errors_vseq extends lc_ctrl_smoke_vseq;
518518
lc_ctrl_state_pkg::lc_token_t token_err_inj;
519519
kmac_pkg::rsp_digest_t kmac_digest;
520520

521-
tokens_a[ZeroTokenIdx] = lc_ctrl_state_pkg::AllZeroTokenHashed;
522-
tokens_a[RawUnlockTokenIdx] = lc_ctrl_state_pkg::RndCnstRawUnlockTokenHashed;
521+
tokens_a[ZeroTokenIdx] = lc_ctrl_token_pkg::AllZeroTokenHashed;
522+
tokens_a[RawUnlockTokenIdx] = lc_ctrl_token_pkg::RndCnstRawUnlockTokenHashed;
523523
tokens_a[TestUnlockTokenIdx] = cfg.lc_ctrl_vif.otp_i.test_unlock_token;
524524
tokens_a[TestExitTokenIdx] = cfg.lc_ctrl_vif.otp_i.test_exit_token;
525525
tokens_a[RmaTokenIdx] = cfg.lc_ctrl_vif.otp_i.rma_token;

hw/ip/lc_ctrl/dv/env/seq_lib/lc_ctrl_smoke_vseq.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ class lc_ctrl_smoke_vseq extends lc_ctrl_base_vseq;
122122
kmac_pkg::rsp_digest_t kmac_digest;
123123
// No token for InvalidTokenIdx
124124
lc_ctrl_state_pkg::lc_token_t tokens_a[NumTokens-1];
125-
tokens_a[ZeroTokenIdx] = lc_ctrl_state_pkg::AllZeroTokenHashed;
126-
tokens_a[RawUnlockTokenIdx] = lc_ctrl_state_pkg::RndCnstRawUnlockTokenHashed;
125+
tokens_a[ZeroTokenIdx] = lc_ctrl_token_pkg::AllZeroTokenHashed;
126+
tokens_a[RawUnlockTokenIdx] = lc_ctrl_token_pkg::RndCnstRawUnlockTokenHashed;
127127
tokens_a[TestUnlockTokenIdx] = cfg.lc_ctrl_vif.otp_i.test_unlock_token;
128128
tokens_a[TestExitTokenIdx] = cfg.lc_ctrl_vif.otp_i.test_exit_token;
129129
tokens_a[RmaTokenIdx] = cfg.lc_ctrl_vif.otp_i.rma_token;

hw/ip/lc_ctrl/dv/env/seq_lib/lc_ctrl_volatile_unlock_smoke_vseq.sv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class lc_ctrl_volatile_unlock_smoke_vseq extends lc_ctrl_smoke_vseq;
3737
lc_cnt_int = dec_lc_cnt(lc_cnt);
3838
if (lc_cnt != LcCnt24) begin
3939
int exp_lc_cnt = lc_cnt_int == 0 ? 1 : lc_cnt_int;
40-
lc_ctrl_state_pkg::lc_token_t token_val = lc_ctrl_state_pkg::RndCnstRawUnlockTokenHashed;
40+
lc_ctrl_state_pkg::lc_token_t token_val = lc_ctrl_token_pkg::RndCnstRawUnlockTokenHashed;
4141
csr_wr(ral.claim_transition_if, CLAIM_TRANS_VAL);
4242
csr_wr(ral.transition_ctrl.volatile_raw_unlock, 1);
4343
csr_wr(ral.transition_target, {DecLcStateNumRep{next_state[DecLcStateWidth-1:0]}});

hw/ip/lc_ctrl/lc_ctrl.core

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ filesets:
2121
- lowrisc:ip:otp_macro_pkg
2222
- lowrisc:ip:kmac_pkg
2323
- lowrisc:ip:rv_dm
24+
- lowrisc:virtual_constants:lc_ctrl_token_pkg
2425
files:
2526
- rtl/lc_ctrl_regs_reg_top.sv
2627
- rtl/lc_ctrl_dmi_reg_top.sv

hw/ip/lc_ctrl/lc_ctrl_pkg.core

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ filesets:
88
files_rtl:
99
depend:
1010
- lowrisc:tlul:headers
11-
- lowrisc:virtual_ip:lc_ctrl_state_pkg
11+
- lowrisc:ip:lc_ctrl_state_pkg
1212
- lowrisc:prim:assert
1313
files:
1414
- rtl/lc_ctrl_reg_pkg.sv
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
CAPI=2:
2+
# Copyright lowRISC contributors (OpenTitan project).
3+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
4+
# SPDX-License-Identifier: Apache-2.0
5+
name: "lowrisc:ip:lc_ctrl_state_pkg:0.1"
6+
description: "LC Controller State Package"
7+
filesets:
8+
files_rtl:
9+
depend:
10+
- lowrisc:prim:util
11+
files:
12+
- rtl/lc_ctrl_state_pkg.sv
13+
file_type: systemVerilogSource
14+
15+
targets:
16+
default: &default_target
17+
filesets:
18+
- files_rtl
19+
toplevel: lc_ctrl
20+
21+
lint:
22+
<<: *default_target
23+
default_tool: verilator
24+
tools:
25+
verilator:
26+
mode: lint-only
27+
verilator_options:
28+
- "-Wall"

hw/ip/lc_ctrl/rtl/lc_ctrl_fsm.sv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ module lc_ctrl_fsm
110110
// State group diversification value for keymgr
111111
output lc_keymgr_div_t lc_keymgr_div_o
112112
);
113+
import lc_ctrl_token_pkg::*;
113114

114115
/////////////////////////////
115116
// Synchronizers / Buffers //

hw/top_darjeeling/rtl/autogen/testing/lc_ctrl_state_pkg.sv renamed to hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv

Lines changed: 118 additions & 136 deletions
Large diffs are not rendered by default.

hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv.tpl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,7 @@ ${_print_state_enum('AuthSt', 'auth_state', lc_st_enc.config)}
220220

221221
typedef logic [DecLcCountWidth-1:0] dec_lc_cnt_t;
222222

223-
224-
///////////////////////////////////////////
225-
// Hashed RAW unlock and all-zero tokens //
226-
///////////////////////////////////////////
227-
228223
parameter int LcTokenWidth = ${lc_st_enc.config['token_size']};
229224
typedef logic [LcTokenWidth-1:0] lc_token_t;
230-
<% token_size = lc_st_enc.config['token_size'] %>
231-
% for token in lc_st_enc.config['tokens']:
232-
parameter lc_token_t ${token['name']} = {
233-
${"{0:}'h{1:0X}".format(token_size, token['value'])}
234-
};
235-
% endfor
236225

237226
endpackage : lc_ctrl_state_pkg

0 commit comments

Comments
 (0)