diff --git a/core/src/storage/cache.py b/core/src/storage/cache.py index fd9f134c51..91a93e1d04 100644 --- a/core/src/storage/cache.py +++ b/core/src/storage/cache.py @@ -22,10 +22,11 @@ _SESSION_ID_LENGTH = 32 APP_COMMON_SEED = 0 APP_COMMON_AUTHORIZATION_TYPE = 1 APP_COMMON_AUTHORIZATION_DATA = 2 -APP_COMMON_DERIVE_CARDANO = 3 -APP_CARDANO_ICARUS_SECRET = 4 -APP_CARDANO_ICARUS_TREZOR_SECRET = 5 -APP_MONERO_LIVE_REFRESH = 6 +if not utils.BITCOIN_ONLY: + APP_COMMON_DERIVE_CARDANO = 3 + APP_CARDANO_ICARUS_SECRET = 4 + APP_CARDANO_ICARUS_TREZOR_SECRET = 5 + APP_MONERO_LIVE_REFRESH = 6 # Keys that are valid across sessions APP_COMMON_SEED_WITHOUT_PASSPHRASE = 0 | _SESSIONLESS_FLAG @@ -91,15 +92,22 @@ class DataCache: class SessionCache(DataCache): def __init__(self) -> None: self.session_id = bytearray(_SESSION_ID_LENGTH) - self.fields = ( - 64, # APP_COMMON_SEED - 2, # APP_COMMON_AUTHORIZATION_TYPE - 128, # APP_COMMON_AUTHORIZATION_DATA - 1, # APP_COMMON_DERIVE_CARDANO - 96, # APP_CARDANO_ICARUS_SECRET - 96, # APP_CARDANO_ICARUS_TREZOR_SECRET - 1, # APP_MONERO_LIVE_REFRESH - ) + if utils.BITCOIN_ONLY: + self.fields = ( + 64, # APP_COMMON_SEED + 2, # APP_COMMON_AUTHORIZATION_TYPE + 128, # APP_COMMON_AUTHORIZATION_DATA + ) + else: + self.fields = ( + 64, # APP_COMMON_SEED + 2, # APP_COMMON_AUTHORIZATION_TYPE + 128, # APP_COMMON_AUTHORIZATION_DATA + 1, # APP_COMMON_DERIVE_CARDANO + 96, # APP_CARDANO_ICARUS_SECRET + 96, # APP_CARDANO_ICARUS_TREZOR_SECRET + 1, # APP_MONERO_LIVE_REFRESH + ) self.last_usage = 0 super().__init__() diff --git a/core/src/trezor/crypto/__init__.py b/core/src/trezor/crypto/__init__.py index 9637922fc0..ad1d409c7b 100644 --- a/core/src/trezor/crypto/__init__.py +++ b/core/src/trezor/crypto/__init__.py @@ -2,7 +2,6 @@ from trezorcrypto import ( # noqa: F401 aes, bip32, bip39, - cardano, chacha20poly1305, crc, hmac, @@ -13,4 +12,4 @@ from trezorcrypto import ( # noqa: F401 from trezor import utils if not utils.BITCOIN_ONLY: - from trezorcrypto import monero, nem # noqa: F401 + from trezorcrypto import cardano, monero, nem # noqa: F401 diff --git a/tools/check-bitcoin-only b/tools/check-bitcoin-only index 0430d3cdee..f0900382c8 100755 --- a/tools/check-bitcoin-only +++ b/tools/check-bitcoin-only @@ -1,7 +1,7 @@ #!/bin/sh RETURN=0 -EXCEPTIONS="decred|omni|ripple|dash|TEXT_MARGIN_LEFT|APP_CARDANO_PASSPHRASE|APP_MONERO_LIVE_REFRESH|ed25519 cardano|dash_width|dashlane|flo|mnemonic|meter|refuse|fused|enemy|cinema|syntaxerror|mix|palm|UdesRsK|kcc" +EXCEPTIONS="decred|omni|ripple|dash|TEXT_MARGIN_LEFT|dash_width|dashlane|flo|mnemonic|meter|refuse|fused|enemy|cinema|syntaxerror|mix|palm|UdesRsK|kcc|derive_cardano" # dump all coins except the first 3 (Bitcoin, Testnet, Regtest) ALTCOINS=$(./common/tools/cointool.py dump -l -p -t | grep '"name"' | cut -d '"' -f 4 | tail -n +4)