diff --git a/.circleci/config.yml b/.circleci/config.yml index 3647c3fd4..03c2de1f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,65 +1,81 @@ version: 2.1 jobs: - emulator-build-test: - docker: - - image: circleci/python:3.7 - steps: - - checkout - - run: - name: Update Submodules - command: | - git submodule update --init --recursive - - setup_remote_docker - - run: - name: Build Emulator and Run Tests - command: | - pushd ./scripts/emulator - set +e - docker-compose up --build firmware-unit - docker-compose up --build python-keepkey - set -e - mkdir -p ../../test-reports - docker cp "$(docker-compose ps -q firmware-unit)":/kkemu/test-reports/. ../../test-reports/ - docker cp "$(docker-compose ps -q python-keepkey)":/kkemu/test-reports/. ../../test-reports/ - popd - [ "$(cat test-reports/python-keepkey/status)$(cat test-reports/firmware-unit/status)" == "00" ] || exit 1 - - store_test_results: - path: test-reports + emulator-build-test: + docker: + - image: circleci/python:3.7 + steps: + - checkout + - run: + name: Update Submodules + command: | + git submodule update --init --recursive + - setup_remote_docker + - run: + name: Install Compose v2 plugin + command: | + mkdir -p ~/.docker/cli-plugins + curl -SL https://github.com/docker/compose/releases/download/v2.29.2/docker-compose-linux-x86_64 \ + -o ~/.docker/cli-plugins/docker-compose + chmod +x ~/.docker/cli-plugins/docker-compose + docker compose version + - run: + name: Build Emulator and Run Tests + command: | + pushd ./scripts/emulator + set +e + docker compose -f docker-compose-btc.yml up --build firmware-unit + docker compose -f docker-compose-btc.yml up --build python-keepkey + set -e + mkdir -p ../../test-reports + docker cp "$(docker compose -f docker-compose-btc.yml ps -a -q firmware-unit)":/kkemu/test-reports/. ../../test-reports/ + docker cp "$(docker compose -f docker-compose-btc.yml ps -a -q python-keepkey)":/kkemu/test-reports/. ../../test-reports/ + popd + [ "$(cat test-reports/python-keepkey/status)$(cat test-reports/firmware-unit/status)" == "00" ] || exit 1 + - store_test_results: + path: test-reports - emulator-publish: - docker: - - image: circleci/python:3.7 - steps: - - checkout - - run: - name: Update Submodules - command: | - git submodule update --init --recursive - - setup_remote_docker - - run: - name: Build Emulator - command: | - pushd ./scripts/emulator - docker-compose build kkemu - popd - - run: - name: Publish Emulator - command: | - docker login -u $KK_DOCKERHUB_USER -p $KK_DOCKERHUB_PASS - docker push kktech/kkemu - LATEST_IMAGE_ID=$(docker images | grep -i kktech/kkemu | grep -i latest | awk '{print $3}' ) - FW_VERSION=$(cat ./CMakeLists.txt | tr -d '\n' | awk -v FS="(KeepKeyFirmwareVERSION|LANGUAGES)" '{print $1}' | awk '{print $4}') - docker tag $LATEST_IMAGE_ID kktech/kkemu:v$FW_VERSION - docker push kktech/kkemu + emulator-publish: + docker: + - image: circleci/python:3.7 + steps: + - checkout + - run: + name: Update Submodules + command: | + git submodule update --init --recursive + - setup_remote_docker + - run: + name: Install Compose v2 plugin + command: | + mkdir -p ~/.docker/cli-plugins + curl -SL https://github.com/docker/compose/releases/download/v2.29.2/docker-compose-linux-x86_64 \ + -o ~/.docker/cli-plugins/docker-compose + chmod +x ~/.docker/cli-plugins/docker-compose + docker compose version + - run: + name: Build Emulator + command: | + pushd ./scripts/emulator + docker compose -f docker-compose-btc.yml build kkemu + popd + - run: + name: Publish Emulator + command: | + docker login -u $KK_DOCKERHUB_USER -p $KK_DOCKERHUB_PASS + docker push kktech/kkemu + LATEST_IMAGE_ID=$(docker images | grep -i kktech/kkemu | grep -i latest | awk '{print $3}' ) + FW_VERSION=$(cat ./CMakeLists.txt | tr -d '\n' | awk -v FS="(KeepKeyFirmwareVERSION|LANGUAGES)" '{print $1}' | awk '{print $4}') + docker tag $LATEST_IMAGE_ID kktech/kkemu:v$FW_VERSION + docker push kktech/kkemu workflows: - version: 2 - emulator: - jobs: - - emulator-build-test - - emulator-publish: - filters: - branches: - only: master - requires: + version: 2 + emulator: + jobs: - emulator-build-test + - emulator-publish: + filters: + branches: + only: master + requires: + - emulator-build-test diff --git a/.gitignore b/.gitignore index 24e7efbbd..ea650353a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -bin -build +bin/ +build/ .DS_Store .vscode/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d68c588a..f24b6eb7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,10 @@ else() add_definitions(-DDEBUG_LINK=0) endif() +if("${COIN_SUPPORT}" STREQUAL "BTC") + add_definitions(-DBITCOIN_ONLY) +endif() + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") add_definitions(-DDEBUG_ON) add_definitions(-DMEMORY_PROTECT=0) diff --git a/deps/python-keepkey b/deps/python-keepkey index 9e4b4f0b1..f1dd2b684 160000 --- a/deps/python-keepkey +++ b/deps/python-keepkey @@ -1 +1 @@ -Subproject commit 9e4b4f0b14a6ea966fecfe31d8e2706abe7b405c +Subproject commit f1dd2b6847346abe8ea2985b22d688de4911643f diff --git a/include/keepkey/firmware/coins.def b/include/keepkey/firmware/coins.def index de2643175..3d7a3a972 100644 --- a/include/keepkey/firmware/coins.def +++ b/include/keepkey/firmware/coins.def @@ -2,6 +2,7 @@ //coin_name coin_shortcut address_type maxfee_kb p2sh signed_message_header bip44_account_path forkid/chain_id decimals contract_address xpub_magic segwit force_bip143 curve_name cashaddr_prefix bech32_prefix decred xpub_magic_segwit_p2sh xpub_mmagic_segwit_native nanoaddr_prefix taproot X(true, "Bitcoin", true, "BTC", true, 0, true, 100000, true, 5, true, "Bitcoin Signed Message:\n", true, 0x80000000, false, 0, true, 8, false, NO_CONTRACT, true, 76067358, true, true, true, false, true, SECP256K1_STRING, false, "", true, "bc", false, false, true, 77429938, true, 78792518, false, "", true, true ) X(true, "Testnet", true, "TEST", true, 111, true, 10000000, true, 196, true, "Bitcoin Signed Message:\n", true, 0x80000001, false, 0, true, 8, false, NO_CONTRACT, true, 70617039, true, true, true, false, true, SECP256K1_STRING, false, "", true, "tb", false, false, true, 71979618, true, 73342198, false, "", true, true ) +#ifndef BITCOIN_ONLY X(true, "BitcoinCash", true, "BCH", true, 0, true, 500000, true, 5, true, "Bitcoin Signed Message:\n", true, 0x80000091, true, 0, true, 8, false, NO_CONTRACT, true, 76067358, true, false, true, true, true, SECP256K1_STRING, true, "bitcoincash", false, "", false, false, false, 0, false, 0, false, "", true, false ) X(true, "Namecoin", true, "NMC", true, 52, true, 10000000, true, 5, true, "Namecoin Signed Message:\n", true, 0x80000007, false, 0, true, 8, false, NO_CONTRACT, true, 27108450, true, false, true, false, true, SECP256K1_STRING, false, "", false, "", false, false, false, 0, false, 0, false, "", true, false ) X(true, "Litecoin", true, "LTC", true, 48, true, 1000000, true, 50, true, "Litecoin Signed Message:\n", true, 0x80000002, false, 0, true, 8, false, NO_CONTRACT, true, 27108450, true, true, true, false, true, SECP256K1_STRING, false, "", true, "ltc", false, false, true, 28471030, true, 78792518, false, "", true, false ) @@ -46,6 +47,6 @@ X(true, "Terra", true, "LUNA", false, NA, false, NA, false, N X(true, "Kava", true, "KAVA", false, NA, false, NA, false, NA, false, {0}, true, 0x800001cb, false, 0, true, 6, false, NO_CONTRACT, false, 0, false, false, false, false, true, SECP256K1_STRING, false, "", false, "kava", false, false, false, 0, false, 0, false, "", true, false ) X(true, "Secret", true, "SCRT", false, NA, false, NA, false, NA, false, {0}, true, 0x80000211, false, 0, true, 6, false, NO_CONTRACT, false, 0, false, false, false, false, true, SECP256K1_STRING, false, "", false, "secret", false, false, false, 0, false, 0, false, "", true, false ) X(true, "MAYAChain", true, "CACAO", false, NA, false, NA, false, NA, false, {0}, true, 0x800003a3, false, 0, true, 10, false, NO_CONTRACT, false, 0, false, false, false, false, true, SECP256K1_STRING, false, "", false, "maya", false, false, false, 0, false, 0, false, "", true, false ) - +#endif // BITCOIN_ONLY #undef X #undef NO_CONTRACT diff --git a/include/keepkey/firmware/coins.h b/include/keepkey/firmware/coins.h index b94e36cca..5c6c64d1e 100644 --- a/include/keepkey/firmware/coins.h +++ b/include/keepkey/firmware/coins.h @@ -44,14 +44,20 @@ enum { CONCAT(CoinIndex, __COUNTER__), #include "keepkey/firmware/coins.def" +#ifdef BITCOIN_ONLY +// For full-featured keepkey, this is defined in ethereum_tokens.h. For bitcoin only keepkey, need to +// define it here because ethereum_tokens.h is not included in any file +#define TOKENS_COUNT 0 +#else #define X(INDEX, NAME, SYMBOL, DECIMALS, CONTRACT_ADDRESS) \ CONCAT(CoinIndex, __COUNTER__), #include "keepkey/firmware/tokens.def" - +#endif CoinIndexLast, CoinIndexFirst = 0 }; + #define COINS_COUNT ((int)CoinIndexLast - (int)CoinIndexFirst) #define NODE_STRING_LENGTH 50 diff --git a/include/keepkey/firmware/fsm.h b/include/keepkey/firmware/fsm.h index 19e911106..7371ec228 100644 --- a/include/keepkey/firmware/fsm.h +++ b/include/keepkey/firmware/fsm.h @@ -77,6 +77,7 @@ void fsm_msgWordAck(WordAck *msg); void fsm_msgCharacterAck(CharacterAck *msg); void fsm_msgApplyPolicies(ApplyPolicies *msg); +#ifndef BITCOIN_ONLY // ethereum void fsm_msgEthereumGetAddress(EthereumGetAddress *msg); void fsm_msgEthereumSignTx(EthereumSignTx *msg); @@ -118,6 +119,8 @@ void fsm_msgMayachainGetAddress(const MayachainGetAddress *msg); void fsm_msgMayachainSignTx(const MayachainSignTx *msg); void fsm_msgMayachainMsgAck(const MayachainMsgAck *msg); +#endif // BITCOIN_ONLY + #if DEBUG_LINK // void fsm_msgDebugLinkDecision(DebugLinkDecision *msg); void fsm_msgDebugLinkGetState(DebugLinkGetState *msg); diff --git a/include/keepkey/transport/interface.h b/include/keepkey/transport/interface.h index ffebf205d..20b2c0573 100644 --- a/include/keepkey/transport/interface.h +++ b/include/keepkey/transport/interface.h @@ -20,9 +20,15 @@ #ifndef INTERFACE_H #define INTERFACE_H +#include "types.pb.h" // Allow this file to be used from C++ by renaming an unfortunately named field: #define delete del #include "messages.pb.h" +#undef delete + +#ifndef BITCOIN_ONLY +// Allow this file to be used from C++ by renaming an unfortunately named field: +#define delete del #include "messages-nano.pb.h" #undef delete @@ -36,7 +42,8 @@ #include "messages-thorchain.pb.h" #include "messages-mayachain.pb.h" -#include "types.pb.h" +#endif // BITCOIN_ONLY + #include "trezor_transport.h" #ifndef EMULATOR diff --git a/include/keepkey/variant/keepkey.h b/include/keepkey/variant/keepkey.h index 345008a8a..784b650fb 100644 --- a/include/keepkey/variant/keepkey.h +++ b/include/keepkey/variant/keepkey.h @@ -1,16 +1,51 @@ +/* + * This file is part of the KeepKey project. + * + * Copyright (C) 2025 markrypto + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + #ifndef KEEPKEY_VARIANT_KEEPKEY_H #define KEEPKEY_VARIANT_KEEPKEY_H #include "keepkey/board/variant.h" -#define VARIANTINFO_KEEPKEY \ - .version = 1, .name = "KeepKey", .logo = &kk_logo, \ - .logo_reversed = &kk_logo_reversed, \ - .screensaver_timeout = ONE_SEC * 60 * 10, .screensaver = &kk_screensaver, +#ifdef BITCOIN_ONLY +// use the bitcoin-only logo +#define VARIANTINFO_KEEPKEY \ +.version = 1, .name = "KeepKeyBTC", .logo = &kkbtc_logo, \ +.logo_reversed = &kkbtc_logo_reversed, \ +.screensaver_timeout = ONE_SEC * 60 * 10, .screensaver = &kkbtc_screensaver, + +extern const VariantInfo variant_keepkey; +extern const VariantAnimation kkbtc_logo; +extern const VariantAnimation kkbtc_logo_reversed; +extern const VariantAnimation kkbtc_screensaver; + +#else + +#define VARIANTINFO_KEEPKEY \ +.version = 1, .name = "KeepKey", .logo = &kk_logo, \ +.logo_reversed = &kk_logo_reversed, \ +.screensaver_timeout = ONE_SEC * 60 * 10, .screensaver = &kk_screensaver, extern const VariantInfo variant_keepkey; extern const VariantAnimation kk_logo; extern const VariantAnimation kk_logo_reversed; extern const VariantAnimation kk_screensaver; -#endif +#endif // BITCOIN_ONLY + +#endif \ No newline at end of file diff --git a/lib/board/variant.c b/lib/board/variant.c index d996858ab..f6dab58d2 100644 --- a/lib/board/variant.c +++ b/lib/board/variant.c @@ -118,7 +118,11 @@ const VariantInfo *__attribute__((weak)) variant_getInfo(void) { case MODEL_KEEPKEY: return &variant_keepkey; case MODEL_SALT: +#ifndef BITCOIN_ONLY return &variant_salt; +#else + return &variant_keepkey; +#endif case MODEL_FOX: return &variant_keepkey; case MODEL_KASPERSKY: @@ -152,7 +156,11 @@ const VariantAnimation *variant_getLogo(bool reversed) { const char *variant_getName(void) { #ifdef EMULATOR - return "Emulator"; + #ifdef BITCOIN_ONLY + return "EmulatorBTC"; + #else + return "Emulator"; + #endif #else if (name) { return name; diff --git a/lib/firmware/CMakeLists.txt b/lib/firmware/CMakeLists.txt index e08ccfc69..4375fb7f5 100644 --- a/lib/firmware/CMakeLists.txt +++ b/lib/firmware/CMakeLists.txt @@ -2,45 +2,50 @@ set(sources app_confirm.c app_layout.c authenticator.c - binance.c coins.c crypto.c - eip712.c - eos.c - eos-contracts/eosio.system.c - eos-contracts/eosio.token.c - ethereum.c - ethereum_contracts.c - ethereum_contracts/makerdao.c - ethereum_contracts/saproxy.c - ethereum_contracts/zxappliquid.c - ethereum_contracts/thortx.c - ethereum_contracts/zxliquidtx.c - ethereum_contracts/zxtransERC20.c - ethereum_contracts/zxswap.c - ethereum_tokens.c fsm.c home_sm.c - mayachain.c - nano.c - osmosis.c passphrase_sm.c pin_sm.c policy.c recovery_cipher.c reset.c - ripple.c - ripple_base58.c signing.c - signtx_tendermint.c storage.c - tendermint.c - thorchain.c tiny-json.c transaction.c txin_check.c u2f.c) +if("${COIN_SUPPORT}" STREQUAL "BTC") +else() + list(APPEND sources + binance.c + eip712.c + eos.c + eos-contracts/eosio.system.c + eos-contracts/eosio.token.c + ethereum.c + ethereum_contracts.c + ethereum_contracts/makerdao.c + ethereum_contracts/saproxy.c + ethereum_contracts/zxappliquid.c + ethereum_contracts/thortx.c + ethereum_contracts/zxliquidtx.c + ethereum_contracts/zxtransERC20.c + ethereum_contracts/zxswap.c + ethereum_tokens.c + mayachain.c + nano.c + osmosis.c + ripple.c + ripple_base58.c + signtx_tendermint.c + tendermint.c + thorchain.c) +endif() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scm_revision.h.in" "${CMAKE_CURRENT_BINARY_DIR}/scm_revision.h" @ONLY) @@ -51,14 +56,20 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}) add_library(kkfirmware ${sources}) -add_dependencies(kkfirmware kktransport.pb trezorcrypto qrcodegenerator ethereum_tokens.def) -set(ETHEREUM_TOKENS ${CMAKE_BINARY_DIR}/include/keepkey/firmware/ethereum_tokens) -set(UNISWAP_TOKENS ${CMAKE_BINARY_DIR}/include/keepkey/firmware/uniswap_tokens) +if("${COIN_SUPPORT}" STREQUAL "BTC") + # for bitcoin-only, do not build eth token table or uniswap tokens + add_dependencies(kkfirmware kktransport.pb trezorcrypto qrcodegenerator) + +else() + add_dependencies(kkfirmware kktransport.pb trezorcrypto qrcodegenerator ethereum_tokens.def) + set(ETHEREUM_TOKENS ${CMAKE_BINARY_DIR}/include/keepkey/firmware/ethereum_tokens) + set(UNISWAP_TOKENS ${CMAKE_BINARY_DIR}/include/keepkey/firmware/uniswap_tokens) -add_custom_target(ethereum_tokens.def - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/keepkey/firmware - COMMAND python3 ${CMAKE_SOURCE_DIR}/deps/python-keepkey/keepkeylib/eth/ethereum_tokens.py ${ETHEREUM_TOKENS}.def - COMMAND python3 ${CMAKE_SOURCE_DIR}/deps/python-keepkey/keepkeylib/eth/uniswap_tokens.py ${UNISWAP_TOKENS}.def) + add_custom_target(ethereum_tokens.def + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/keepkey/firmware + COMMAND python3 ${CMAKE_SOURCE_DIR}/deps/python-keepkey/keepkeylib/eth/ethereum_tokens.py ${ETHEREUM_TOKENS}.def + COMMAND python3 ${CMAKE_SOURCE_DIR}/deps/python-keepkey/keepkeylib/eth/uniswap_tokens.py ${UNISWAP_TOKENS}.def) +endif() add_library(kkfirmware.keepkey variant/keepkey/resources.c) diff --git a/lib/firmware/coins.c b/lib/firmware/coins.c index a2c859fff..257439e9c 100644 --- a/lib/firmware/coins.c +++ b/lib/firmware/coins.c @@ -85,6 +85,7 @@ const CoinType coins[COINS_COUNT] = { TAPROOT}, #include "keepkey/firmware/coins.def" +#ifndef BITCOIN_ONLY #define X(INDEX, NAME, SYMBOL, DECIMALS, CONTRACT_ADDRESS) \ { \ true, \ @@ -130,6 +131,7 @@ const CoinType coins[COINS_COUNT] = { false, false, /* has_taproot, taproot*/ \ }, #include "keepkey/firmware/tokens.def" +#endif // BITCOIN_ONLY }; _Static_assert(sizeof(coins) / sizeof(coins[0]) == COINS_COUNT, diff --git a/lib/firmware/fsm.c b/lib/firmware/fsm.c index 0d779f448..864ebda1a 100644 --- a/lib/firmware/fsm.c +++ b/lib/firmware/fsm.c @@ -17,6 +17,9 @@ * along with this library. If not, see . */ + +#include + #include "scm_revision.h" #include "variant.h" #include "u2f_knownapps.h" @@ -36,28 +39,16 @@ #include "keepkey/firmware/app_layout.h" #include "keepkey/firmware/authenticator.h" #include "keepkey/firmware/coins.h" -#include "keepkey/firmware/cosmos.h" -#include "keepkey/firmware/binance.h" #include "keepkey/firmware/crypto.h" -#include "keepkey/firmware/eos.h" -#include "keepkey/firmware/eos-contracts.h" -#include "keepkey/firmware/ethereum.h" -#include "keepkey/firmware/ethereum_tokens.h" #include "keepkey/firmware/fsm.h" #include "keepkey/firmware/home_sm.h" -#include "keepkey/firmware/mayachain.h" -#include "keepkey/firmware/osmosis.h" #include "keepkey/firmware/passphrase_sm.h" #include "keepkey/firmware/pin_sm.h" #include "keepkey/firmware/policy.h" #include "keepkey/firmware/recovery_cipher.h" #include "keepkey/firmware/reset.h" -#include "keepkey/firmware/ripple.h" #include "keepkey/firmware/signing.h" -#include "keepkey/firmware/signtx_tendermint.h" #include "keepkey/firmware/storage.h" -#include "keepkey/firmware/tendermint.h" -#include "keepkey/firmware/thorchain.h" #include "keepkey/firmware/transaction.h" #include "keepkey/firmware/txin_check.h" #include "keepkey/firmware/u2f.h" @@ -75,6 +66,21 @@ #include "trezor/crypto/secp256k1.h" #include "messages.pb.h" + +#ifndef BITCOIN_ONLY +#include "keepkey/firmware/cosmos.h" +#include "keepkey/firmware/binance.h" +#include "keepkey/firmware/eos.h" +#include "keepkey/firmware/eos-contracts.h" +#include "keepkey/firmware/ethereum.h" +#include "keepkey/firmware/ethereum_tokens.h" +#include "keepkey/firmware/mayachain.h" +#include "keepkey/firmware/osmosis.h" +#include "keepkey/firmware/ripple.h" +#include "keepkey/firmware/signtx_tendermint.h" +#include "keepkey/firmware/tendermint.h" +#include "keepkey/firmware/thorchain.h" + #include "messages-ethereum.pb.h" #include "messages-binance.pb.h" #include "messages-cosmos.pb.h" @@ -84,8 +90,7 @@ #include "messages-ripple.pb.h" #include "messages-thorchain.pb.h" #include "messages-mayachain.pb.h" - -#include +#endif // BITCOIN_ONLY #define _(X) (X) @@ -272,10 +277,11 @@ void fsm_msgClearSession(ClearSession *msg) { #include "fsm_msg_common.h" #include "fsm_msg_coin.h" +#include "fsm_msg_debug.h" +#include "fsm_msg_crypto.h" +#ifndef BITCOIN_ONLY #include "fsm_msg_ethereum.h" #include "fsm_msg_nano.h" -#include "fsm_msg_crypto.h" -#include "fsm_msg_debug.h" #include "fsm_msg_eos.h" #include "fsm_msg_cosmos.h" #include "fsm_msg_osmosis.h" @@ -284,3 +290,4 @@ void fsm_msgClearSession(ClearSession *msg) { #include "fsm_msg_tendermint.h" #include "fsm_msg_thorchain.h" #include "fsm_msg_mayachain.h" +#endif // BITCOIN_ONLY \ No newline at end of file diff --git a/lib/firmware/fsm_msg_common.h b/lib/firmware/fsm_msg_common.h index 33cd3e10d..5bf1a6747 100644 --- a/lib/firmware/fsm_msg_common.h +++ b/lib/firmware/fsm_msg_common.h @@ -2,9 +2,11 @@ void fsm_msgInitialize(Initialize *msg) { (void)msg; recovery_cipher_abort(); signing_abort(); +#ifndef BITCOIN_ONLY ethereum_signing_abort(); tendermint_signAbort(); eos_signingAbort(); +#endif session_clear(false); // do not clear PIN layoutHome(); fsm_msgGetFeatures(0); @@ -149,9 +151,12 @@ void fsm_msgGetCoinTable(GetCoinTable *msg) { for (size_t i = 0; i < msg->end - msg->start; i++) { if (msg->start + i < COINS_COUNT) { resp->table[i] = coins[msg->start + i]; - } else if (msg->start + i - COINS_COUNT < TOKENS_COUNT) { + } +#ifndef BITCOIN_ONLY + else if (msg->start + i - COINS_COUNT < TOKENS_COUNT) { coinFromToken(&resp->table[i], &tokens[msg->start + i - COINS_COUNT]); } +#endif // BITCOIN_ONLY } } @@ -545,9 +550,11 @@ void fsm_msgCancel(Cancel *msg) { (void)msg; recovery_cipher_abort(); signing_abort(); +#ifndef BITCOIN_ONLY ethereum_signing_abort(); tendermint_signAbort(); eos_signingAbort(); +#endif // BITCOIN_ONLY fsm_sendFailure(FailureType_Failure_ActionCancelled, "Aborted"); } diff --git a/lib/firmware/messagemap.def b/lib/firmware/messagemap.def index e8e374386..c830ca4ad 100644 --- a/lib/firmware/messagemap.def +++ b/lib/firmware/messagemap.def @@ -33,6 +33,7 @@ MSG_IN(MessageType_MessageType_RecoveryDevice, RecoveryDevice, fsm_msgRecoveryDevice) MSG_IN(MessageType_MessageType_CharacterAck, CharacterAck, fsm_msgCharacterAck) MSG_IN(MessageType_MessageType_ApplyPolicies, ApplyPolicies, fsm_msgApplyPolicies) +#ifndef BITCOIN_ONLY MSG_IN(MessageType_MessageType_EthereumGetAddress, EthereumGetAddress, fsm_msgEthereumGetAddress) MSG_IN(MessageType_MessageType_EthereumSignTx, EthereumSignTx, fsm_msgEthereumSignTx) MSG_IN(MessageType_MessageType_EthereumTxAck, EthereumTxAck, fsm_msgEthereumTxAck) @@ -72,7 +73,7 @@ MSG_IN(MessageType_MessageType_MayachainGetAddress, MayachainGetAddress, fsm_msgMayachainGetAddress) MSG_IN(MessageType_MessageType_MayachainSignTx, MayachainSignTx, fsm_msgMayachainSignTx) MSG_IN(MessageType_MessageType_MayachainMsgAck, MayachainMsgAck, fsm_msgMayachainMsgAck) - +#endif // BITCOIN_ONLY /* Normal Out Messages */ MSG_OUT(MessageType_MessageType_Success, Success, NO_PROCESS_FUNC) MSG_OUT(MessageType_MessageType_Failure, Failure, NO_PROCESS_FUNC) @@ -95,6 +96,7 @@ MSG_OUT(MessageType_MessageType_PassphraseRequest, PassphraseRequest, NO_PROCESS_FUNC) MSG_OUT(MessageType_MessageType_WordRequest, WordRequest, NO_PROCESS_FUNC) MSG_OUT(MessageType_MessageType_CharacterRequest, CharacterRequest, NO_PROCESS_FUNC) +#ifndef BITCOIN_ONLY MSG_OUT(MessageType_MessageType_EthereumAddress, EthereumAddress, NO_PROCESS_FUNC) MSG_OUT(MessageType_MessageType_EthereumTxRequest, EthereumTxRequest, NO_PROCESS_FUNC) MSG_OUT(MessageType_MessageType_EthereumMessageSignature, EthereumMessageSignature, NO_PROCESS_FUNC) @@ -131,7 +133,7 @@ MSG_OUT(MessageType_MessageType_MayachainAddress, MayachainAddress, NO_PROCESS_FUNC) MSG_OUT(MessageType_MessageType_MayachainMsgRequest, MayachainMsgRequest, NO_PROCESS_FUNC) MSG_OUT(MessageType_MessageType_MayachainSignedTx, MayachainSignedTx, NO_PROCESS_FUNC) - +#endif // BITCOIN_ONLY #if DEBUG_LINK /* Debug Messages */ DEBUG_IN(MessageType_MessageType_DebugLinkDecision, DebugLinkDecision, NO_PROCESS_FUNC) diff --git a/lib/firmware/transaction.c b/lib/firmware/transaction.c index aa37285e0..a7c75b569 100644 --- a/lib/firmware/transaction.c +++ b/lib/firmware/transaction.c @@ -236,7 +236,9 @@ int compile_output(const CoinType *coin, const HDNode *root, TxOutputType *in, in->op_return_data.size)) { return -1; // user aborted } - } else { + } +#ifndef BITCOIN_ONLY + else { // is this thorchain data? if (!thorchain_parseConfirmMemo((const char *)in->op_return_data.bytes, (size_t)in->op_return_data.size)) { if (!confirm_data(ButtonRequestType_ButtonRequest_ConfirmOutput, @@ -246,6 +248,18 @@ int compile_output(const CoinType *coin, const HDNode *root, TxOutputType *in, } } } + +#else // for btc-only, don't do a thorchain memo check + else { + if (!confirm_data(ButtonRequestType_ButtonRequest_ConfirmOutput, + _("Confirm OP_RETURN"), in->op_return_data.bytes, + in->op_return_data.size)) { + return -1; // user aborted + } + } + +#endif // BITCOIN_ONLY + } uint32_t r = 0; out->script_pubkey.bytes[0] = 0x6A; diff --git a/lib/transport/CMakeLists.txt b/lib/transport/CMakeLists.txt index 41b8d5864..086f4cd74 100644 --- a/lib/transport/CMakeLists.txt +++ b/lib/transport/CMakeLists.txt @@ -3,152 +3,209 @@ set(sources pb_encode.c pb_decode.c) -set(protoc_pb_sources + # always build bitcoin messages + set(protoc_pb_sources ${DEVICE_PROTOCOL}/types.proto - ${DEVICE_PROTOCOL}/messages-ethereum.proto - ${DEVICE_PROTOCOL}/messages-eos.proto - ${DEVICE_PROTOCOL}/messages-nano.proto - ${DEVICE_PROTOCOL}/messages-binance.proto - ${DEVICE_PROTOCOL}/messages-cosmos.proto - ${DEVICE_PROTOCOL}/messages-osmosis.proto - ${DEVICE_PROTOCOL}/messages-ripple.proto - ${DEVICE_PROTOCOL}/messages-tendermint.proto - ${DEVICE_PROTOCOL}/messages-thorchain.proto - ${DEVICE_PROTOCOL}/messages-mayachain.proto ${DEVICE_PROTOCOL}/messages.proto) set(protoc_pb_options ${CMAKE_SOURCE_DIR}/include/keepkey/transport/types.options - ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-ethereum.options - ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-eos.options - ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-nano.options - ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-binance.options - ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-cosmos.options - ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-osmosis.options - ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-ripple.options - ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-tendermint.options - ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-thorchain.options - ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-mayachain.options ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages.options) set(protoc_c_sources ${CMAKE_BINARY_DIR}/lib/transport/types.pb.c - ${CMAKE_BINARY_DIR}/lib/transport/messages-ethereum.pb.c - ${CMAKE_BINARY_DIR}/lib/transport/messages-eos.pb.c - ${CMAKE_BINARY_DIR}/lib/transport/messages-nano.pb.c - ${CMAKE_BINARY_DIR}/lib/transport/messages-binance.pb.c - ${CMAKE_BINARY_DIR}/lib/transport/messages-cosmos.pb.c - ${CMAKE_BINARY_DIR}/lib/transport/messages-osmosis.pb.c - ${CMAKE_BINARY_DIR}/lib/transport/messages-ripple.pb.c - ${CMAKE_BINARY_DIR}/lib/transport/messages-tendermint.pb.c - ${CMAKE_BINARY_DIR}/lib/transport/messages-thorchain.pb.c - ${CMAKE_BINARY_DIR}/lib/transport/messages-mayachain.pb.c ${CMAKE_BINARY_DIR}/lib/transport/messages.pb.c) set(protoc_c_headers ${CMAKE_BINARY_DIR}/include/types.pb.h - ${CMAKE_BINARY_DIR}/include/messages-ethereum.pb.h - ${CMAKE_BINARY_DIR}/include/messages-eos.pb.h - ${CMAKE_BINARY_DIR}/include/messages-nano.pb.h - ${CMAKE_BINARY_DIR}/include/messages-binance.pb.h - ${CMAKE_BINARY_DIR}/include/messages-cosmos.pb.h - ${CMAKE_BINARY_DIR}/include/messages-osmosis.pb.h - ${CMAKE_BINARY_DIR}/include/messages-ripple.pb.h - ${CMAKE_BINARY_DIR}/include/messages-tendermint.pb.h - ${CMAKE_BINARY_DIR}/include/messages-thorchain.pb.h - ${CMAKE_BINARY_DIR}/include/messages-mayachain.pb.h ${CMAKE_BINARY_DIR}/include/messages.pb.h) set(protoc_pb_sources_moved ${CMAKE_BINARY_DIR}/lib/transport/types.proto - ${CMAKE_BINARY_DIR}/lib/transport/messages-ethereum.proto - ${CMAKE_BINARY_DIR}/lib/transport/messages-eos.proto - ${CMAKE_BINARY_DIR}/lib/transport/messages-nano.proto - ${CMAKE_BINARY_DIR}/lib/transport/messages-binance.proto - ${CMAKE_BINARY_DIR}/lib/transport/messages-cosmos.proto - ${CMAKE_BINARY_DIR}/lib/transport/messages-osmosis.proto - ${CMAKE_BINARY_DIR}/lib/transport/messages-ripple.proto - ${CMAKE_BINARY_DIR}/lib/transport/messages-tendermint.proto - ${CMAKE_BINARY_DIR}/lib/transport/messages-thorchain.proto - ${CMAKE_BINARY_DIR}/lib/transport/messages-mayachain.proto ${CMAKE_BINARY_DIR}/lib/transport/messages.proto) -add_custom_command( - OUTPUT - ${CMAKE_BINARY_DIR}/lib/transport/kktransport.pb.stamp - ${protoc_c_sources} - ${protoc_c_headers} - WORKING_DIRECTORY - ${CMAKE_BINARY_DIR}/lib/transport - COMMAND - ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/keepkey/transport - COMMAND - ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/lib/transport - COMMAND - ${CMAKE_COMMAND} -E copy ${protoc_pb_options} ${CMAKE_BINARY_DIR}/lib/transport - COMMAND - ${CMAKE_COMMAND} -E copy ${protoc_pb_sources} ${CMAKE_BINARY_DIR}/lib/transport - COMMAND - ${CMAKE_COMMAND} -E copy - ${DEVICE_PROTOCOL}/google/protobuf/descriptor.proto - ${CMAKE_BINARY_DIR}/lib/transport/google/protobuf/descriptor.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f types.options:." types.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages-ethereum.options:." messages-ethereum.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages-eos.options:." messages-eos.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages-nano.options:." messages-nano.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages-binance.options:." messages-binance.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages-cosmos.options:." messages-cosmos.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages-osmosis.options:." messages-osmosis.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages-ripple.options:." messages-ripple.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages-tendermint.options:." messages-tendermint.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages-thorchain.options:." messages-thorchain.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages-mayachain.options:." messages-mayachain.proto - COMMAND - ${PROTOC_BINARY} -I. -I/usr/include - --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb - "--nanopb_out=-f messages.options:." messages.proto - COMMAND - ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/lib/transport/*.pb.h - ${CMAKE_BINARY_DIR}/include - COMMAND - sh -c "! grep -r pb_callback_t ${CMAKE_BINARY_DIR}/include/*.pb.h" || (echo "pb_callback_t forbidden. missing .options entry?" && false) - COMMAND - ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/lib/transport/kktransport.pb.stamp - DEPENDS - ${protoc_pb_sources} ${protoc_pb_options}) +if("${COIN_SUPPORT}" STREQUAL "BTC") +else() + # if full coin support, build rest of messages + list(APPEND protoc_pb_sources + ${DEVICE_PROTOCOL}/messages-ethereum.proto + ${DEVICE_PROTOCOL}/messages-eos.proto + ${DEVICE_PROTOCOL}/messages-nano.proto + ${DEVICE_PROTOCOL}/messages-binance.proto + ${DEVICE_PROTOCOL}/messages-cosmos.proto + ${DEVICE_PROTOCOL}/messages-osmosis.proto + ${DEVICE_PROTOCOL}/messages-ripple.proto + ${DEVICE_PROTOCOL}/messages-tendermint.proto + ${DEVICE_PROTOCOL}/messages-thorchain.proto + ${DEVICE_PROTOCOL}/messages-mayachain.proto) + + list(APPEND protoc_pb_options + ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-ethereum.options + ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-eos.options + ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-nano.options + ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-binance.options + ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-cosmos.options + ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-osmosis.options + ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-ripple.options + ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-tendermint.options + ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-thorchain.options + ${CMAKE_SOURCE_DIR}/include/keepkey/transport/messages-mayachain.options) + + list(APPEND protoc_c_sources + ${CMAKE_BINARY_DIR}/lib/transport/messages-ethereum.pb.c + ${CMAKE_BINARY_DIR}/lib/transport/messages-eos.pb.c + ${CMAKE_BINARY_DIR}/lib/transport/messages-nano.pb.c + ${CMAKE_BINARY_DIR}/lib/transport/messages-binance.pb.c + ${CMAKE_BINARY_DIR}/lib/transport/messages-cosmos.pb.c + ${CMAKE_BINARY_DIR}/lib/transport/messages-osmosis.pb.c + ${CMAKE_BINARY_DIR}/lib/transport/messages-ripple.pb.c + ${CMAKE_BINARY_DIR}/lib/transport/messages-tendermint.pb.c + ${CMAKE_BINARY_DIR}/lib/transport/messages-thorchain.pb.c + ${CMAKE_BINARY_DIR}/lib/transport/messages-mayachain.pb.c) + + list(APPEND protoc_c_headers + ${CMAKE_BINARY_DIR}/include/messages-ethereum.pb.h + ${CMAKE_BINARY_DIR}/include/messages-eos.pb.h + ${CMAKE_BINARY_DIR}/include/messages-nano.pb.h + ${CMAKE_BINARY_DIR}/include/messages-binance.pb.h + ${CMAKE_BINARY_DIR}/include/messages-cosmos.pb.h + ${CMAKE_BINARY_DIR}/include/messages-osmosis.pb.h + ${CMAKE_BINARY_DIR}/include/messages-ripple.pb.h + ${CMAKE_BINARY_DIR}/include/messages-tendermint.pb.h + ${CMAKE_BINARY_DIR}/include/messages-thorchain.pb.h + ${CMAKE_BINARY_DIR}/include/messages-mayachain.pb.h) + + list(APPEND protoc_pb_sources_moved + ${CMAKE_BINARY_DIR}/lib/transport/messages-ethereum.proto + ${CMAKE_BINARY_DIR}/lib/transport/messages-eos.proto + ${CMAKE_BINARY_DIR}/lib/transport/messages-nano.proto + ${CMAKE_BINARY_DIR}/lib/transport/messages-binance.proto + ${CMAKE_BINARY_DIR}/lib/transport/messages-cosmos.proto + ${CMAKE_BINARY_DIR}/lib/transport/messages-osmosis.proto + ${CMAKE_BINARY_DIR}/lib/transport/messages-ripple.proto + ${CMAKE_BINARY_DIR}/lib/transport/messages-tendermint.proto + ${CMAKE_BINARY_DIR}/lib/transport/messages-thorchain.proto + ${CMAKE_BINARY_DIR}/lib/transport/messages-mayachain.proto) +endif() + +if("${COIN_SUPPORT}" STREQUAL "BTC") + # build bitcoin only messages + add_custom_command( + OUTPUT + ${CMAKE_BINARY_DIR}/lib/transport/kktransport.pb.stamp + ${protoc_c_sources} + ${protoc_c_headers} + WORKING_DIRECTORY + ${CMAKE_BINARY_DIR}/lib/transport + COMMAND + ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/keepkey/transport + COMMAND + ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/lib/transport + COMMAND + ${CMAKE_COMMAND} -E copy ${protoc_pb_options} ${CMAKE_BINARY_DIR}/lib/transport + COMMAND + ${CMAKE_COMMAND} -E copy ${protoc_pb_sources} ${CMAKE_BINARY_DIR}/lib/transport + COMMAND + ${CMAKE_COMMAND} -E copy + ${DEVICE_PROTOCOL}/google/protobuf/descriptor.proto + ${CMAKE_BINARY_DIR}/lib/transport/google/protobuf/descriptor.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f types.options:." types.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages.options:." messages.proto + COMMAND + ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/lib/transport/*.pb.h + ${CMAKE_BINARY_DIR}/include + COMMAND + sh -c "! grep -r pb_callback_t ${CMAKE_BINARY_DIR}/include/*.pb.h" || (echo "pb_callback_t forbidden. missing .options entry?" && false) + COMMAND + ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/lib/transport/kktransport.pb.stamp + DEPENDS + ${protoc_pb_sources} ${protoc_pb_options}) + +else() + # if full coin support, build rest of messages + add_custom_command( + OUTPUT + ${CMAKE_BINARY_DIR}/lib/transport/kktransport.pb.stamp + ${protoc_c_sources} + ${protoc_c_headers} + WORKING_DIRECTORY + ${CMAKE_BINARY_DIR}/lib/transport + COMMAND + ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/keepkey/transport + COMMAND + ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/lib/transport + COMMAND + ${CMAKE_COMMAND} -E copy ${protoc_pb_options} ${CMAKE_BINARY_DIR}/lib/transport + COMMAND + ${CMAKE_COMMAND} -E copy ${protoc_pb_sources} ${CMAKE_BINARY_DIR}/lib/transport + COMMAND + ${CMAKE_COMMAND} -E copy + ${DEVICE_PROTOCOL}/google/protobuf/descriptor.proto + ${CMAKE_BINARY_DIR}/lib/transport/google/protobuf/descriptor.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f types.options:." types.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages-ethereum.options:." messages-ethereum.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages-eos.options:." messages-eos.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages-nano.options:." messages-nano.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages-binance.options:." messages-binance.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages-cosmos.options:." messages-cosmos.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages-osmosis.options:." messages-osmosis.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages-ripple.options:." messages-ripple.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages-tendermint.options:." messages-tendermint.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages-thorchain.options:." messages-thorchain.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages-mayachain.options:." messages-mayachain.proto + COMMAND + ${PROTOC_BINARY} -I. -I/usr/include + --plugin=nanopb=${NANOPB_DIR}/generator/protoc-gen-nanopb + "--nanopb_out=-f messages.options:." messages.proto + COMMAND + ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/lib/transport/*.pb.h + ${CMAKE_BINARY_DIR}/include + COMMAND + sh -c "! grep -r pb_callback_t ${CMAKE_BINARY_DIR}/include/*.pb.h" || (echo "pb_callback_t forbidden. missing .options entry?" && false) + COMMAND + ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/lib/transport/kktransport.pb.stamp + DEPENDS + ${protoc_pb_sources} ${protoc_pb_options}) +endif() add_custom_target(kktransport.pb ALL DEPENDS ${CMAKE_BINARY_DIR}/lib/transport/kktransport.pb.stamp) diff --git a/lib/variant/CMakeLists.txt b/lib/variant/CMakeLists.txt index 0728f3f28..99ff2119c 100644 --- a/lib/variant/CMakeLists.txt +++ b/lib/variant/CMakeLists.txt @@ -3,9 +3,15 @@ include_directories( ${CMAKE_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}) -add_library(kkvariant.keepkey - ${CMAKE_CURRENT_SOURCE_DIR}/keepkey/keepkey.c - ${CMAKE_CURRENT_SOURCE_DIR}/keepkey/logo.c) +if("${COIN_SUPPORT}" STREQUAL "BTC") + add_library(kkvariant.keepkey + ${CMAKE_CURRENT_SOURCE_DIR}/keepkey/keepkey.c + ${CMAKE_CURRENT_SOURCE_DIR}/keepkey/logobtc.c) +else() + add_library(kkvariant.keepkey + ${CMAKE_CURRENT_SOURCE_DIR}/keepkey/keepkey.c + ${CMAKE_CURRENT_SOURCE_DIR}/keepkey/logo.c) +endif() add_library(kkvariant.salt ${CMAKE_CURRENT_SOURCE_DIR}/salt/salt.c diff --git a/lib/variant/keepkey/logobtc.c b/lib/variant/keepkey/logobtc.c new file mode 100644 index 000000000..478c9c7bb --- /dev/null +++ b/lib/variant/keepkey/logobtc.c @@ -0,0 +1,460 @@ +/* + * This file is part of the KeepKey project. + * + * Copyright (C) 2025 markrypto + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +#include "keepkey/board/resources.h" + +const uint8_t kkbtc_logo_data[1798] = +{ + 0x16, 0x0, 0xff, 0x43, 0x2, 0xff, 0x7, 0x0, 0x2, 0xff, 0x3, 0x0, 0xff, 0x89, 0x14, 0x0, 0x2, 0xff, 0x1f, 0x0, 0xff, 0x9d, 0x2, 0xff, 0x7, 0x0, 0xfe, 0xff, 0xf0, 0x2, 0x0, 0x2, 0xff, 0x14, 0x0, 0x2, 0xff, 0x1f, 0x0, 0x2, 0xff, 0xfd, 0xef, 0x4f, 0x8c, 0x8, 0x0, 0xff, 0x78, 0x2, 0xff, 0xff, 0x4f, 0x3, 0x0, 0xfd, 0xb4, 0xe4, 0x9d, 0x5, 0x0, 0xfd, 0xb4, 0xe4, 0xb4, 0xc, 0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x57, 0x3, 0x0, 0xd, 0xff, 0x4, 0x0, 0xe, 0xff, 0x13, 0x0, 0xff, 0xa9, 0x3, 0xff, 0xff, 0x5e, 0x6, 0x0, 0x4, 0xff, 0xff, 0x96, 0x3, 0x0, 0xff, 0xa9, 0xb, 0xff, 0xff, 0xe4, 0x5, 0x0, 0x9, 0xff, 0xff, 0xe4, 0x3, 0xff, 0x13, 0x0, 0xff, 0xa9, 0x3, 0xff, 0xff, 0x81, 0x6, 0x0, 0xff, 0xc4, 0x3, 0xff, 0xff, 0xa9, 0x4, 0x0, 0xff, 0x81, 0x8, 0xff, 0xff, 0xef, 0x8, 0x0, 0xff, 0xe4, 0x5, 0xff, 0xfd, 0x92, 0x0, 0x9d, 0x3, 0xff, 0x14, 0x0, 0xff, 0x29, 0x14, 0x0, 0xfb, 0x57, 0x9d, 0xd4, 0xc4, 0x96, 0x13, 0x0, 0xff, 0x9d, 0x3, 0xff, 0x41, 0x0, 0xff, 0xb4, 0x3, 0xff, 0x41, 0x0, 0xff, 0xa9, 0x3, 0xff, 0x41, 0x0, 0xff, 0xa9, 0x3, 0xff, 0x41, 0x0, 0xff, 0xca, 0x3, 0xff, 0x40, 0x0, 0xff, 0xef, 0x4, 0xff, 0x40, 0x0, 0x5, 0xff, 0x40, 0x0, 0x5, 0xff, 0x40, 0x0, 0xff, 0xb8, 0x2, 0xff, 0xff, 0xc4, 0x13, 0x0 +}; +static const Image kkbtc_logo_image = {69, 60, 1798, kkbtc_logo_data}; + +const VariantAnimation kkbtc_logo = { + 21, + { + {94, 2, 25, 0, &kkbtc_logo_image}, + {94, 2, 25, 5, &kkbtc_logo_image}, + {94, 2, 25, 10, &kkbtc_logo_image}, + {94, 2, 25, 15, &kkbtc_logo_image}, + {94, 2, 25, 20, &kkbtc_logo_image}, + {94, 2, 25, 25, &kkbtc_logo_image}, + {94, 2, 25, 30, &kkbtc_logo_image}, + {94, 2, 25, 35, &kkbtc_logo_image}, + {94, 2, 25, 40, &kkbtc_logo_image}, + {94, 2, 25, 45, &kkbtc_logo_image}, + {94, 2, 25, 50, &kkbtc_logo_image}, + {94, 2, 25, 55, &kkbtc_logo_image}, + {94, 2, 25, 60, &kkbtc_logo_image}, + {94, 2, 25, 65, &kkbtc_logo_image}, + {94, 2, 25, 70, &kkbtc_logo_image}, + {94, 2, 25, 75, &kkbtc_logo_image}, + {94, 2, 25, 80, &kkbtc_logo_image}, + {94, 2, 25, 85, &kkbtc_logo_image}, + {94, 2, 25, 90, &kkbtc_logo_image}, + {94, 2, 25, 95, &kkbtc_logo_image}, + {94, 2, 25, 100, &kkbtc_logo_image}, + } +}; +const VariantAnimation kkbtc_logo_reversed = { + 21, + { + {94, 2, 25, 100, &kkbtc_logo_image}, + {94, 2, 25, 95, &kkbtc_logo_image}, + {94, 2, 25, 90, &kkbtc_logo_image}, + {94, 2, 25, 85, &kkbtc_logo_image}, + {94, 2, 25, 80, &kkbtc_logo_image}, + {94, 2, 25, 75, &kkbtc_logo_image}, + {94, 2, 25, 70, &kkbtc_logo_image}, + {94, 2, 25, 65, &kkbtc_logo_image}, + {94, 2, 25, 60, &kkbtc_logo_image}, + {94, 2, 25, 55, &kkbtc_logo_image}, + {94, 2, 25, 50, &kkbtc_logo_image}, + {94, 2, 25, 45, &kkbtc_logo_image}, + {94, 2, 25, 40, &kkbtc_logo_image}, + {94, 2, 25, 35, &kkbtc_logo_image}, + {94, 2, 25, 30, &kkbtc_logo_image}, + {94, 2, 25, 25, &kkbtc_logo_image}, + {94, 2, 25, 20, &kkbtc_logo_image}, + {94, 2, 25, 15, &kkbtc_logo_image}, + {94, 2, 25, 10, &kkbtc_logo_image}, + {94, 2, 25, 5, &kkbtc_logo_image}, + {94, 2, 25, 0, &kkbtc_logo_image}, + } +}; + +const VariantAnimation kkbtc_screensaver = { + 374, + { + {94, 2, 75, 60, &kkbtc_logo_image}, + {95, 2, 75, 60, &kkbtc_logo_image}, + {96, 2, 75, 60, &kkbtc_logo_image}, + {97, 2, 75, 60, &kkbtc_logo_image}, + {98, 2, 75, 60, &kkbtc_logo_image}, + {99, 2, 75, 60, &kkbtc_logo_image}, + {100, 2, 75, 60, &kkbtc_logo_image}, + {101, 2, 75, 60, &kkbtc_logo_image}, + {102, 2, 75, 60, &kkbtc_logo_image}, + {103, 2, 75, 60, &kkbtc_logo_image}, + {104, 2, 75, 60, &kkbtc_logo_image}, + {105, 2, 75, 60, &kkbtc_logo_image}, + {106, 2, 75, 60, &kkbtc_logo_image}, + {107, 2, 75, 60, &kkbtc_logo_image}, + {108, 2, 75, 60, &kkbtc_logo_image}, + {109, 2, 75, 60, &kkbtc_logo_image}, + {110, 2, 75, 60, &kkbtc_logo_image}, + {111, 2, 75, 60, &kkbtc_logo_image}, + {112, 2, 75, 60, &kkbtc_logo_image}, + {113, 2, 75, 60, &kkbtc_logo_image}, + {114, 2, 75, 60, &kkbtc_logo_image}, + {115, 2, 75, 60, &kkbtc_logo_image}, + {116, 2, 75, 60, &kkbtc_logo_image}, + {117, 2, 75, 60, &kkbtc_logo_image}, + {118, 2, 75, 60, &kkbtc_logo_image}, + {119, 2, 75, 60, &kkbtc_logo_image}, + {120, 2, 75, 60, &kkbtc_logo_image}, + {121, 2, 75, 60, &kkbtc_logo_image}, + {122, 2, 75, 60, &kkbtc_logo_image}, + {123, 2, 75, 60, &kkbtc_logo_image}, + {124, 2, 75, 60, &kkbtc_logo_image}, + {125, 2, 75, 60, &kkbtc_logo_image}, + {126, 2, 75, 60, &kkbtc_logo_image}, + {127, 2, 75, 60, &kkbtc_logo_image}, + {128, 2, 75, 60, &kkbtc_logo_image}, + {129, 2, 75, 60, &kkbtc_logo_image}, + {130, 2, 75, 60, &kkbtc_logo_image}, + {131, 2, 75, 60, &kkbtc_logo_image}, + {132, 2, 75, 60, &kkbtc_logo_image}, + {133, 2, 75, 60, &kkbtc_logo_image}, + {134, 2, 75, 60, &kkbtc_logo_image}, + {135, 2, 75, 60, &kkbtc_logo_image}, + {136, 2, 75, 60, &kkbtc_logo_image}, + {137, 2, 75, 60, &kkbtc_logo_image}, + {138, 2, 75, 60, &kkbtc_logo_image}, + {139, 2, 75, 60, &kkbtc_logo_image}, + {140, 2, 75, 60, &kkbtc_logo_image}, + {141, 2, 75, 60, &kkbtc_logo_image}, + {142, 2, 75, 60, &kkbtc_logo_image}, + {143, 2, 75, 60, &kkbtc_logo_image}, + {144, 2, 75, 60, &kkbtc_logo_image}, + {145, 2, 75, 60, &kkbtc_logo_image}, + {146, 2, 75, 60, &kkbtc_logo_image}, + {147, 2, 75, 60, &kkbtc_logo_image}, + {148, 2, 75, 60, &kkbtc_logo_image}, + {149, 2, 75, 60, &kkbtc_logo_image}, + {150, 2, 75, 60, &kkbtc_logo_image}, + {151, 2, 75, 60, &kkbtc_logo_image}, + {152, 2, 75, 60, &kkbtc_logo_image}, + {153, 2, 75, 60, &kkbtc_logo_image}, + {154, 2, 75, 60, &kkbtc_logo_image}, + {155, 2, 75, 60, &kkbtc_logo_image}, + {156, 2, 75, 60, &kkbtc_logo_image}, + {157, 2, 75, 60, &kkbtc_logo_image}, + {158, 2, 75, 60, &kkbtc_logo_image}, + {159, 2, 75, 60, &kkbtc_logo_image}, + {160, 2, 75, 60, &kkbtc_logo_image}, + {161, 2, 75, 60, &kkbtc_logo_image}, + {162, 2, 75, 60, &kkbtc_logo_image}, + {163, 2, 75, 60, &kkbtc_logo_image}, + {164, 2, 75, 60, &kkbtc_logo_image}, + {165, 2, 75, 60, &kkbtc_logo_image}, + {166, 2, 75, 60, &kkbtc_logo_image}, + {167, 2, 75, 60, &kkbtc_logo_image}, + {168, 2, 75, 60, &kkbtc_logo_image}, + {169, 2, 75, 60, &kkbtc_logo_image}, + {170, 2, 75, 60, &kkbtc_logo_image}, + {171, 2, 75, 60, &kkbtc_logo_image}, + {172, 2, 75, 60, &kkbtc_logo_image}, + {173, 2, 75, 60, &kkbtc_logo_image}, + {174, 2, 75, 60, &kkbtc_logo_image}, + {175, 2, 75, 60, &kkbtc_logo_image}, + {176, 2, 75, 60, &kkbtc_logo_image}, + {177, 2, 75, 60, &kkbtc_logo_image}, + {178, 2, 75, 60, &kkbtc_logo_image}, + {179, 2, 75, 60, &kkbtc_logo_image}, + {180, 2, 75, 60, &kkbtc_logo_image}, + {181, 2, 75, 60, &kkbtc_logo_image}, + {182, 2, 75, 60, &kkbtc_logo_image}, + {183, 2, 75, 60, &kkbtc_logo_image}, + {184, 2, 75, 60, &kkbtc_logo_image}, + {185, 2, 75, 60, &kkbtc_logo_image}, + {186, 2, 75, 60, &kkbtc_logo_image}, + {185, 2, 75, 60, &kkbtc_logo_image}, + {184, 2, 75, 60, &kkbtc_logo_image}, + {183, 2, 75, 60, &kkbtc_logo_image}, + {182, 2, 75, 60, &kkbtc_logo_image}, + {181, 2, 75, 60, &kkbtc_logo_image}, + {180, 2, 75, 60, &kkbtc_logo_image}, + {179, 2, 75, 60, &kkbtc_logo_image}, + {178, 2, 75, 60, &kkbtc_logo_image}, + {177, 2, 75, 60, &kkbtc_logo_image}, + {176, 2, 75, 60, &kkbtc_logo_image}, + {175, 2, 75, 60, &kkbtc_logo_image}, + {174, 2, 75, 60, &kkbtc_logo_image}, + {173, 2, 75, 60, &kkbtc_logo_image}, + {172, 2, 75, 60, &kkbtc_logo_image}, + {171, 2, 75, 60, &kkbtc_logo_image}, + {170, 2, 75, 60, &kkbtc_logo_image}, + {169, 2, 75, 60, &kkbtc_logo_image}, + {168, 2, 75, 60, &kkbtc_logo_image}, + {167, 2, 75, 60, &kkbtc_logo_image}, + {166, 2, 75, 60, &kkbtc_logo_image}, + {165, 2, 75, 60, &kkbtc_logo_image}, + {164, 2, 75, 60, &kkbtc_logo_image}, + {163, 2, 75, 60, &kkbtc_logo_image}, + {162, 2, 75, 60, &kkbtc_logo_image}, + {161, 2, 75, 60, &kkbtc_logo_image}, + {160, 2, 75, 60, &kkbtc_logo_image}, + {159, 2, 75, 60, &kkbtc_logo_image}, + {158, 2, 75, 60, &kkbtc_logo_image}, + {157, 2, 75, 60, &kkbtc_logo_image}, + {156, 2, 75, 60, &kkbtc_logo_image}, + {155, 2, 75, 60, &kkbtc_logo_image}, + {154, 2, 75, 60, &kkbtc_logo_image}, + {153, 2, 75, 60, &kkbtc_logo_image}, + {152, 2, 75, 60, &kkbtc_logo_image}, + {151, 2, 75, 60, &kkbtc_logo_image}, + {150, 2, 75, 60, &kkbtc_logo_image}, + {149, 2, 75, 60, &kkbtc_logo_image}, + {148, 2, 75, 60, &kkbtc_logo_image}, + {147, 2, 75, 60, &kkbtc_logo_image}, + {146, 2, 75, 60, &kkbtc_logo_image}, + {145, 2, 75, 60, &kkbtc_logo_image}, + {144, 2, 75, 60, &kkbtc_logo_image}, + {143, 2, 75, 60, &kkbtc_logo_image}, + {142, 2, 75, 60, &kkbtc_logo_image}, + {141, 2, 75, 60, &kkbtc_logo_image}, + {140, 2, 75, 60, &kkbtc_logo_image}, + {139, 2, 75, 60, &kkbtc_logo_image}, + {138, 2, 75, 60, &kkbtc_logo_image}, + {137, 2, 75, 60, &kkbtc_logo_image}, + {136, 2, 75, 60, &kkbtc_logo_image}, + {135, 2, 75, 60, &kkbtc_logo_image}, + {134, 2, 75, 60, &kkbtc_logo_image}, + {133, 2, 75, 60, &kkbtc_logo_image}, + {132, 2, 75, 60, &kkbtc_logo_image}, + {131, 2, 75, 60, &kkbtc_logo_image}, + {130, 2, 75, 60, &kkbtc_logo_image}, + {129, 2, 75, 60, &kkbtc_logo_image}, + {128, 2, 75, 60, &kkbtc_logo_image}, + {127, 2, 75, 60, &kkbtc_logo_image}, + {126, 2, 75, 60, &kkbtc_logo_image}, + {125, 2, 75, 60, &kkbtc_logo_image}, + {124, 2, 75, 60, &kkbtc_logo_image}, + {123, 2, 75, 60, &kkbtc_logo_image}, + {122, 2, 75, 60, &kkbtc_logo_image}, + {121, 2, 75, 60, &kkbtc_logo_image}, + {120, 2, 75, 60, &kkbtc_logo_image}, + {119, 2, 75, 60, &kkbtc_logo_image}, + {118, 2, 75, 60, &kkbtc_logo_image}, + {117, 2, 75, 60, &kkbtc_logo_image}, + {116, 2, 75, 60, &kkbtc_logo_image}, + {115, 2, 75, 60, &kkbtc_logo_image}, + {114, 2, 75, 60, &kkbtc_logo_image}, + {113, 2, 75, 60, &kkbtc_logo_image}, + {112, 2, 75, 60, &kkbtc_logo_image}, + {111, 2, 75, 60, &kkbtc_logo_image}, + {110, 2, 75, 60, &kkbtc_logo_image}, + {109, 2, 75, 60, &kkbtc_logo_image}, + {108, 2, 75, 60, &kkbtc_logo_image}, + {107, 2, 75, 60, &kkbtc_logo_image}, + {106, 2, 75, 60, &kkbtc_logo_image}, + {105, 2, 75, 60, &kkbtc_logo_image}, + {104, 2, 75, 60, &kkbtc_logo_image}, + {103, 2, 75, 60, &kkbtc_logo_image}, + {102, 2, 75, 60, &kkbtc_logo_image}, + {101, 2, 75, 60, &kkbtc_logo_image}, + {100, 2, 75, 60, &kkbtc_logo_image}, + {99, 2, 75, 60, &kkbtc_logo_image}, + {98, 2, 75, 60, &kkbtc_logo_image}, + {97, 2, 75, 60, &kkbtc_logo_image}, + {96, 2, 75, 60, &kkbtc_logo_image}, + {95, 2, 75, 60, &kkbtc_logo_image}, + {94, 2, 75, 60, &kkbtc_logo_image}, + {93, 2, 75, 60, &kkbtc_logo_image}, + {92, 2, 75, 60, &kkbtc_logo_image}, + {91, 2, 75, 60, &kkbtc_logo_image}, + {90, 2, 75, 60, &kkbtc_logo_image}, + {89, 2, 75, 60, &kkbtc_logo_image}, + {88, 2, 75, 60, &kkbtc_logo_image}, + {87, 2, 75, 60, &kkbtc_logo_image}, + {86, 2, 75, 60, &kkbtc_logo_image}, + {85, 2, 75, 60, &kkbtc_logo_image}, + {84, 2, 75, 60, &kkbtc_logo_image}, + {83, 2, 75, 60, &kkbtc_logo_image}, + {82, 2, 75, 60, &kkbtc_logo_image}, + {81, 2, 75, 60, &kkbtc_logo_image}, + {80, 2, 75, 60, &kkbtc_logo_image}, + {79, 2, 75, 60, &kkbtc_logo_image}, + {78, 2, 75, 60, &kkbtc_logo_image}, + {77, 2, 75, 60, &kkbtc_logo_image}, + {76, 2, 75, 60, &kkbtc_logo_image}, + {75, 2, 75, 60, &kkbtc_logo_image}, + {74, 2, 75, 60, &kkbtc_logo_image}, + {73, 2, 75, 60, &kkbtc_logo_image}, + {72, 2, 75, 60, &kkbtc_logo_image}, + {71, 2, 75, 60, &kkbtc_logo_image}, + {70, 2, 75, 60, &kkbtc_logo_image}, + {69, 2, 75, 60, &kkbtc_logo_image}, + {68, 2, 75, 60, &kkbtc_logo_image}, + {67, 2, 75, 60, &kkbtc_logo_image}, + {66, 2, 75, 60, &kkbtc_logo_image}, + {65, 2, 75, 60, &kkbtc_logo_image}, + {64, 2, 75, 60, &kkbtc_logo_image}, + {63, 2, 75, 60, &kkbtc_logo_image}, + {62, 2, 75, 60, &kkbtc_logo_image}, + {61, 2, 75, 60, &kkbtc_logo_image}, + {60, 2, 75, 60, &kkbtc_logo_image}, + {59, 2, 75, 60, &kkbtc_logo_image}, + {58, 2, 75, 60, &kkbtc_logo_image}, + {57, 2, 75, 60, &kkbtc_logo_image}, + {56, 2, 75, 60, &kkbtc_logo_image}, + {55, 2, 75, 60, &kkbtc_logo_image}, + {54, 2, 75, 60, &kkbtc_logo_image}, + {53, 2, 75, 60, &kkbtc_logo_image}, + {52, 2, 75, 60, &kkbtc_logo_image}, + {51, 2, 75, 60, &kkbtc_logo_image}, + {50, 2, 75, 60, &kkbtc_logo_image}, + {49, 2, 75, 60, &kkbtc_logo_image}, + {48, 2, 75, 60, &kkbtc_logo_image}, + {47, 2, 75, 60, &kkbtc_logo_image}, + {46, 2, 75, 60, &kkbtc_logo_image}, + {45, 2, 75, 60, &kkbtc_logo_image}, + {44, 2, 75, 60, &kkbtc_logo_image}, + {43, 2, 75, 60, &kkbtc_logo_image}, + {42, 2, 75, 60, &kkbtc_logo_image}, + {41, 2, 75, 60, &kkbtc_logo_image}, + {40, 2, 75, 60, &kkbtc_logo_image}, + {39, 2, 75, 60, &kkbtc_logo_image}, + {38, 2, 75, 60, &kkbtc_logo_image}, + {37, 2, 75, 60, &kkbtc_logo_image}, + {36, 2, 75, 60, &kkbtc_logo_image}, + {35, 2, 75, 60, &kkbtc_logo_image}, + {34, 2, 75, 60, &kkbtc_logo_image}, + {33, 2, 75, 60, &kkbtc_logo_image}, + {32, 2, 75, 60, &kkbtc_logo_image}, + {31, 2, 75, 60, &kkbtc_logo_image}, + {30, 2, 75, 60, &kkbtc_logo_image}, + {29, 2, 75, 60, &kkbtc_logo_image}, + {28, 2, 75, 60, &kkbtc_logo_image}, + {27, 2, 75, 60, &kkbtc_logo_image}, + {26, 2, 75, 60, &kkbtc_logo_image}, + {25, 2, 75, 60, &kkbtc_logo_image}, + {24, 2, 75, 60, &kkbtc_logo_image}, + {23, 2, 75, 60, &kkbtc_logo_image}, + {22, 2, 75, 60, &kkbtc_logo_image}, + {21, 2, 75, 60, &kkbtc_logo_image}, + {20, 2, 75, 60, &kkbtc_logo_image}, + {19, 2, 75, 60, &kkbtc_logo_image}, + {18, 2, 75, 60, &kkbtc_logo_image}, + {17, 2, 75, 60, &kkbtc_logo_image}, + {16, 2, 75, 60, &kkbtc_logo_image}, + {15, 2, 75, 60, &kkbtc_logo_image}, + {14, 2, 75, 60, &kkbtc_logo_image}, + {13, 2, 75, 60, &kkbtc_logo_image}, + {12, 2, 75, 60, &kkbtc_logo_image}, + {11, 2, 75, 60, &kkbtc_logo_image}, + {10, 2, 75, 60, &kkbtc_logo_image}, + {9, 2, 75, 60, &kkbtc_logo_image}, + {8, 2, 75, 60, &kkbtc_logo_image}, + {7, 2, 75, 60, &kkbtc_logo_image}, + {6, 2, 75, 60, &kkbtc_logo_image}, + {5, 2, 75, 60, &kkbtc_logo_image}, + {4, 2, 75, 60, &kkbtc_logo_image}, + {3, 2, 75, 60, &kkbtc_logo_image}, + {2, 2, 75, 60, &kkbtc_logo_image}, + {1, 2, 75, 60, &kkbtc_logo_image}, + {0, 2, 75, 60, &kkbtc_logo_image}, + {0, 2, 75, 60, &kkbtc_logo_image}, + {1, 2, 75, 60, &kkbtc_logo_image}, + {2, 2, 75, 60, &kkbtc_logo_image}, + {3, 2, 75, 60, &kkbtc_logo_image}, + {4, 2, 75, 60, &kkbtc_logo_image}, + {5, 2, 75, 60, &kkbtc_logo_image}, + {6, 2, 75, 60, &kkbtc_logo_image}, + {7, 2, 75, 60, &kkbtc_logo_image}, + {8, 2, 75, 60, &kkbtc_logo_image}, + {9, 2, 75, 60, &kkbtc_logo_image}, + {10, 2, 75, 60, &kkbtc_logo_image}, + {11, 2, 75, 60, &kkbtc_logo_image}, + {12, 2, 75, 60, &kkbtc_logo_image}, + {13, 2, 75, 60, &kkbtc_logo_image}, + {14, 2, 75, 60, &kkbtc_logo_image}, + {15, 2, 75, 60, &kkbtc_logo_image}, + {16, 2, 75, 60, &kkbtc_logo_image}, + {17, 2, 75, 60, &kkbtc_logo_image}, + {18, 2, 75, 60, &kkbtc_logo_image}, + {19, 2, 75, 60, &kkbtc_logo_image}, + {20, 2, 75, 60, &kkbtc_logo_image}, + {21, 2, 75, 60, &kkbtc_logo_image}, + {22, 2, 75, 60, &kkbtc_logo_image}, + {23, 2, 75, 60, &kkbtc_logo_image}, + {24, 2, 75, 60, &kkbtc_logo_image}, + {25, 2, 75, 60, &kkbtc_logo_image}, + {26, 2, 75, 60, &kkbtc_logo_image}, + {27, 2, 75, 60, &kkbtc_logo_image}, + {28, 2, 75, 60, &kkbtc_logo_image}, + {29, 2, 75, 60, &kkbtc_logo_image}, + {30, 2, 75, 60, &kkbtc_logo_image}, + {31, 2, 75, 60, &kkbtc_logo_image}, + {32, 2, 75, 60, &kkbtc_logo_image}, + {33, 2, 75, 60, &kkbtc_logo_image}, + {34, 2, 75, 60, &kkbtc_logo_image}, + {35, 2, 75, 60, &kkbtc_logo_image}, + {36, 2, 75, 60, &kkbtc_logo_image}, + {37, 2, 75, 60, &kkbtc_logo_image}, + {38, 2, 75, 60, &kkbtc_logo_image}, + {39, 2, 75, 60, &kkbtc_logo_image}, + {40, 2, 75, 60, &kkbtc_logo_image}, + {41, 2, 75, 60, &kkbtc_logo_image}, + {42, 2, 75, 60, &kkbtc_logo_image}, + {43, 2, 75, 60, &kkbtc_logo_image}, + {44, 2, 75, 60, &kkbtc_logo_image}, + {45, 2, 75, 60, &kkbtc_logo_image}, + {46, 2, 75, 60, &kkbtc_logo_image}, + {47, 2, 75, 60, &kkbtc_logo_image}, + {48, 2, 75, 60, &kkbtc_logo_image}, + {49, 2, 75, 60, &kkbtc_logo_image}, + {50, 2, 75, 60, &kkbtc_logo_image}, + {51, 2, 75, 60, &kkbtc_logo_image}, + {52, 2, 75, 60, &kkbtc_logo_image}, + {53, 2, 75, 60, &kkbtc_logo_image}, + {54, 2, 75, 60, &kkbtc_logo_image}, + {55, 2, 75, 60, &kkbtc_logo_image}, + {56, 2, 75, 60, &kkbtc_logo_image}, + {57, 2, 75, 60, &kkbtc_logo_image}, + {58, 2, 75, 60, &kkbtc_logo_image}, + {59, 2, 75, 60, &kkbtc_logo_image}, + {60, 2, 75, 60, &kkbtc_logo_image}, + {61, 2, 75, 60, &kkbtc_logo_image}, + {62, 2, 75, 60, &kkbtc_logo_image}, + {63, 2, 75, 60, &kkbtc_logo_image}, + {64, 2, 75, 60, &kkbtc_logo_image}, + {65, 2, 75, 60, &kkbtc_logo_image}, + {66, 2, 75, 60, &kkbtc_logo_image}, + {67, 2, 75, 60, &kkbtc_logo_image}, + {68, 2, 75, 60, &kkbtc_logo_image}, + {69, 2, 75, 60, &kkbtc_logo_image}, + {70, 2, 75, 60, &kkbtc_logo_image}, + {71, 2, 75, 60, &kkbtc_logo_image}, + {72, 2, 75, 60, &kkbtc_logo_image}, + {73, 2, 75, 60, &kkbtc_logo_image}, + {74, 2, 75, 60, &kkbtc_logo_image}, + {75, 2, 75, 60, &kkbtc_logo_image}, + {76, 2, 75, 60, &kkbtc_logo_image}, + {77, 2, 75, 60, &kkbtc_logo_image}, + {78, 2, 75, 60, &kkbtc_logo_image}, + {79, 2, 75, 60, &kkbtc_logo_image}, + {80, 2, 75, 60, &kkbtc_logo_image}, + {81, 2, 75, 60, &kkbtc_logo_image}, + {82, 2, 75, 60, &kkbtc_logo_image}, + {83, 2, 75, 60, &kkbtc_logo_image}, + {84, 2, 75, 60, &kkbtc_logo_image}, + {85, 2, 75, 60, &kkbtc_logo_image}, + {86, 2, 75, 60, &kkbtc_logo_image}, + {87, 2, 75, 60, &kkbtc_logo_image}, + {88, 2, 75, 60, &kkbtc_logo_image}, + {89, 2, 75, 60, &kkbtc_logo_image}, + {90, 2, 75, 60, &kkbtc_logo_image}, + {91, 2, 75, 60, &kkbtc_logo_image}, + {92, 2, 75, 60, &kkbtc_logo_image}, + {93, 2, 75, 60, &kkbtc_logo_image}, + {94, 2, 75, 60, &kkbtc_logo_image}, + } +}; + diff --git a/scripts/build/docker/device/btcdebug.sh b/scripts/build/docker/device/btcdebug.sh new file mode 100755 index 000000000..dc28de2e8 --- /dev/null +++ b/scripts/build/docker/device/btcdebug.sh @@ -0,0 +1,25 @@ +#!/bin/bash -e + +KEEPKEY_FIRMWARE="$(dirname "$(dirname "$(dirname "$(dirname "$( cd "$(dirname "$0")" ; pwd -P )")")")")" +cd $KEEPKEY_FIRMWARE + +IMAGETAG=kktech/firmware:v15 + +docker image inspect $IMAGETAG > /dev/null || docker pull $IMAGETAG + +docker run -t \ + -v $(pwd):/root/keepkey-firmware:z \ + $IMAGETAG /bin/sh -c "\ + mkdir /root/build && cd /root/build && \ + cmake -C /root/keepkey-firmware/cmake/caches/device.cmake /root/keepkey-firmware \ + -DCOIN_SUPPORT=BTC \ + -DCMAKE_BUILD_TYPE=Debug \ + -DKK_DEBUG_LINK=ON \ + -DVARIANTS=NoObsoleteVariants \ + -DCMAKE_COLOR_MAKEFILE=ON &&\ + make && \ + mkdir -p /root/keepkey-firmware/bin && \ + cp -r /root/build /root/keepkey-firmware/bin/ && \ + cp bin/*.bin /root/keepkey-firmware/bin/ && \ + cp bin/*.elf /root/keepkey-firmware/bin/ && \ + chown -R \`stat -c \"%u:%g\" /root/keepkey-firmware\` /root/keepkey-firmware/bin" diff --git a/scripts/build/docker/device/btcrelease.sh b/scripts/build/docker/device/btcrelease.sh new file mode 100755 index 000000000..70869f8ca --- /dev/null +++ b/scripts/build/docker/device/btcrelease.sh @@ -0,0 +1,24 @@ +#!/bin/bash -e + +KEEPKEY_FIRMWARE="$(dirname "$(dirname "$(dirname "$(dirname "$( cd "$(dirname "$0")" ; pwd -P )")")")")" +cd $KEEPKEY_FIRMWARE + +IMAGETAG=kktech/firmware:v15 + +docker image inspect $IMAGETAG > /dev/null || docker pull $IMAGETAG + +docker run -t \ + -v $(pwd):/root/keepkey-firmware:z \ + $IMAGETAG /bin/sh -c "\ + mkdir /root/build && cd /root/build && \ + cmake -C /root/keepkey-firmware/cmake/caches/device.cmake /root/keepkey-firmware \ + -DCOIN_SUPPORT=BTC \ + -DVARIANTS=NoObsoleteVariants \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ + -DCMAKE_COLOR_MAKEFILE=ON &&\ + make && \ + mkdir -p /root/keepkey-firmware/bin && \ + cp -r /root/build /root/keepkey-firmware/bin/ && \ + cp bin/*.bin /root/keepkey-firmware/bin/ && \ + cp bin/*.elf /root/keepkey-firmware/bin/ && \ + chown -R \`stat -c \"%u:%g\" /root/keepkey-firmware\` /root/keepkey-firmware/bin" diff --git a/scripts/build/docker/device/debug.sh b/scripts/build/docker/device/debug.sh index 0150e9138..d0ed9f7d2 100755 --- a/scripts/build/docker/device/debug.sh +++ b/scripts/build/docker/device/debug.sh @@ -14,6 +14,7 @@ docker run -t \ cmake -C /root/keepkey-firmware/cmake/caches/device.cmake /root/keepkey-firmware \ -DCMAKE_BUILD_TYPE=Debug \ -DKK_DEBUG_LINK=ON \ + -DVARIANTS=NoObsoleteVariants \ -DCMAKE_COLOR_MAKEFILE=ON &&\ make && \ mkdir -p /root/keepkey-firmware/bin && \ diff --git a/scripts/build/docker/device/release.sh b/scripts/build/docker/device/release.sh index 18cfe53dc..d29180608 100755 --- a/scripts/build/docker/device/release.sh +++ b/scripts/build/docker/device/release.sh @@ -12,6 +12,7 @@ docker run -t \ $IMAGETAG /bin/sh -c "\ mkdir /root/build && cd /root/build && \ cmake -C /root/keepkey-firmware/cmake/caches/device.cmake /root/keepkey-firmware \ + -DVARIANTS=NoObsoleteVariants \ -DCMAKE_BUILD_TYPE=MinSizeRel \ -DCMAKE_COLOR_MAKEFILE=ON &&\ make && \ diff --git a/scripts/build/docker/emulator/btcdebug.sh b/scripts/build/docker/emulator/btcdebug.sh new file mode 100755 index 000000000..eea64b010 --- /dev/null +++ b/scripts/build/docker/emulator/btcdebug.sh @@ -0,0 +1,24 @@ +#!/bin/bash -e + +KEEPKEY_FIRMWARE="$(dirname "$(dirname "$(dirname "$(dirname "$( cd "$(dirname "$0")" ; pwd -P )")")")")" +cd $KEEPKEY_FIRMWARE + +IMAGETAG=kktech/firmware:v15 + +docker pull $IMAGETAG + +docker run -t \ + -v $(pwd):/root/keepkey-firmware:z \ + $IMAGETAG /bin/sh -c "\ + rm -rf /root/keepkey-firmware/build && \ + mkdir /root/build && cd /root/build && \ + cmake -C /root/keepkey-firmware/cmake/caches/emulator.cmake /root/keepkey-firmware \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DCOIN_SUPPORT=BTC \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_COLOR_MAKEFILE=ON &&\ + make all && \ + (make xunit || true) && \ + cp -r /root/build /root/keepkey-firmware/build && \ + chown -R \`stat -c \"%u:%g\" /root/keepkey-firmware\` /root/keepkey-firmware/build" diff --git a/scripts/emulator/Dockerfile b/scripts/emulator/Dockerfile index e0b2c6d3f..53c6bdd99 100644 --- a/scripts/emulator/Dockerfile +++ b/scripts/emulator/Dockerfile @@ -3,11 +3,13 @@ FROM kktech/firmware:v15 WORKDIR /kkemu COPY ./ /kkemu +ARG coinsupport="" RUN cmake -C ./cmake/caches/emulator.cmake . \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_C_COMPILER=clang \ -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_BUILD_TYPE=Debug \ + ${coinsupport} \ -DCMAKE_COLOR_MAKEFILE=ON RUN make -j diff --git a/scripts/emulator/btcDockerStart.sh b/scripts/emulator/btcDockerStart.sh new file mode 100755 index 000000000..85d2b8a9b --- /dev/null +++ b/scripts/emulator/btcDockerStart.sh @@ -0,0 +1,2 @@ +docker-compose -f docker-compose-btc.yml up --build python-keepkey +docker kill emulator_kkemu_1 \ No newline at end of file diff --git a/scripts/emulator/docker-compose-btc.yml b/scripts/emulator/docker-compose-btc.yml new file mode 100644 index 000000000..77bb3fca3 --- /dev/null +++ b/scripts/emulator/docker-compose-btc.yml @@ -0,0 +1,44 @@ +version: '3' +services: + kkemu: + image: kktech/kkemu:latest + build: + context: '../../' + args: + coinsupport: "-DCOIN_SUPPORT=BTC" + dockerfile: 'scripts/emulator/Dockerfile' + networks: + - local-net + ports: + - "127.0.0.1:11044:11044/udp" + - "127.0.0.1:11045:11045/udp" + - "127.0.0.1:5000:5000" + python-keepkey: + build: + context: '../../' + dockerfile: 'scripts/emulator/python-keepkey.Dockerfile' + volumes: + - test-reports:/kkemu/test-reports:rw + networks: + - local-net + depends_on: + - kkemu + firmware-unit: + build: + context: '../../' + args: + coinsupport: "-DCOIN_SUPPORT=BTC" + dockerfile: 'scripts/emulator/Dockerfile' + volumes: + - test-reports:/kkemu/test-reports:rw + entrypoint: ['scripts/emulator/firmware-unit.sh'] + networks: + - local-net + depends_on: + - kkemu +networks: + local-net: + external: false +volumes: + test-reports: + external: false diff --git a/scripts/emulator/dockerStart.sh b/scripts/emulator/dockerStart.sh new file mode 100755 index 000000000..d431bb0b1 --- /dev/null +++ b/scripts/emulator/dockerStart.sh @@ -0,0 +1,2 @@ +docker-compose up --build python-keepkey +docker kill emulator_kkemu_1 \ No newline at end of file diff --git a/tools/display_test/CMakeLists.txt b/tools/display_test/CMakeLists.txt index 0d280ab80..549f9cac0 100644 --- a/tools/display_test/CMakeLists.txt +++ b/tools/display_test/CMakeLists.txt @@ -1,3 +1,7 @@ +if("${VARIANTS}" STREQUAL "NoObsoleteVariants") + return() +endif() + if(NOT ${KK_EMULATOR}) set(sources main.c diff --git a/tools/firmware/CMakeLists.txt b/tools/firmware/CMakeLists.txt index 18c50e411..e2f499b86 100644 --- a/tools/firmware/CMakeLists.txt +++ b/tools/firmware/CMakeLists.txt @@ -1,4 +1,12 @@ if(NOT ${KK_EMULATOR}) + + set(TARGESTR "firmware.keepkey.elf") + set(TARGBSTR "firmware.keepkey.bin") + if("${COIN_SUPPORT}" STREQUAL "BTC") + set(TARGESTR "firmware.keepkeybtc.elf") + set(TARGBSTR "firmware.keepkeybtc.bin") + endif() + set(sources keepkey_main.c startup.s @@ -25,26 +33,37 @@ if(NOT ${KK_EMULATOR}) -lc -lm) - add_executable(firmware.keepkey.elf ${sources}) - target_link_libraries(firmware.keepkey.elf - kkfirmware - kkfirmware.keepkey - kkboard - kkboard.keepkey - kkvariant.keepkey - kkvariant.salt - kktransport - trezorcrypto - qrcodegenerator - SecAESSTM32 - kkrand + add_executable(${TARGESTR} ${sources}) + + set(libraries + kkfirmware + kkfirmware.keepkey + kkboard + kkboard.keepkey + kkvariant.keepkey + kktransport + trezorcrypto + qrcodegenerator + SecAESSTM32 + kkrand) + +if("${COIN_SUPPORT}" STREQUAL "BTC") +else() + list(APPEND libraries + kkvariant.salt + ) +endif() + + target_link_libraries(${TARGESTR} + ${libraries} -lopencm3_stm32f2 -lc -lm) - add_custom_command(TARGET firmware.keepkey.elf - POST_BUILD - COMMAND ${CMAKE_OBJCOPY} ARGS -O binary - ${CMAKE_BINARY_DIR}/bin/firmware.keepkey.elf - ${CMAKE_BINARY_DIR}/bin/firmware.keepkey.bin) + + add_custom_command(TARGET ${TARGESTR} + POST_BUILD + COMMAND ${CMAKE_OBJCOPY} ARGS -O binary + ${CMAKE_BINARY_DIR}/bin/${TARGESTR} + ${CMAKE_BINARY_DIR}/bin/${TARGBSTR}) endif() diff --git a/tools/variant/CMakeLists.txt b/tools/variant/CMakeLists.txt index 0a250e92e..dae9b45a3 100644 --- a/tools/variant/CMakeLists.txt +++ b/tools/variant/CMakeLists.txt @@ -1,3 +1,11 @@ +if("${COIN_SUPPORT}" STREQUAL "BTC") + return() +endif() + +if("${VARIANTS}" STREQUAL "NoObsoleteVariants") + return() +endif() + if(NOT ${KK_EMULATOR}) include_directories( ${CMAKE_SOURCE_DIR}/include diff --git a/unittests/crypto/CMakeLists.txt b/unittests/crypto/CMakeLists.txt index 782549f28..384f224a6 100644 --- a/unittests/crypto/CMakeLists.txt +++ b/unittests/crypto/CMakeLists.txt @@ -8,17 +8,28 @@ include_directories( ${CMAKE_SOURCE_DIR}/deps/crypto/trezor-crypto) add_executable(crypto-unit ${sources}) -target_link_libraries(crypto-unit - gtest_main - kkfirmware - kkfirmware.keepkey - kkboard - kkboard.keepkey - kkvariant.keepkey + +set(libraries + gtest_main + kkfirmware + kkfirmware.keepkey + kkboard + kkboard.keepkey + kkvariant.keepkey + kkboard + kkemulator + qrcodegenerator + kkrand + trezorcrypto + kktransport) + +if("${COIN_SUPPORT}" STREQUAL "BTC") +else() + list(APPEND libraries kkvariant.salt - kkboard - kkemulator - qrcodegenerator - kkrand - trezorcrypto - kktransport) + ) +endif() + +target_link_libraries(crypto-unit + ${libraries} + ) diff --git a/unittests/firmware/CMakeLists.txt b/unittests/firmware/CMakeLists.txt index 647d72571..738d354ea 100644 --- a/unittests/firmware/CMakeLists.txt +++ b/unittests/firmware/CMakeLists.txt @@ -1,15 +1,20 @@ set(sources coins.cpp - cosmos.cpp - eos.cpp - ethereum.cpp - nano.cpp recovery.cpp - ripple.cpp storage.cpp usb_rx.cpp u2f.cpp) +if("${COIN_SUPPORT}" STREQUAL "BTC") +else() + list(APPEND sources + cosmos.cpp + eos.cpp + ethereum.cpp + nano.cpp + ripple.cpp) +endif() + include_directories( ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/lib/firmware @@ -17,14 +22,14 @@ include_directories( ${CMAKE_SOURCE_DIR}/deps/crypto/trezor-crypto) add_executable(firmware-unit ${sources}) -target_link_libraries(firmware-unit + +set(libraries gmock_main kkfirmware kkfirmware.keepkey kkboard kkboard.keepkey kkvariant.keepkey - kkvariant.salt kkboard kkemulator trezorcrypto @@ -32,3 +37,10 @@ target_link_libraries(firmware-unit SecAESSTM32 kkrand kktransport) + +if("${COIN_SUPPORT}" STREQUAL "BTC") +else() + list(APPEND libraries kkvariant.salt) +endif() + +target_link_libraries(firmware-unit ${libraries}) diff --git a/unittests/firmware/coins.cpp b/unittests/firmware/coins.cpp index c11a59bd6..0be0a6f77 100644 --- a/unittests/firmware/coins.cpp +++ b/unittests/firmware/coins.cpp @@ -1,6 +1,8 @@ extern "C" { #include "keepkey/firmware/coins.h" +#ifndef BITCOIN_ONLY #include "keepkey/firmware/ethereum_tokens.h" +#endif // BITCOIN_ONLY } #include "gtest/gtest.h" @@ -74,7 +76,7 @@ TEST(Coins, TableSanity) { const auto &coin = coins[i]; if (!coin.has_contract_address) continue; - +#ifndef BITCOIN_ONLY const TokenType *token; if (!tokenByTicker(1, coin.coin_shortcut, &token)) { EXPECT_TRUE(false) << "Can't uniquely find " << coin.coin_shortcut; @@ -84,6 +86,7 @@ TEST(Coins, TableSanity) { EXPECT_TRUE(memcmp(coin.contract_address.bytes, token->address, coin.contract_address.size) == 0) << "Contract address mismatch for " << coin.coin_shortcut; +#endif // BITCOIN_ONLY } } @@ -134,6 +137,7 @@ TEST(Coins, BIP32AccountName) { 5, true, "Bitcoin Account #1\nChange Address #1"}, +#ifndef BITCOIN_ONLY {"Ethereum", {0x80000000 | 44, 0x80000000 | 60, 0x80000000 | 1, 0, 0}, 5, @@ -178,7 +182,9 @@ TEST(Coins, BIP32AccountName) { {0x80000000 | 44, 0x80000000 | 931, 0x80000000 | 69, 0, 0}, 5, true, - "MAYAChain Account #69"}}; + "MAYAChain Account #69"} +#endif // BITCOIN_ONLY + }; for (const auto &vec : vector) { char node_str[NODE_STRING_LENGTH]; @@ -200,6 +206,7 @@ TEST(Coins, BIP32AccountName) { } } +#ifndef BITCOIN_ONLY TEST(Coins, CoinByNameOrTicker) { const CoinType *ticker = coinByNameOrTicker("ZRX"); const CoinType *name = coinByNameOrTicker("0x"); @@ -221,3 +228,4 @@ TEST(Coins, TokenByChainAddress) { ASSERT_NE(zrx, nullptr); EXPECT_EQ(zrx->ticker, std::string(" ZRX")); } +#endif // BITCOIN_ONLY \ No newline at end of file