From 446fe2788de8df956dd5fe11db83ef90d3256d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ioan=20Biz=C4=83u?= Date: Thu, 19 Dec 2024 15:41:18 +0100 Subject: [PATCH] fixup! feat(core): add libtropic to unix build --- core/embed/projects/kernel/main.c | 19 ++++++++++++++----- core/embed/projects/unix/main.c | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/core/embed/projects/kernel/main.c b/core/embed/projects/kernel/main.c index 9b89736e24..dd61b0f108 100644 --- a/core/embed/projects/kernel/main.c +++ b/core/embed/projects/kernel/main.c @@ -220,12 +220,21 @@ void drivers_init() { #ifdef USE_TROPIC - tropic_init(); - if (sectrue == tropic_secret_ok) { - if (tropic_handshake(tropic_secret) != TROPIC_SUCCESS) { - // ?? - } + if (sectrue != tropic_secret_ok) { + memzero(tropic_secret, sizeof(tropic_secret)); + ensure(false, "secret_tropic_get failed"); } + + if (tropic_init() != TROPIC_SUCCESS) { + memzero(tropic_secret, sizeof(tropic_secret)); + ensure(false, "tropic_init failed"); + } + + if (tropic_handshake(tropic_secret) != TROPIC_SUCCESS) { + memzero(tropic_secret, sizeof(tropic_secret)); + ensure(false, "tropic_handshake failed"); + } + memzero(tropic_secret, sizeof(tropic_secret)); #endif diff --git a/core/embed/projects/unix/main.c b/core/embed/projects/unix/main.c index bca8f874f4..7d34f558b9 100644 --- a/core/embed/projects/unix/main.c +++ b/core/embed/projects/unix/main.c @@ -509,12 +509,21 @@ void drivers_init() { uint8_t tropic_secret[SECRET_TROPIC_KEY_LEN] = {0}; secbool tropic_secret_ok = secret_tropic_get(tropic_secret); - tropic_init(); - if (sectrue == tropic_secret_ok) { - if (tropic_handshake(tropic_secret) != TROPIC_SUCCESS) { - // ?? - } + if (sectrue != tropic_secret_ok) { + memzero(tropic_secret, sizeof(tropic_secret)); + ensure(false, "secret_tropic_get failed"); } + + if (tropic_init() != TROPIC_SUCCESS) { + memzero(tropic_secret, sizeof(tropic_secret)); + ensure(false, "tropic_init failed"); + } + + if (tropic_handshake(tropic_secret) != TROPIC_SUCCESS) { + memzero(tropic_secret, sizeof(tropic_secret)); + ensure(false, "tropic_handshake failed"); + } + memzero(tropic_secret, sizeof(tropic_secret)); #endif }