feat(core): introduce secret_reset function
What changed, and why it matters
This commit adds a new function called secret_reset to the Trezor firmware's secure storage layer. The function is declared in a header file and implemented differently for three hardware/software platforms. On the real STM32U5 hardware it clears cached secret keys and reboots the device if a special bootloader key (BHK) is locked. On the STM32F4 and Unix simulator builds it does nothing. There is no evidence in the commit that this fixes an active security bug or introduces a vulnerability; it appears to be a defensive infrastructure change preparing for future use.
No immediate action required. Treat as routine feature/infrastructure commit. If monitoring this project, watch for follow-up commits that invoke secret_reset() and verify the reboot and uncache behavior are appropriate for the intended reset contexts.
Security signals we found
New function added to security-critical secret storage subsystem
STM32U5 implementation triggers device reboot when BHK is locked
No changelog entry and no linked advisory or CVE
No call sites or consumers added in this commit
Empty stubs on STM32F4 and Unix platforms
Evidence from the diff
The patch introduces secret_reset() across the secret storage abstraction. The header documents it as resetting secret storage to a known state, clearing all secrets and keys, and preparing storage for a new firmware run. The STM32U5 implementation calls secret_keys_uncache() and reboot_device() when secret_bhk_locked() returns sectrue. The STM32F4 and Unix implementations are empty stubs. No call sites are added in this commit, so the function is not yet invoked. The change is additive and does not modify existing logic paths.
Changed components
core/embed/sec/secret/inc/sec/secret.hcore/embed/sec/secret/stm32f4/secret.ccore/embed/sec/secret/stm32u5/secret.ccore/embed/sec/secret/unix/secret.cInspect captured patch +19 / −0
diff --git a/core/embed/sec/secret/inc/sec/secret.h b/core/embed/sec/secret/inc/sec/secret.h
index 52b3d112..df2045b2 100644
--- a/core/embed/sec/secret/inc/sec/secret.h
+++ b/core/embed/sec/secret/inc/sec/secret.h
@@ -82,6 +82,13 @@ secbool secret_key_writable(uint8_t slot);
*/
void secret_bhk_regenerate(void);
+/**
+ * @brief Resets the secret storage to a known state.
+ *
+ * Clears all secrets and keys, and prepares the storage for a new firmware run.
+ */
+void secret_reset(void);
+
/**
* @brief Prepares the secret storage for running the firmware.
*
diff --git a/core/embed/sec/secret/stm32f4/secret.c b/core/embed/sec/secret/stm32f4/secret.c
index beb3bcf3..7416ef30 100644
--- a/core/embed/sec/secret/stm32f4/secret.c
+++ b/core/embed/sec/secret/stm32f4/secret.c
@@ -186,6 +186,8 @@ secbool secret_key_writable(uint8_t slot) {
#endif
+void secret_reset(void) {}
+
void secret_prepare_fw(secbool allow_run_with_secret,
secbool allow_provisioning_access) {
(void)allow_provisioning_access;
diff --git a/core/embed/sec/secret/stm32u5/secret.c b/core/embed/sec/secret/stm32u5/secret.c
index fe8648d5..634d3d12 100644
--- a/core/embed/sec/secret/stm32u5/secret.c
+++ b/core/embed/sec/secret/stm32u5/secret.c
@@ -587,6 +587,14 @@ secbool secret_is_locked(void) {
}
#endif
+void secret_reset(void) {
+ secret_keys_uncache();
+
+ if (sectrue == secret_bhk_locked()) {
+ reboot_device();
+ }
+}
+
void secret_prepare_fw(secbool allow_run_with_secret,
secbool allow_provisioning_access) {
/**
diff --git a/core/embed/sec/secret/unix/secret.c b/core/embed/sec/secret/unix/secret.c
index ad6e1d58..3aed2a90 100644
--- a/core/embed/sec/secret/unix/secret.c
+++ b/core/embed/sec/secret/unix/secret.c
@@ -167,6 +167,8 @@ secbool secret_key_writable(uint8_t slot) {
return secret_key_present(slot) == secfalse;
}
+void secret_reset(void) {}
+
void secret_prepare_fw(secbool allow_run_with_secret,
secbool allow_provisioning_access) {
(void)allow_provisioning_access;
Why this scored 11/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.