[sw/silicon_creator] lc_state updates in mask_rom.c
This change initializes `lc_state` to an invalid value instead of
`kLcStateProd` and adds a check before jumping to ROM_EXT.
Signed-off-by: Alphan Ulusoy <alphan@google.com>
diff --git a/sw/device/silicon_creator/mask_rom/mask_rom.c b/sw/device/silicon_creator/mask_rom/mask_rom.c
index 440a8d0..02b9e96 100644
--- a/sw/device/silicon_creator/mask_rom/mask_rom.c
+++ b/sw/device/silicon_creator/mask_rom/mask_rom.c
@@ -42,7 +42,7 @@
// In-memory copy of the ePMP register configuration.
epmp_state_t epmp;
// Life cycle state of the chip.
-lifecycle_state_t lc_state = kLcStateProd;
+lifecycle_state_t lc_state = (lifecycle_state_t)0;
static inline rom_error_t mask_rom_irq_error(void) {
uint32_t mcause;
@@ -154,6 +154,9 @@
// Enable execution of code from flash if signature is verified.
flash_ctrl_exec_set(flash_exec);
+ // Check cached lc_state value aginst the value reported by hardware.
+ HARDENED_CHECK_EQ(lc_state, lifecycle_state_get());
+
sec_mmio_check_values(rnd_uint32());
sec_mmio_check_counters(/*expected_check_count=*/3);