Fixing network displayed name for recovery + small refactoring
What changed, and why it matters
This commit fixes the on-screen name shown for a special 'Bitcoin Recovery' version of the Ledger Bitcoin app and removes some old, duplicated menu code. It is a user-interface cleanup, not a fix for a vulnerability that could steal funds or keys.
No security action required; treat as a normal UI/maintenance patch.
Security signals we found
UI label correction for recovery variant
Removal of dead/deduplicated menu code
No changes to transaction parsing, signing, key handling, or APDU handlers
Evidence from the diff
The patch adds a BITCOIN_RECOVERY compile flag in the Makefile for the bitcoin_recovery coin target, then refactors src/ui/menu_nbgl.c so the home screen title is chosen by BIP44_COIN_TYPE (mainnet vs testnet) and shows a recovery-specific subtitle when BITCOIN_RECOVERY is defined. It also deletes src/ui/menu.c and trims src/ui/menu.h, removing the BIP32_PUBKEY_VERSION-based dispatch and unused declarations. No cryptographic, parsing, or authorization logic is changed.
Changed components
Makefile (bitcoin_recovery build target)src/ui/menu_nbgl.c (main screen title/subtitle logic)src/ui/menu.c (deleted)src/ui/menu.h (declarations trimmed)Inspect captured patch +12 / −63
diff --git a/Makefile b/Makefile
index 658453d..98f5db5 100644
--- a/Makefile
+++ b/Makefile
@@ -112,6 +112,7 @@ else ifeq ($(COIN),bitcoin_recovery)
DEFINES += COIN_P2SH_VERSION=5
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"bc\"
DEFINES += COIN_COINID_SHORT=\"BTC\"
+ DEFINES += BITCOIN_RECOVERY
APPNAME = "Bitcoin Recovery"
diff --git a/src/ui/menu.c b/src/ui/menu.c
deleted file mode 100644
index e0d628c..0000000
--- a/src/ui/menu.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************************
- * Ledger App Bitcoin.
- * (c) 2025 Ledger SAS.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *****************************************************************************/
-
-#include "os.h"
-#include "ux.h"
-
-#include "../globals.h"
-#include "menu.h"
-
-#define BIP32_PUBKEY_VERSION_MAINNET 0x0488B21E
-#define BIP32_PUBKEY_VERSION_TESTNET 0x043587CF
-
-void ui_menu_main() {
- if (BIP32_PUBKEY_VERSION == BIP32_PUBKEY_VERSION_MAINNET) { // mainnet
- ui_menu_main_flow_bitcoin();
- } else if (BIP32_PUBKEY_VERSION == BIP32_PUBKEY_VERSION_TESTNET) { // testnet
- ui_menu_main_flow_bitcoin_testnet();
- }
-}
diff --git a/src/ui/menu.h b/src/ui/menu.h
index 6c3568b..db8441e 100644
--- a/src/ui/menu.h
+++ b/src/ui/menu.h
@@ -4,18 +4,3 @@
* Entry point function to show main menu (ready screen, version, about, quit).
*/
void ui_menu_main(void);
-
-/**
- * Show about submenu (copyright, date).
- */
-void ui_menu_about(void);
-
-/**
- * Show main menu (ready screen, version, about, quit).
- */
-void ui_menu_main_flow_bitcoin(void);
-
-/**
- * Show main menu for Testnet (ready screen, version, about, quit).
- */
-void ui_menu_main_flow_bitcoin_testnet(void);
diff --git a/src/ui/menu_nbgl.c b/src/ui/menu_nbgl.c
index f233ceb..f249a35 100644
--- a/src/ui/menu_nbgl.c
+++ b/src/ui/menu_nbgl.c
@@ -33,26 +33,22 @@ static const nbgl_contentInfoList_t infoList = {
extern void app_exit(void);
-void ui_menu_main_flow_bitcoin(void) {
- nbgl_useCaseHomeAndSettings(APPNAME,
- &ICON_APP_HOME,
- NULL,
- INIT_HOME_PAGE,
- NULL,
- &infoList,
- NULL,
- app_exit);
-}
-
-void ui_menu_main_flow_bitcoin_testnet(void) {
+void ui_menu_main(void) {
nbgl_useCaseHomeAndSettings(
+#if BIP44_COIN_TYPE == 1
"Bitcoin Testnet",
+#else
+ APPNAME,
+#endif /* #if BIP44_COIN_TYPE == 1 */
&ICON_APP_HOME,
-#ifdef SCREEN_SIZE_WALLET
- "This app enables signing\ntransactions on all the Bitcoin\ntest networks.",
+#ifdef BITCOIN_RECOVERY
+ "This is a recovery tool.\nNot for day-to-day operations!",
+#elif BIP44_COIN_TYPE == 1 && defined(SCREEN_SIZE_WALLET)
+ "This app enables signing\ntransactions on all the Bitcoin\ntest "
+ "networks.",
#else
NULL,
-#endif
+#endif /* #ifdef BITCOIN_RECOVERY */
INIT_HOME_PAGE,
NULL,
&infoList,
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.