feat(core/prodtest): add command to check CRC status
What changed, and why it matters
This commit adds a simple read-only command called 'crc-status' to Trezor's production-test tool. It lets a factory technician ask the device whether automatic CRC checks are currently turned on or off. The command does not change any settings, access secrets, or affect normal wallet operation. It is purely informational.
No security action required. This is a benign diagnostic addition to the production-test firmware.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch introduces a new prodtest CLI command, crc-status, implemented in core/embed/projects/prodtest/cmd/prodtest_crc.c. The handler calls cli_crc_enabled(), a new accessor added to core/embed/rtl/cli.c and declared in core/embed/rtl/inc/rtl/cli.h, and returns ‘OK 1’ if cli->crc_auto is true or ‘OK 0’ otherwise. The command takes no arguments and only reads an existing boolean flag. No existing behavior is modified.
Changed components
core/embed/projects/prodtest/cmd/prodtest_crc.ccore/embed/rtl/cli.ccore/embed/rtl/inc/rtl/cli.hcore/embed/projects/prodtest/README.mdInspect captured patch +31 / −0
diff --git a/core/embed/projects/prodtest/README.md b/core/embed/projects/prodtest/README.md
index eda7a4e4..21d86dae 100644
--- a/core/embed/projects/prodtest/README.md
+++ b/core/embed/projects/prodtest/README.md
@@ -323,6 +323,15 @@ crc-disable @939BC008
OK
```
+### crc-status
+Returns the current CRC check status. Prints `OK 1` if CRC is enabled and `OK 0` if disabled.
+
+Example:
+```
+crc-status
+OK 1
+```
+
### display-bars
Draws vertical color bars on the screen according to a specified string of color codes.
diff --git a/core/embed/projects/prodtest/cmd/prodtest_crc.c b/core/embed/projects/prodtest/cmd/prodtest_crc.c
index efa7238c..6ef14987 100644
--- a/core/embed/projects/prodtest/cmd/prodtest_crc.c
+++ b/core/embed/projects/prodtest/cmd/prodtest_crc.c
@@ -39,6 +39,15 @@ static void prodtest_crc_disable(cli_t* cli) {
cli_ok(cli, "");
}
+static void prodtest_crc_status(cli_t* cli) {
+ if (cli_arg_count(cli) > 0) {
+ cli_error_arg_count(cli);
+ return;
+ }
+
+ cli_ok(cli, "%d", cli_crc_enabled(cli) ? 1 : 0);
+}
+
// clang-format off
PRODTEST_CLI_CMD(
@@ -52,3 +61,9 @@ PRODTEST_CLI_CMD(
.func = prodtest_crc_disable,
.info = "Disables CRC check",
.args = "");
+
+PRODTEST_CLI_CMD(
+ .name = "crc-status",
+ .func = prodtest_crc_status,
+ .info = "Returns CRC check status",
+ .args = "");
diff --git a/core/embed/rtl/cli.c b/core/embed/rtl/cli.c
index 068ceb80..e0d99432 100644
--- a/core/embed/rtl/cli.c
+++ b/core/embed/rtl/cli.c
@@ -236,6 +236,8 @@ void cli_enable_crc(cli_t* cli) { cli->crc_auto = true; }
void cli_disable_crc(cli_t* cli) { cli->crc_auto = false; }
+bool cli_crc_enabled(cli_t* cli) { return cli->crc_auto; }
+
// Finds a command record by name
//
// Returns NULL if the command is not found
diff --git a/core/embed/rtl/inc/rtl/cli.h b/core/embed/rtl/inc/rtl/cli.h
index 65c6b23f..aab402ec 100644
--- a/core/embed/rtl/inc/rtl/cli.h
+++ b/core/embed/rtl/inc/rtl/cli.h
@@ -269,3 +269,8 @@ void cli_enable_crc(cli_t* cli);
* Disables CRC check for the CLI.
*/
void cli_disable_crc(cli_t* cli);
+
+/**
+ * Returns true if CRC check is enabled.
+ */
+bool cli_crc_enabled(cli_t* cli);
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.