mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-14 17:31:04 +00:00
core: remove remaning utility code for Bitcoin only firmware
This commit is contained in:
parent
c815bc410c
commit
908bbfffef
@ -117,9 +117,9 @@ STATIC mp_obj_t mod_trezorcrypto_secp256k1_sign(size_t n_args,
|
||||
mp_get_buffer_raise(args[0], &sk, MP_BUFFER_READ);
|
||||
mp_get_buffer_raise(args[1], &dig, MP_BUFFER_READ);
|
||||
bool compressed = (n_args < 3) || (args[2] == mp_const_true);
|
||||
int (*is_canonical)(uint8_t by, uint8_t sig[64]) = NULL;
|
||||
#if !BITCOIN_ONLY
|
||||
mp_int_t canonical = (n_args > 3) ? mp_obj_get_int(args[3]) : 0;
|
||||
int (*is_canonical)(uint8_t by, uint8_t sig[64]) = NULL;
|
||||
switch (canonical) {
|
||||
case CANONICAL_SIG_ETHEREUM:
|
||||
is_canonical = ethereum_is_canonical;
|
||||
|
@ -1,16 +1,20 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
from trezor import utils
|
||||
|
||||
Bitcoin = 1
|
||||
Bitcoin_like = 2
|
||||
Binance = 3
|
||||
Cardano = 4
|
||||
if not utils.BITCOIN_ONLY:
|
||||
Bitcoin_like = 2
|
||||
Binance = 3
|
||||
Cardano = 4
|
||||
Crypto = 5
|
||||
EOS = 6
|
||||
Ethereum = 7
|
||||
Lisk = 8
|
||||
Monero = 9
|
||||
NEM = 10
|
||||
Ripple = 11
|
||||
Stellar = 12
|
||||
Tezos = 13
|
||||
U2F = 14
|
||||
if not utils.BITCOIN_ONLY:
|
||||
EOS = 6
|
||||
Ethereum = 7
|
||||
Lisk = 8
|
||||
Monero = 9
|
||||
NEM = 10
|
||||
Ripple = 11
|
||||
Stellar = 12
|
||||
Tezos = 13
|
||||
U2F = 14
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
from trezor import utils
|
||||
|
||||
Initialize = 0
|
||||
Ping = 1
|
||||
Success = 2
|
||||
@ -64,116 +66,117 @@ DebugLinkMemoryRead = 110
|
||||
DebugLinkMemory = 111
|
||||
DebugLinkMemoryWrite = 112
|
||||
DebugLinkFlashErase = 113
|
||||
EthereumGetPublicKey = 450
|
||||
EthereumPublicKey = 451
|
||||
EthereumGetAddress = 56
|
||||
EthereumAddress = 57
|
||||
EthereumSignTx = 58
|
||||
EthereumTxRequest = 59
|
||||
EthereumTxAck = 60
|
||||
EthereumSignMessage = 64
|
||||
EthereumVerifyMessage = 65
|
||||
EthereumMessageSignature = 66
|
||||
NEMGetAddress = 67
|
||||
NEMAddress = 68
|
||||
NEMSignTx = 69
|
||||
NEMSignedTx = 70
|
||||
NEMDecryptMessage = 75
|
||||
NEMDecryptedMessage = 76
|
||||
LiskGetAddress = 114
|
||||
LiskAddress = 115
|
||||
LiskSignTx = 116
|
||||
LiskSignedTx = 117
|
||||
LiskSignMessage = 118
|
||||
LiskMessageSignature = 119
|
||||
LiskVerifyMessage = 120
|
||||
LiskGetPublicKey = 121
|
||||
LiskPublicKey = 122
|
||||
TezosGetAddress = 150
|
||||
TezosAddress = 151
|
||||
TezosSignTx = 152
|
||||
TezosSignedTx = 153
|
||||
TezosGetPublicKey = 154
|
||||
TezosPublicKey = 155
|
||||
StellarSignTx = 202
|
||||
StellarTxOpRequest = 203
|
||||
StellarGetAddress = 207
|
||||
StellarAddress = 208
|
||||
StellarCreateAccountOp = 210
|
||||
StellarPaymentOp = 211
|
||||
StellarPathPaymentOp = 212
|
||||
StellarManageOfferOp = 213
|
||||
StellarCreatePassiveOfferOp = 214
|
||||
StellarSetOptionsOp = 215
|
||||
StellarChangeTrustOp = 216
|
||||
StellarAllowTrustOp = 217
|
||||
StellarAccountMergeOp = 218
|
||||
StellarManageDataOp = 220
|
||||
StellarBumpSequenceOp = 221
|
||||
StellarSignedTx = 230
|
||||
CardanoSignTx = 303
|
||||
CardanoTxRequest = 304
|
||||
CardanoGetPublicKey = 305
|
||||
CardanoPublicKey = 306
|
||||
CardanoGetAddress = 307
|
||||
CardanoAddress = 308
|
||||
CardanoTxAck = 309
|
||||
CardanoSignedTx = 310
|
||||
RippleGetAddress = 400
|
||||
RippleAddress = 401
|
||||
RippleSignTx = 402
|
||||
RippleSignedTx = 403
|
||||
MoneroTransactionInitRequest = 501
|
||||
MoneroTransactionInitAck = 502
|
||||
MoneroTransactionSetInputRequest = 503
|
||||
MoneroTransactionSetInputAck = 504
|
||||
MoneroTransactionInputsPermutationRequest = 505
|
||||
MoneroTransactionInputsPermutationAck = 506
|
||||
MoneroTransactionInputViniRequest = 507
|
||||
MoneroTransactionInputViniAck = 508
|
||||
MoneroTransactionAllInputsSetRequest = 509
|
||||
MoneroTransactionAllInputsSetAck = 510
|
||||
MoneroTransactionSetOutputRequest = 511
|
||||
MoneroTransactionSetOutputAck = 512
|
||||
MoneroTransactionAllOutSetRequest = 513
|
||||
MoneroTransactionAllOutSetAck = 514
|
||||
MoneroTransactionSignInputRequest = 515
|
||||
MoneroTransactionSignInputAck = 516
|
||||
MoneroTransactionFinalRequest = 517
|
||||
MoneroTransactionFinalAck = 518
|
||||
MoneroKeyImageExportInitRequest = 530
|
||||
MoneroKeyImageExportInitAck = 531
|
||||
MoneroKeyImageSyncStepRequest = 532
|
||||
MoneroKeyImageSyncStepAck = 533
|
||||
MoneroKeyImageSyncFinalRequest = 534
|
||||
MoneroKeyImageSyncFinalAck = 535
|
||||
MoneroGetAddress = 540
|
||||
MoneroAddress = 541
|
||||
MoneroGetWatchKey = 542
|
||||
MoneroWatchKey = 543
|
||||
DebugMoneroDiagRequest = 546
|
||||
DebugMoneroDiagAck = 547
|
||||
MoneroGetTxKeyRequest = 550
|
||||
MoneroGetTxKeyAck = 551
|
||||
MoneroLiveRefreshStartRequest = 552
|
||||
MoneroLiveRefreshStartAck = 553
|
||||
MoneroLiveRefreshStepRequest = 554
|
||||
MoneroLiveRefreshStepAck = 555
|
||||
MoneroLiveRefreshFinalRequest = 556
|
||||
MoneroLiveRefreshFinalAck = 557
|
||||
EosGetPublicKey = 600
|
||||
EosPublicKey = 601
|
||||
EosSignTx = 602
|
||||
EosTxActionRequest = 603
|
||||
EosTxActionAck = 604
|
||||
EosSignedTx = 605
|
||||
BinanceGetAddress = 700
|
||||
BinanceAddress = 701
|
||||
BinanceGetPublicKey = 702
|
||||
BinancePublicKey = 703
|
||||
BinanceSignTx = 704
|
||||
BinanceTxRequest = 705
|
||||
BinanceTransferMsg = 706
|
||||
BinanceOrderMsg = 707
|
||||
BinanceCancelMsg = 708
|
||||
BinanceSignedTx = 709
|
||||
if not utils.BITCOIN_ONLY:
|
||||
EthereumGetPublicKey = 450
|
||||
EthereumPublicKey = 451
|
||||
EthereumGetAddress = 56
|
||||
EthereumAddress = 57
|
||||
EthereumSignTx = 58
|
||||
EthereumTxRequest = 59
|
||||
EthereumTxAck = 60
|
||||
EthereumSignMessage = 64
|
||||
EthereumVerifyMessage = 65
|
||||
EthereumMessageSignature = 66
|
||||
NEMGetAddress = 67
|
||||
NEMAddress = 68
|
||||
NEMSignTx = 69
|
||||
NEMSignedTx = 70
|
||||
NEMDecryptMessage = 75
|
||||
NEMDecryptedMessage = 76
|
||||
LiskGetAddress = 114
|
||||
LiskAddress = 115
|
||||
LiskSignTx = 116
|
||||
LiskSignedTx = 117
|
||||
LiskSignMessage = 118
|
||||
LiskMessageSignature = 119
|
||||
LiskVerifyMessage = 120
|
||||
LiskGetPublicKey = 121
|
||||
LiskPublicKey = 122
|
||||
TezosGetAddress = 150
|
||||
TezosAddress = 151
|
||||
TezosSignTx = 152
|
||||
TezosSignedTx = 153
|
||||
TezosGetPublicKey = 154
|
||||
TezosPublicKey = 155
|
||||
StellarSignTx = 202
|
||||
StellarTxOpRequest = 203
|
||||
StellarGetAddress = 207
|
||||
StellarAddress = 208
|
||||
StellarCreateAccountOp = 210
|
||||
StellarPaymentOp = 211
|
||||
StellarPathPaymentOp = 212
|
||||
StellarManageOfferOp = 213
|
||||
StellarCreatePassiveOfferOp = 214
|
||||
StellarSetOptionsOp = 215
|
||||
StellarChangeTrustOp = 216
|
||||
StellarAllowTrustOp = 217
|
||||
StellarAccountMergeOp = 218
|
||||
StellarManageDataOp = 220
|
||||
StellarBumpSequenceOp = 221
|
||||
StellarSignedTx = 230
|
||||
CardanoSignTx = 303
|
||||
CardanoTxRequest = 304
|
||||
CardanoGetPublicKey = 305
|
||||
CardanoPublicKey = 306
|
||||
CardanoGetAddress = 307
|
||||
CardanoAddress = 308
|
||||
CardanoTxAck = 309
|
||||
CardanoSignedTx = 310
|
||||
RippleGetAddress = 400
|
||||
RippleAddress = 401
|
||||
RippleSignTx = 402
|
||||
RippleSignedTx = 403
|
||||
MoneroTransactionInitRequest = 501
|
||||
MoneroTransactionInitAck = 502
|
||||
MoneroTransactionSetInputRequest = 503
|
||||
MoneroTransactionSetInputAck = 504
|
||||
MoneroTransactionInputsPermutationRequest = 505
|
||||
MoneroTransactionInputsPermutationAck = 506
|
||||
MoneroTransactionInputViniRequest = 507
|
||||
MoneroTransactionInputViniAck = 508
|
||||
MoneroTransactionAllInputsSetRequest = 509
|
||||
MoneroTransactionAllInputsSetAck = 510
|
||||
MoneroTransactionSetOutputRequest = 511
|
||||
MoneroTransactionSetOutputAck = 512
|
||||
MoneroTransactionAllOutSetRequest = 513
|
||||
MoneroTransactionAllOutSetAck = 514
|
||||
MoneroTransactionSignInputRequest = 515
|
||||
MoneroTransactionSignInputAck = 516
|
||||
MoneroTransactionFinalRequest = 517
|
||||
MoneroTransactionFinalAck = 518
|
||||
MoneroKeyImageExportInitRequest = 530
|
||||
MoneroKeyImageExportInitAck = 531
|
||||
MoneroKeyImageSyncStepRequest = 532
|
||||
MoneroKeyImageSyncStepAck = 533
|
||||
MoneroKeyImageSyncFinalRequest = 534
|
||||
MoneroKeyImageSyncFinalAck = 535
|
||||
MoneroGetAddress = 540
|
||||
MoneroAddress = 541
|
||||
MoneroGetWatchKey = 542
|
||||
MoneroWatchKey = 543
|
||||
DebugMoneroDiagRequest = 546
|
||||
DebugMoneroDiagAck = 547
|
||||
MoneroGetTxKeyRequest = 550
|
||||
MoneroGetTxKeyAck = 551
|
||||
MoneroLiveRefreshStartRequest = 552
|
||||
MoneroLiveRefreshStartAck = 553
|
||||
MoneroLiveRefreshStepRequest = 554
|
||||
MoneroLiveRefreshStepAck = 555
|
||||
MoneroLiveRefreshFinalRequest = 556
|
||||
MoneroLiveRefreshFinalAck = 557
|
||||
EosGetPublicKey = 600
|
||||
EosPublicKey = 601
|
||||
EosSignTx = 602
|
||||
EosTxActionRequest = 603
|
||||
EosTxActionAck = 604
|
||||
EosSignedTx = 605
|
||||
BinanceGetAddress = 700
|
||||
BinanceAddress = 701
|
||||
BinanceGetPublicKey = 702
|
||||
BinancePublicKey = 703
|
||||
BinanceSignTx = 704
|
||||
BinanceTxRequest = 705
|
||||
BinanceTransferMsg = 706
|
||||
BinanceOrderMsg = 707
|
||||
BinanceCancelMsg = 708
|
||||
BinanceSignedTx = 709
|
||||
|
@ -41,4 +41,6 @@ for msg_name in dir(MessageType):
|
||||
# No Message begins with underscore so it's safe to skip those.
|
||||
if msg_name[0] == "_":
|
||||
continue
|
||||
if msg_name == "utils": # skip imported trezor.utils
|
||||
continue
|
||||
type_to_name[getattr(MessageType, msg_name)] = msg_name
|
||||
|
@ -57,6 +57,8 @@ do_rebuild() {
|
||||
shift
|
||||
local IGNORE="$1"
|
||||
shift
|
||||
local APPLY_BITCOIN_ONLY="$1"
|
||||
shift
|
||||
|
||||
mkdir -p "$DESTDIR"
|
||||
rm -f "$DESTDIR"/[A-Z]*.py
|
||||
@ -64,6 +66,24 @@ do_rebuild() {
|
||||
# note $SOURCES is unquoted - we want wildcard expansion and multiple args
|
||||
$PROTOB/pb2py "$@" -o "$DESTDIR" $SOURCES
|
||||
|
||||
# TODO: make this less hackish
|
||||
# maybe introduce attribute "altcoin" in protobuf?
|
||||
if [ "$APPLY_BITCOIN_ONLY" == "TRUE" ]; then
|
||||
sed -i "3ifrom trezor import utils\n" "$DESTDIR"/Feature.py
|
||||
sed -i "3ifrom trezor import utils\n" "$DESTDIR"/MessageType.py
|
||||
sed -i "/^EthereumGetPublicKey/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/MessageType.py
|
||||
for altcoin in Ethereum NEM Lisk Tezos Stellar Cardano Ripple Monero DebugMonero Eos Binance; do
|
||||
sed -i "s:^$altcoin: $altcoin:" "$DESTDIR"/Feature.py
|
||||
sed -i "s:^$altcoin: $altcoin:" "$DESTDIR"/MessageType.py
|
||||
done
|
||||
sed -i "/^Bitcoin_like/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/Feature.py
|
||||
sed -i "/^EOS/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/Feature.py
|
||||
for feature in Bitcoin_like EOS U2F; do
|
||||
sed -i "s:^$feature: $feature:" "$DESTDIR"/Feature.py
|
||||
done
|
||||
fi
|
||||
# ENDTODO
|
||||
|
||||
# delete unused messages
|
||||
for F in $IGNORE; do
|
||||
rm -f "$DESTDIR"/"$F".py
|
||||
@ -92,7 +112,7 @@ else
|
||||
func=do_rebuild
|
||||
fi
|
||||
|
||||
$func core/src/trezor/messages "$CORE_PROTOBUF_SOURCES" "$CORE_MESSAGES_IGNORE" --no-init-py
|
||||
$func python/src/trezorlib/messages "$PYTHON_PROTOBUF_SOURCES" "$PYTHON_MESSAGES_IGNORE" -P ..protobuf
|
||||
$func core/src/trezor/messages "$CORE_PROTOBUF_SOURCES" "$CORE_MESSAGES_IGNORE" TRUE --no-init-py
|
||||
$func python/src/trezorlib/messages "$PYTHON_PROTOBUF_SOURCES" "$PYTHON_MESSAGES_IGNORE" FALSE -P ..protobuf
|
||||
|
||||
exit $RETURN
|
||||
|
Loading…
Reference in New Issue
Block a user