From 06612aae07a8dc0380660289dab275c4f89637a3 Mon Sep 17 00:00:00 2001 From: highlander Date: Mon, 3 Aug 2026 17:36:03 -0300 Subject: [PATCH] fix(reset): stop displaying internal entropy --- include/keepkey/firmware/reset.h | 8 ++++---- lib/firmware/fsm_msg_common.h | 6 ++++-- lib/firmware/reset.c | 34 ++++---------------------------- 3 files changed, 12 insertions(+), 36 deletions(-) diff --git a/include/keepkey/firmware/reset.h b/include/keepkey/firmware/reset.h index da5ae10f6..1a45b7276 100644 --- a/include/keepkey/firmware/reset.h +++ b/include/keepkey/firmware/reset.h @@ -43,10 +43,10 @@ extern char mnemonic_scratch_formatted[MAX_PAGES][FORMATTED_MNEMONIC_BUF]; extern char mnemonic_scratch_display[FORMATTED_MNEMONIC_BUF]; extern char mnemonic_scratch_word[MAX_WORD_LEN + ADDITIONAL_WORD_PAD]; -void reset_init(bool display_random, uint32_t _strength, - bool passphrase_protection, bool pin_protection, - const char* language, const char* label, bool _no_backup, - uint32_t _auto_lock_delay_ms, uint32_t _u2f_counter); +void reset_init(uint32_t _strength, bool passphrase_protection, + bool pin_protection, const char* language, const char* label, + bool _no_backup, uint32_t _auto_lock_delay_ms, + uint32_t _u2f_counter); void reset_entropy(const uint8_t* ext_entropy, uint32_t len); uint32_t reset_get_int_entropy(uint8_t* entropy); const char* reset_get_word(void); diff --git a/lib/firmware/fsm_msg_common.h b/lib/firmware/fsm_msg_common.h index 1547486a9..cd46c91db 100644 --- a/lib/firmware/fsm_msg_common.h +++ b/lib/firmware/fsm_msg_common.h @@ -587,8 +587,10 @@ void fsm_msgResetDevice(ResetDevice* msg) { CHECK_NOT_BTC_ONLY_LOCKED CHECK_NOT_INITIALIZED - reset_init(msg->has_display_random && msg->display_random, - msg->has_strength ? msg->strength : 128, + // display_random remains in the wire schema for host compatibility, but is + // intentionally ignored: internal entropy is seed pre-image material and + // must never be rendered or returned by production firmware. + reset_init(msg->has_strength ? msg->strength : 128, msg->has_passphrase_protection && msg->passphrase_protection, msg->has_pin_protection && msg->pin_protection, msg->has_language ? msg->language : 0, diff --git a/lib/firmware/reset.c b/lib/firmware/reset.c index 574930f6c..e422faaa0 100644 --- a/lib/firmware/reset.c +++ b/lib/firmware/reset.c @@ -50,10 +50,10 @@ char CONFIDENTIAL mnemonic_scratch_formatted[MAX_PAGES][FORMATTED_MNEMONIC_BUF]; char CONFIDENTIAL mnemonic_scratch_display[FORMATTED_MNEMONIC_BUF]; char CONFIDENTIAL mnemonic_scratch_word[MAX_WORD_LEN + ADDITIONAL_WORD_PAD]; -void reset_init(bool display_random, uint32_t _strength, - bool passphrase_protection, bool pin_protection, - const char* language, const char* label, bool _no_backup, - uint32_t _auto_lock_delay_ms, uint32_t _u2f_counter) { +void reset_init(uint32_t _strength, bool passphrase_protection, + bool pin_protection, const char* language, const char* label, + bool _no_backup, uint32_t _auto_lock_delay_ms, + uint32_t _u2f_counter) { if (_strength != 128 && _strength != 192 && _strength != 256) { fsm_sendFailure( FailureType_Failure_SyntaxError, @@ -65,13 +65,6 @@ void reset_init(bool display_random, uint32_t _strength, strength = _strength; no_backup = _no_backup; - if (display_random && no_backup) { - fsm_sendFailure(FailureType_Failure_SyntaxError, - _("Can't show internal entropy when backup is skipped")); - layoutHome(); - return; - } - if (no_backup) { // Double confirm, since this is a feature for advanced users only, and // there is risk of loss of funds if this mode is used incorrectly @@ -92,25 +85,6 @@ void reset_init(bool display_random, uint32_t _strength, random_buffer(int_entropy, 32); - if (display_random) { - static char CONFIDENTIAL ent_str[4][17]; - data2hex(int_entropy, 8, ent_str[0]); - data2hex(int_entropy + 8, 8, ent_str[1]); - data2hex(int_entropy + 16, 8, ent_str[2]); - data2hex(int_entropy + 24, 8, ent_str[3]); - - if (!confirm(ButtonRequestType_ButtonRequest_ResetDevice, - _("Internal Entropy"), "%s %s %s %s", ent_str[0], ent_str[1], - ent_str[2], ent_str[3])) { - memzero(ent_str, sizeof(ent_str)); - fsm_sendFailure(FailureType_Failure_ActionCancelled, - _("Reset cancelled")); - layoutHome(); - return; - } - memzero(ent_str, sizeof(ent_str)); - } - if (pin_protection) { if (!change_pin()) { fsm_sendFailure(FailureType_Failure_ActionCancelled,