feat(core/prodtest): introduce logging in `tropic_wait_for_ready()`
What changed, and why it matters
This commit only adds diagnostic log messages to a hardware testing tool. It changes a function so it can optionally print 'Tropic driver is not initialized' or 'Tropic is busy' during production testing. There is no change to normal wallet firmware behavior and no security fix or vulnerability introduced.
No security action required. Treat as routine diagnostic improvement in the production-test tooling.
Security signals we found
No memory-safety changes
No authentication or cryptography changes
No privilege boundary changes
No input validation changes
No bug fix or vulnerability remediation evident in diff
Evidence from the diff
The patch modifies tropic_wait_for_ready() to accept an optional cli_t* argument and uses cli_trace() under the TREZOR_PRODTEST build to emit trace messages when the Tropic secure-element driver is uninitialized or busy. All production code paths pass NULL, so the argument is ignored outside prodtest. The change is purely observability/diagnostics.
Changed components
core/embed/sec/tropic/tropic.ccore/embed/sec/tropic/inc/sec/tropic.hcore/embed/projects/prodtest/main.cInspect captured patch +12 / −5
diff --git a/core/embed/projects/prodtest/main.c b/core/embed/projects/prodtest/main.c
index 12a33fdf..25563d48 100644
--- a/core/embed/projects/prodtest/main.c
+++ b/core/embed/projects/prodtest/main.c
@@ -198,7 +198,7 @@ static void drivers_init(void) {
#else
tropic_init();
#endif
- tropic_wait_for_ready();
+ tropic_wait_for_ready(NULL);
#endif
#ifdef USE_HW_REVISION
hw_revision_init();
diff --git a/core/embed/sec/tropic/inc/sec/tropic.h b/core/embed/sec/tropic/inc/sec/tropic.h
index 30b5729a..11177036 100644
--- a/core/embed/sec/tropic/inc/sec/tropic.h
+++ b/core/embed/sec/tropic/inc/sec/tropic.h
@@ -80,7 +80,7 @@ lt_ret_t tropic_custom_session_start(cli_t* cli,
lt_ret_t tropic_session_invalidate(void);
-bool tropic_wait_for_ready(void);
+bool tropic_wait_for_ready(cli_t* cli);
bool tropic_get_pubkey(cli_t* cli, curve25519_key pubkey);
diff --git a/core/embed/sec/tropic/tropic.c b/core/embed/sec/tropic/tropic.c
index bfff633a..dbac87ef 100644
--- a/core/embed/sec/tropic/tropic.c
+++ b/core/embed/sec/tropic/tropic.c
@@ -93,7 +93,7 @@ static bool is_retryable(lt_ret_t ret) {
tropic01_reset(); \
tropic_deinit(); \
tropic_init(); \
- tropic_wait_for_ready(); \
+ tropic_wait_for_ready(NULL); \
if (TROPIC_RETRY_COMMAND_session_started) { \
if (tropic_custom_session_start( \
NULL, TROPIC_RETRY_COMMAND_pairing_key_index) != LT_OK) { \
@@ -194,10 +194,14 @@ bool tropic_get_cert_chain_ptr(cli_t *cli, uint8_t const **cert_chain,
}
#endif // !PRODUCTION || defined(TREZOR_PRODTEST)
-bool tropic_wait_for_ready(void) {
+// If `TREZOR_PRODTEST` is not defined, the `cli` argument is ignored.
+bool tropic_wait_for_ready(cli_t *cli) {
tropic_driver_t *drv = &g_tropic_driver;
if (!drv->initialized) {
+#if TREZOR_PRODTEST
+ cli_trace(cli, "Tropic driver is not initialized");
+#endif
return false;
}
@@ -215,6 +219,9 @@ bool tropic_wait_for_ready(void) {
}
}
+#if TREZOR_PRODTEST
+ cli_trace(cli, "Tropic is busy");
+#endif
return false;
}
@@ -285,7 +292,7 @@ lt_ret_t tropic_custom_session_start(cli_t *cli,
}
}
- tropic_wait_for_ready();
+ tropic_wait_for_ready(cli);
ret = TROPIC_RETRY_COMMAND(lt_session_start(&drv->handle, tropic_public,
pairing_key_index, trezor_private,
Why this scored 19/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.