feat(core/prodtest): improve logging in `pubkey_read()`
What changed, and why it matters
This is a small logging improvement in a Trezor factory production-test command. It splits one combined error check into two separate checks so the user sees a clearer message: either the key-read operation failed, or the key's curve type is not the expected P-256. There is no functional behavior change and no obvious security vulnerability.
No security action required. Treat as a normal code-quality/logging improvement during routine review.
Security signals we found
No security signal: change is purely diagnostic/error-message refinement
No change to trust boundary, input parsing, buffer handling, or cryptographic validation
Evidence from the diff
In core/embed/projects/prodtest/cmd/prodtest_tropic.c, the pubkey_read() helper previously called lt_ecc_key_read() and then rejected the result if either the return code was non-OK or the returned curve_type was not TR01_CURVE_P256, printing only the verbose return code. The patch separates these two failure conditions: a non-OK return prints the verbose error, while an unexpected curve type prints a dedicated message. The control flow remains identical (both paths return an error and exit), and no cryptographic operations or validation logic were altered.
Changed components
core/embed/projects/prodtest/cmd/prodtest_tropic.cprodtest_tropic CLI command (factory production test only)Inspect captured patch +6 / −2
diff --git a/core/embed/projects/prodtest/cmd/prodtest_tropic.c b/core/embed/projects/prodtest/cmd/prodtest_tropic.c
index f99847fa9..bc308fe48 100644
--- a/core/embed/projects/prodtest/cmd/prodtest_tropic.c
+++ b/core/embed/projects/prodtest/cmd/prodtest_tropic.c
@@ -1490,11 +1490,15 @@ static void pubkey_read(cli_t* cli, lt_ecc_slot_t slot,
lt_ecc_key_origin_t origin = 0;
ret = lt_ecc_key_read(tropic_get_handle(), slot, &public_key[1],
ECDSA_PUBLIC_KEY_SIZE - 1, &curve_type, &origin);
- if (ret != LT_OK || curve_type != TR01_CURVE_P256) {
- cli_error(cli, CLI_ERROR, "lt_ecc_key_read error '%s'.",
+ if (ret != LT_OK) {
+ cli_error(cli, CLI_ERROR, "`lt_ecc_key_read()` failed with error '%s'",
lt_ret_verbose(ret));
return;
}
+ if (curve_type != TR01_CURVE_P256) {
+ cli_error(cli, CLI_ERROR, "Curve type is not P-256");
+ return;
+ }
if (masking_key != NULL) {
if (ecdsa_unmask_public_key(&nist256p1, masking_key, public_key,
Why this scored 18/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.