fix(core): initialize tropic model device in emulator
What changed, and why it matters
This commit fixes how the Trezor emulator initializes its connection to a simulated Tropic secure chip. Previously, the emulator build likely failed to set up the TCP device address and port before calling the Tropic library's init function, which could cause initialization to fail or behave incorrectly in emulator builds. The change only affects emulator builds and does not alter real hardware behavior.
Treat as a routine emulator bug fix. If the Tropic emulator is used in CI or developer workflows, verify that initialization now succeeds and that the localhost-only binding is intentional and documented. No urgent security response is indicated by the diff alone.
Security signals we found
Fixes missing initialization of emulator-only secure-element transport device
Adds localhost TCP binding (127.0.0.1:28992) for emulator Tropic communication
No changelog entry provided
No explicit security framing in commit message
Evidence from the diff
The patch adds emulator-only (#ifdef TREZOR_EMULATOR) initialization for an lt_dev_unix_tcp_t device, binding it to 127.0.0.1:28992 and assigning it to drv->handle.l2.device before lt_init() is called. It also reorders variable declarations to after the lt_init call. This is a build/functional fix for the emulator path of the Tropic secure-element integration; no cryptographic or access-control logic is changed.
Changed components
core/embed/sec/tropic/tropic.cTrezor emulator Tropic secure-element integrationInspect captured patch +17 / −2
diff --git a/core/embed/sec/tropic/tropic.c b/core/embed/sec/tropic/tropic.c
index 95f464413..e95acd356 100644
--- a/core/embed/sec/tropic/tropic.c
+++ b/core/embed/sec/tropic/tropic.c
@@ -27,6 +27,12 @@
#include <libtropic.h>
+#ifdef TREZOR_EMULATOR
+#include <arpa/inet.h>
+#include <libtropic/hal/port/unix/lt_port_unix_tcp.h>
+#include <time.h>
+#endif
+
#include "ed25519-donna/ed25519.h"
#include "memzero.h"
@@ -36,6 +42,9 @@ typedef struct {
bool initialized;
bool sec_chan_established;
lt_handle_t handle;
+#ifdef TREZOR_EMULATOR
+ lt_dev_unix_tcp_t device;
+#endif
} tropic_driver_t;
static tropic_driver_t g_tropic_driver = {0};
@@ -47,13 +56,19 @@ bool tropic_init(void) {
return true;
}
- curve25519_key tropic_pubkey = {0};
- curve25519_key trezor_privkey = {0};
+#ifdef TREZOR_EMULATOR
+ drv->device.addr = inet_addr("127.0.0.1");
+ drv->device.port = 28992;
+ drv->handle.l2.device = &drv->device;
+#endif
if (lt_init(&drv->handle) != LT_OK) {
goto cleanup;
}
+ curve25519_key tropic_pubkey = {0};
+ curve25519_key trezor_privkey = {0};
+
secbool pubkey_ok = secret_key_tropic_public(tropic_pubkey);
secbool privkey_ok = secret_key_tropic_pairing_privileged(trezor_privkey);
Why this scored 29/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.