chore(core): rename get_device_sn function
What changed, and why it matters
This is a simple code cleanup change that renames a function from get_device_sn to unit_properties_get_sn across four files. It does not change what the function does, how it is called, or any security behavior. It is not a security fix.
No security action needed. Treat as routine maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit is a pure refactor: the function get_device_sn is renamed to unit_properties_get_sn, and all call sites and declarations are updated. The function signature, implementation body, and callers’ arguments remain identical. A comment guard is also corrected from KERNEL_MODE to SECURE_MODE. No logic, bounds handling, or access control changes are present.
Changed components
core/embed/util/unit_propertiescore/embed/projects/prodtestInspect captured patch +9 / −8
diff --git a/core/embed/projects/prodtest/cmd/common.c b/core/embed/projects/prodtest/cmd/common.c
index 3a0a0c1bb..35696510f 100644
--- a/core/embed/projects/prodtest/cmd/common.c
+++ b/core/embed/projects/prodtest/cmd/common.c
@@ -491,7 +491,8 @@ bool check_cert_chain(cli_t* cli, const uint8_t* chain, size_t chain_size,
// Check that the serial number of the subject, matches the device.
uint8_t device_sn[MAX_DEVICE_SN_SIZE] = {0};
size_t device_sn_size = 0;
- if (!get_device_sn(device_sn, sizeof(device_sn), &device_sn_size) ||
+ if (!unit_properties_get_sn(device_sn, sizeof(device_sn),
+ &device_sn_size) ||
device_sn_size == 0) {
cli_error(cli, CLI_ERROR,
"check_device_cert_chain, device_sn not set.");
diff --git a/core/embed/projects/prodtest/main.c b/core/embed/projects/prodtest/main.c
index d03f24139..e57db00f8 100644
--- a/core/embed/projects/prodtest/main.c
+++ b/core/embed/projects/prodtest/main.c
@@ -199,8 +199,8 @@ void prodtest_show_homescreen(void) {
static char device_sn[MAX_DEVICE_SN_SIZE] = {0};
size_t device_sn_size = 0;
- if (get_device_sn((uint8_t *)device_sn, sizeof(device_sn) - 1,
- &device_sn_size)) {
+ if (unit_properties_get_sn((uint8_t *)device_sn, sizeof(device_sn) - 1,
+ &device_sn_size)) {
screen_prodtest_welcome(&g_layout.layout, device_sn, device_sn_size);
} else {
screen_prodtest_welcome(&g_layout.layout, NULL, 0);
diff --git a/core/embed/util/unit_properties/inc/util/unit_properties.h b/core/embed/util/unit_properties/inc/util/unit_properties.h
index 163302b9f..47f1f2c58 100644
--- a/core/embed/util/unit_properties/inc/util/unit_properties.h
+++ b/core/embed/util/unit_properties/inc/util/unit_properties.h
@@ -30,7 +30,7 @@
// Returns `true` if the properties are successfully detected
bool unit_properties_init(void);
-#endif // KERNEL_MODE
+#endif // SECURE_MODE
typedef struct {
// Set to true if the unit properties are locked and cannot be changed
@@ -67,5 +67,5 @@ void unit_properties_get(unit_properties_t* props);
// Gets a pointer to the static unit properties structure
const unit_properties_t* unit_properties(void);
-bool get_device_sn(uint8_t* device_sn, size_t max_device_sn_size,
- size_t* device_sn_size);
+bool unit_properties_get_sn(uint8_t* device_sn, size_t max_device_sn_size,
+ size_t* device_sn_size);
diff --git a/core/embed/util/unit_properties/stm32/unit_properties.c b/core/embed/util/unit_properties/stm32/unit_properties.c
index 37712732b..978f50ec1 100644
--- a/core/embed/util/unit_properties/stm32/unit_properties.c
+++ b/core/embed/util/unit_properties/stm32/unit_properties.c
@@ -160,8 +160,8 @@ void unit_properties_get(unit_properties_t* props) {
*props = drv->cache;
}
-bool get_device_sn(uint8_t* device_sn, size_t max_device_sn_size,
- size_t* device_sn_size) {
+bool unit_properties_get_sn(uint8_t* device_sn, size_t max_device_sn_size,
+ size_t* device_sn_size) {
uint8_t block[FLASH_OTP_BLOCK_SIZE] = {0};
// The OTP block should contain a null-terminated string when set.
if (sectrue !=
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.