Skip to content

Commit

Permalink
legacy: allow spending coins from Bitcoin paths if the coin ...
Browse files Browse the repository at this point in the history
has implemented strong replay protection via SIGHASH_FORKID
  • Loading branch information
prusnak committed Aug 15, 2020
1 parent b9a5d9d commit 837817d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions legacy/firmware/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Changed
- Print inverted question mark for non-printable characters.
- Allow spending coins from Bitcoin paths if the coin has implemented strong replay protection via `SIGHASH_FORKID`. [#1188]

### Deprecated

Expand Down Expand Up @@ -330,3 +331,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
[#1030]: https://github.com/trezor/trezor-firmware/issues/1030
[#1098]: https://github.com/trezor/trezor-firmware/issues/1098
[#1165]: https://github.com/trezor/trezor-firmware/pull/1165
[#1188]: https://github.com/trezor/trezor-firmware/issues/1188
11 changes: 11 additions & 0 deletions legacy/firmware/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,18 @@ int cryptoIdentityFingerprint(const IdentityType *identity, uint8_t *hash) {
}

static bool check_cointype(const CoinInfo *coin, uint32_t slip44, bool full) {
#if BITCOIN_ONLY
(void)full;
#else
if (!full) {
// some wallets such as Electron-Cash (BCH) store coins on Bitcoin paths
// we can allow spending these coins from Bitcoin paths if the coin has
// implemented strong replay protection via SIGHASH_FORKID
if (slip44 == 0 && coin->has_fork_id) {
return true;
}
}
#endif
return coin->coin_type == slip44;
}

Expand Down

0 comments on commit 837817d

Please sign in to comment.