handler_get_master_fingerprint through new os_perso_get_master_key_identifier syscall
What changed, and why it matters
This commit changes how the Bitcoin app on Ledger hardware wallets obtains the wallet's master fingerprint. Previously, the app derived the master public key and computed the fingerprint itself. Now it calls a dedicated operating-system API, os_perso_get_master_key_identifier, which returns the fingerprint directly. This is a refactoring that reduces the app's own cryptographic surface and likely improves consistency with other apps, but the commit message and diff alone do not indicate a security bug was fixed.
Treat as a routine refactoring commit. Review the os_perso_get_master_key_identifier implementation and its access controls to confirm it returns the expected identifier and does not expose additional key material. No immediate security response is warranted based on the commit alone.
Security signals we found
Refactoring of cryptographic key derivation path
Adoption of OS-provided key identifier syscall
Reduction of in-app key material handling
No explicit security bug or vulnerability described in commit
Evidence from the diff
The handler_get_master_fingerprint function is rewritten to use os_perso_get_master_key_identifier from os_seed.h instead of crypto_get_compressed_pubkey_at_path + crypto_get_key_fingerprint. The new API returns a RIPEMD-160-sized master key identifier, and the handler sends the first 4 bytes as the BIP-32 master fingerprint. The change is small and functionally equivalent for the returned 4-byte fingerprint, but it removes the need to derive and hash the master public key inside the app.
Changed components
src/handler/get_master_fingerprint.cBIP-32 master fingerprint retrieval handlerInspect captured patch +6 / −6
diff --git a/src/handler/get_master_fingerprint.c b/src/handler/get_master_fingerprint.c
index 7147727..1a32842 100644
--- a/src/handler/get_master_fingerprint.c
+++ b/src/handler/get_master_fingerprint.c
@@ -17,6 +17,8 @@
#include <stdint.h>
+#include "os_seed.h"
+
#include "boilerplate/dispatcher.h"
#include "boilerplate/sw.h"
#include "../commands.h"
@@ -27,14 +29,12 @@
void handler_get_master_fingerprint(dispatcher_context_t *dc, uint8_t protocol_version) {
(void) protocol_version;
- uint8_t master_pubkey[33];
- if (!crypto_get_compressed_pubkey_at_path((uint32_t[]){}, 0, master_pubkey, NULL)) {
+ uint8_t master_key_identifier[CX_RIPEMD160_SIZE] = {0};
+
+ if (os_perso_get_master_key_identifier(master_key_identifier, CX_RIPEMD160_SIZE) != CX_OK) {
SEND_SW(dc, SW_BAD_STATE); // should never happen
return;
}
- uint8_t master_fingerprint_be[4];
- write_u32_be(master_fingerprint_be, 0, crypto_get_key_fingerprint(master_pubkey));
-
- SEND_RESPONSE(dc, master_fingerprint_be, sizeof(master_fingerprint_be), SW_OK);
+ SEND_RESPONSE(dc, master_key_identifier, 4, SW_OK);
}
Why this scored 35/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.