Skip to content

Commit

Permalink
Merge pull request #82 from LedgerHQ/electrum-cryptokey
Browse files Browse the repository at this point in the history
Whitelist m/4541509h/1112098098h for xpub export
  • Loading branch information
bigspider authored Nov 9, 2022
2 parents a4a624d + 027f7d5 commit 313188f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/handler/get_extended_pubkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,19 @@
#include "../ui/display.h"
#include "../ui/menu.h"

#define H 0x80000000ul

static bool is_path_safe_for_pubkey_export(const uint32_t bip32_path[],
size_t bip32_path_len,
const uint32_t coin_types[],
size_t coin_types_length) {
// Exception for Electrum: it historically used "m/4541509h/1112098098h"
// to derive encryption keys, so we whitelist it.
if (bip32_path_len == 2 && bip32_path[0] == (4541509 ^ H) &&
bip32_path[1] == (1112098098 ^ H)) {
return true;
}

if (bip32_path_len < 3) {
return false;
}
Expand Down

0 comments on commit 313188f

Please sign in to comment.