refactor(core): remove cyclic dependency - tamper rsod
What changed, and why it matters
This commit is a code cleanup that moves a panic-screen function declaration from one header file to another and updates which files include it. It also fixes a minor stub function in the Unix emulator so it now returns the expected value. There is no indication this fixes a security vulnerability or changes device behavior in a way attackers could exploit.
No security action required; treat as ordinary refactoring review.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change removes rsod_panic_handler() declaration from core/embed/io/gfx/inc/io/rsod.h and adds it to core/embed/sec/rsod/inc/sec/rsod_special.h. Several project main files are updated to include the new header. The tamper modules now include sec/rsod_special.h instead of io/rsod.h, breaking a cyclic dependency. In the Unix tamper stub, tamper_init() is corrected from an empty body returning no value to returning true.
Changed components
core/embed/io/gfx/inc/io/rsod.hcore/embed/sec/rsod/inc/sec/rsod_special.hcore/embed/projects/boardloader/main.ccore/embed/projects/bootloader_ci/main.ccore/embed/projects/prodtest/main.ccore/embed/projects/unix/main_main.ccore/embed/sec/tamper/stm32u5/tamper.ccore/embed/sec/tamper/unix/tamper.cInspect captured patch +20 / −12
diff --git a/core/embed/io/gfx/inc/io/rsod.h b/core/embed/io/gfx/inc/io/rsod.h
index 36b759b7..4a3b3104 100644
--- a/core/embed/io/gfx/inc/io/rsod.h
+++ b/core/embed/io/gfx/inc/io/rsod.h
@@ -38,16 +38,6 @@ void rsod_gui(const systask_postmortem_t* pminfo);
#ifdef KERNEL_MODE
-/**
- * Universal panic handler that can be passed to `system_init()` function
- * to show RSOD screen describing the system error and halt the device
- *
- * (may be called from interrupt context)
- *
- * @param pminfo Pointer to the post mortem to display
- */
-void rsod_panic_handler(const systask_postmortem_t* pminfo);
-
/**
* Shows RSOD screen with "Device wiped" message
* and shuts down the device.
diff --git a/core/embed/projects/boardloader/main.c b/core/embed/projects/boardloader/main.c
index 2685c3be..cbbaed9f 100644
--- a/core/embed/projects/boardloader/main.c
+++ b/core/embed/projects/boardloader/main.c
@@ -24,6 +24,7 @@
#include <io/rsod.h>
#include <sec/board_capabilities.h>
#include <sec/option_bytes.h>
+#include <sec/rsod_special.h>
#include <sys/bootutils.h>
#include <sys/flash.h>
#include <sys/flash_utils.h>
diff --git a/core/embed/projects/bootloader_ci/main.c b/core/embed/projects/bootloader_ci/main.c
index 1e57f985..0f2c222d 100644
--- a/core/embed/projects/bootloader_ci/main.c
+++ b/core/embed/projects/bootloader_ci/main.c
@@ -29,6 +29,7 @@
#include <io/usb_config.h>
#include <sec/image.h>
#include <sec/random_delays.h>
+#include <sec/rsod_special.h>
#include <sys/bootargs.h>
#include <sys/bootutils.h>
#include <sys/flash_otp.h>
diff --git a/core/embed/projects/prodtest/main.c b/core/embed/projects/prodtest/main.c
index 87cf5a58..3f2787bb 100644
--- a/core/embed/projects/prodtest/main.c
+++ b/core/embed/projects/prodtest/main.c
@@ -28,6 +28,7 @@
#include <io/usb_config.h>
#include <rtl/cli.h>
#include <sec/board_capabilities.h>
+#include <sec/rsod_special.h>
#include <sec/unit_properties.h>
#include <sys/flash_otp.h>
#include <sys/system.h>
diff --git a/core/embed/projects/unix/main_main.c b/core/embed/projects/unix/main_main.c
index 304c8c69..ef8e8dba 100644
--- a/core/embed/projects/unix/main_main.c
+++ b/core/embed/projects/unix/main_main.c
@@ -22,6 +22,7 @@
#include <io/display.h>
#include <io/rsod.h>
#include <io/usb_config.h>
+#include <sec/rsod_special.h>
#include <sec/unit_properties.h>
#include <sys/applet.h>
#include <sys/bootutils.h>
diff --git a/core/embed/sec/rsod/inc/sec/rsod_special.h b/core/embed/sec/rsod/inc/sec/rsod_special.h
index d25d8746..e09fc92a 100644
--- a/core/embed/sec/rsod/inc/sec/rsod_special.h
+++ b/core/embed/sec/rsod/inc/sec/rsod_special.h
@@ -19,6 +19,8 @@
#pragma once
+#include <sys/systask.h>
+
#define ALL_DATA_ERASED_MESSAGE "All data has been erased from the device"
/**
@@ -38,3 +40,15 @@ void __attribute__((noreturn)) show_pin_too_many_screen(void);
* and shuts down the device.
*/
void __attribute__((noreturn)) show_install_restricted_screen(void);
+
+/**
+ * Universal panic handler that can be passed to `system_init()` function
+ * to show RSOD screen describing the system error and halt the device
+ *
+ * (may be called from interrupt context)
+ *
+ * The function is implemented in 'io/rsod.c'.
+ *
+ * @param pminfo Pointer to the post mortem to display
+ */
+void rsod_panic_handler(const systask_postmortem_t* pminfo);
diff --git a/core/embed/sec/tamper/stm32u5/tamper.c b/core/embed/sec/tamper/stm32u5/tamper.c
index e796cae2..33c9fe92 100644
--- a/core/embed/sec/tamper/stm32u5/tamper.c
+++ b/core/embed/sec/tamper/stm32u5/tamper.c
@@ -22,7 +22,7 @@
#include <trezor_bsp.h>
#include <trezor_rtl.h>
-#include <io/rsod.h>
+#include <sec/rsod_special.h>
#include <sec/tamper.h>
#include <sys/bootutils.h>
#include <sys/irq.h>
diff --git a/core/embed/sec/tamper/unix/tamper.c b/core/embed/sec/tamper/unix/tamper.c
index 21f47a99..871fd4c2 100644
--- a/core/embed/sec/tamper/unix/tamper.c
+++ b/core/embed/sec/tamper/unix/tamper.c
@@ -19,7 +19,7 @@
#include <sec/tamper.h>
-bool tamper_init(void) {}
+bool tamper_init(void) { return true; }
uint8_t tamper_external_read(void) { return 0; }
Why this scored 12/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.