refactor(core): move scm_revision to rtl layer
What changed, and why it matters
This commit is a simple internal code reorganization: it moves the source-code-management revision identifier (a build-time constant that records which Git commit the firmware was built from) from one internal directory to another. No behavior changes, no security fixes, and no new vulnerabilities are visible in the diff.
No security action required. Treat as routine maintenance/refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change relocates the scm_revision module from core/embed/util/scm_revision/ to core/embed/rtl/. All SCons build scripts are updated to compile embed/rtl/scm_revision.c instead of embed/util/scm_revision/scm_revision.c and to include embed/rtl/inc instead of embed/util/scm_revision/inc. Source consumers (modtrezorutils.c, rsod.c) update their #include paths from <util/scm_revision.h> to <rtl/scm_revision.h>. The header and implementation content are identical except for the include path. This is a pure refactor with no functional or security-relevant change.
Changed components
core/embed/rtl/scm_revision.ccore/embed/rtl/inc/rtl/scm_revision.hcore/embed/util/scm_revision/scm_revision.c (deleted)core/embed/util/scm_revision/inc/util/scm_revision.h (deleted)core/SConscript.* build scriptscore/embed/upymod/modtrezorutils/modtrezorutils.ccore/embed/util/rsod/rsod.cInspect captured patch +59 / −67
diff --git a/core/SConscript.boardloader b/core/SConscript.boardloader
index b3c70d79..2f5b34cf 100644
--- a/core/SConscript.boardloader
+++ b/core/SConscript.boardloader
@@ -97,8 +97,8 @@ SOURCE_MOD += [
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/util/rsod/rsod_special.c',
- 'embed/util/scm_revision/scm_revision.c',
'embed/rtl/error_handling.c',
+ 'embed/rtl/scm_revision.c',
'embed/rtl/strutils.c',
]
@@ -156,7 +156,6 @@ env.Replace(
'embed/sys/bsp/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
- 'embed/util/scm_revision/inc',
'vendor/micropython/lib/cmsis/inc',
] + CPPPATH_MOD + PATH_HAL,
CPPDEFINES=[
diff --git a/core/SConscript.bootloader b/core/SConscript.bootloader
index b85086ee..0d357279 100644
--- a/core/SConscript.bootloader
+++ b/core/SConscript.bootloader
@@ -122,8 +122,8 @@ SOURCE_MOD += [
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/util/rsod/rsod_special.c',
- 'embed/util/scm_revision/scm_revision.c',
'embed/rtl/error_handling.c',
+ 'embed/rtl/scm_revision.c',
'embed/rtl/strutils.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
@@ -211,7 +211,6 @@ ALLPATHS = [
'embed/util/translations/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
- 'embed/util/scm_revision/inc',
'embed/upymod/modtrezorui',
'vendor/nanopb',
] + CPPPATH_MOD + PATH_HAL
diff --git a/core/SConscript.bootloader_ci b/core/SConscript.bootloader_ci
index e827bf1e..10716c7f 100644
--- a/core/SConscript.bootloader_ci
+++ b/core/SConscript.bootloader_ci
@@ -101,8 +101,8 @@ SOURCE_MOD += [
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/util/rsod/rsod_special.c',
- 'embed/util/scm_revision/scm_revision.c',
'embed/rtl/error_handling.c',
+ 'embed/rtl/scm_revision.c',
'embed/rtl/strutils.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
@@ -171,7 +171,6 @@ env.Replace(
'embed/sys/bsp/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
- 'embed/util/scm_revision/inc',
'embed/upymod/modtrezorui',
'vendor/nanopb',
] + CPPPATH_MOD + PATH_HAL,
diff --git a/core/SConscript.bootloader_emu b/core/SConscript.bootloader_emu
index d65fe54d..abf06dcf 100644
--- a/core/SConscript.bootloader_emu
+++ b/core/SConscript.bootloader_emu
@@ -96,8 +96,8 @@ SOURCE_MOD += [
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/util/rsod/rsod_special.c',
- 'embed/util/scm_revision/scm_revision.c',
'embed/rtl/error_handling.c',
+ 'embed/rtl/scm_revision.c',
'embed/rtl/strutils.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
@@ -183,7 +183,6 @@ ALLPATHS = ['embed/rust',
'embed/gfx/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
- 'embed/util/scm_revision/inc',
'embed/util/translations/inc',
'vendor/nanopb',
] + CPPPATH_MOD + PATH_HAL
diff --git a/core/SConscript.firmware b/core/SConscript.firmware
index b434f3ef..c601d2c5 100644
--- a/core/SConscript.firmware
+++ b/core/SConscript.firmware
@@ -264,8 +264,8 @@ SOURCE_MOD += [
'embed/util/image/image.c',
'embed/util/translations/translations.c',
'embed/util/rsod/rsod.c',
- 'embed/util/scm_revision/scm_revision.c',
'embed/rtl/error_handling.c',
+ 'embed/rtl/scm_revision.c',
'embed/rtl/strutils.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
@@ -492,7 +492,6 @@ ALLPATHS = [
'embed/sys/bsp/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
- 'embed/util/scm_revision/inc',
'embed/util/translations/inc',
'embed/upymod/modtrezorui',
'vendor/micropython',
diff --git a/core/SConscript.prodtest b/core/SConscript.prodtest
index 50359b49..6ecf369a 100644
--- a/core/SConscript.prodtest
+++ b/core/SConscript.prodtest
@@ -174,10 +174,10 @@ SOURCE_MOD += [
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/util/rsod/rsod_special.c',
- 'embed/util/scm_revision/scm_revision.c',
'embed/rtl/cli.c',
'embed/rtl/error_handling.c',
'embed/rtl/printf.c',
+ 'embed/rtl/scm_revision.c',
'embed/rtl/strutils.c',
'embed/rtl/unit_test.c',
'vendor/micropython/lib/uzlib/adler32.c',
@@ -259,7 +259,6 @@ ALLPATHS = [
'embed/sec/storage/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
- 'embed/util/scm_revision/inc',
'embed/util/translations/inc',
'embed/upymod/modtrezorui',
]
diff --git a/core/SConscript.prodtest_emu b/core/SConscript.prodtest_emu
index 65b5c7da..3c53a9fe 100644
--- a/core/SConscript.prodtest_emu
+++ b/core/SConscript.prodtest_emu
@@ -140,10 +140,10 @@ SOURCE_MOD += [
'embed/util/image/image.c',
'embed/util/rsod/rsod.c',
'embed/util/rsod/rsod_special.c',
- 'embed/util/scm_revision/scm_revision.c',
'embed/rtl/cli.c',
'embed/rtl/error_handling.c',
'embed/rtl/printf.c',
+ 'embed/rtl/scm_revision.c',
'embed/rtl/strutils.c',
'embed/rtl/unit_test.c',
'vendor/micropython/lib/uzlib/adler32.c',
@@ -223,7 +223,6 @@ ALLPATHS = ['embed/rust',
'embed/gfx/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
- 'embed/util/scm_revision/inc',
'embed/util/translations/inc',
] + CPPPATH_MOD + PATH_HAL
diff --git a/core/SConscript.unix b/core/SConscript.unix
index bc7f703f..84917b21 100644
--- a/core/SConscript.unix
+++ b/core/SConscript.unix
@@ -247,9 +247,9 @@ SOURCE_MOD += [
'embed/util/translations/translations.c',
'embed/util/rsod/rsod.c',
'embed/util/rsod/rsod_special.c',
- 'embed/util/scm_revision/scm_revision.c',
'embed/rtl/error_handling.c',
'embed/rtl/strutils.c',
+ 'embed/rtl/scm_revision.c',
'vendor/micropython/lib/uzlib/adler32.c',
'vendor/micropython/lib/uzlib/crc32.c',
'vendor/micropython/lib/uzlib/tinflate.c',
@@ -500,7 +500,6 @@ ALLPATHS=['.',
'embed/gfx/inc',
'embed/util/image/inc',
'embed/util/rsod/inc',
- 'embed/util/scm_revision/inc',
'embed/util/translations/inc',
'vendor/micropython',
'vendor/micropython/ports/unix',
diff --git a/core/embed/rtl/inc/rtl/scm_revision.h b/core/embed/rtl/inc/rtl/scm_revision.h
new file mode 100644
index 00000000..d7cf37b6
--- /dev/null
+++ b/core/embed/rtl/inc/rtl/scm_revision.h
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the Trezor project, https://trezor.io/
+ *
+ * Copyright (c) SatoshiLabs
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SCM_REVISION_H
+#define SCM_REVISION_H
+
+#include <trezor_types.h>
+
+extern const uint8_t SCM_REVISION[sizeof((const uint8_t[])SCM_REVISION_INIT)];
+
+#endif
diff --git a/core/embed/rtl/scm_revision.c b/core/embed/rtl/scm_revision.c
new file mode 100644
index 00000000..9730d5e8
--- /dev/null
+++ b/core/embed/rtl/scm_revision.c
@@ -0,0 +1,22 @@
+/*
+ * This file is part of the Trezor project, https://trezor.io/
+ *
+ * Copyright (c) SatoshiLabs
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <rtl/scm_revision.h>
+
+const uint8_t SCM_REVISION[] = SCM_REVISION_INIT;
diff --git a/core/embed/upymod/modtrezorutils/modtrezorutils.c b/core/embed/upymod/modtrezorutils/modtrezorutils.c
index 9686abb1..caeb47eb 100644
--- a/core/embed/upymod/modtrezorutils/modtrezorutils.c
+++ b/core/embed/upymod/modtrezorutils/modtrezorutils.c
@@ -38,11 +38,11 @@
#include <sys/logging.h>
#include <io/notify.h>
+#include <rtl/scm_revision.h>
#include <sec/secret_keys.h>
#include <sec/unit_properties.h>
#include <sys/bootutils.h>
#include <util/fwutils.h>
-#include <util/scm_revision.h>
#include "blake2s.h"
#include "memzero.h"
diff --git a/core/embed/util/rsod/rsod.c b/core/embed/util/rsod/rsod.c
index b0721562..b3044a8c 100644
--- a/core/embed/util/rsod/rsod.c
+++ b/core/embed/util/rsod/rsod.c
@@ -28,7 +28,7 @@
#include <rtl/strutils.h>
#ifdef SCM_REVISION_INIT
-#include <util/scm_revision.h>
+#include <rtl/scm_revision.h>
#endif
#define RSOD_DEFAULT_TITLE "Internal error";
diff --git a/core/embed/util/scm_revision/inc/util/scm_revision.h b/core/embed/util/scm_revision/inc/util/scm_revision.h
deleted file mode 100644
index d7cf37b6..00000000
--- a/core/embed/util/scm_revision/inc/util/scm_revision.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of the Trezor project, https://trezor.io/
- *
- * Copyright (c) SatoshiLabs
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef SCM_REVISION_H
-#define SCM_REVISION_H
-
-#include <trezor_types.h>
-
-extern const uint8_t SCM_REVISION[sizeof((const uint8_t[])SCM_REVISION_INIT)];
-
-#endif
diff --git a/core/embed/util/scm_revision/scm_revision.c b/core/embed/util/scm_revision/scm_revision.c
deleted file mode 100644
index 399b6ef4..00000000
--- a/core/embed/util/scm_revision/scm_revision.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * This file is part of the Trezor project, https://trezor.io/
- *
- * Copyright (c) SatoshiLabs
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <util/scm_revision.h>
-
-const uint8_t SCM_REVISION[] = SCM_REVISION_INIT;
Why this scored 15/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.