diff --git a/legacy/firmware/Makefile b/legacy/firmware/Makefile index f85ba1ab76..8210c5bf69 100644 --- a/legacy/firmware/Makefile +++ b/legacy/firmware/Makefile @@ -144,7 +144,7 @@ OBJS += protob/messages-management.pb.o ifneq ($(BITCOIN_ONLY),1) OBJS += ../vendor/trezor-crypto/cash_addr.o OBJS += protob/messages-ethereum.pb.o -OBJS += protob/messages-ethereum-definitions.pb.o +OBJS += protob/messages-definitions.pb.o OBJS += protob/messages-nem.pb.o OBJS += protob/messages-stellar.pb.o endif diff --git a/legacy/firmware/ethereum_definitions.c b/legacy/firmware/ethereum_definitions.c index 8d0abc72a0..6abd51bcf6 100644 --- a/legacy/firmware/ethereum_definitions.c +++ b/legacy/firmware/ethereum_definitions.c @@ -126,7 +126,7 @@ static bool parse_encoded_definition(struct EncodedDefinition *const result, } static bool decode_definition(const pb_size_t size, const pb_byte_t *bytes, - const EthereumDefinitionType expected_type, + const DefinitionType expected_type, void *definition) { // parse received definition static struct EncodedDefinition parsed_def; @@ -201,7 +201,7 @@ static bool decode_definition(const pb_size_t size, const pb_byte_t *bytes, } // decode message - const pb_msgdesc_t *fields = (expected_type == EthereumDefinitionType_NETWORK + const pb_msgdesc_t *fields = (expected_type == DefinitionType_ETHEREUM_NETWORK ? EthereumNetworkInfo_fields : EthereumTokenInfo_fields); pb_istream_t stream = @@ -244,7 +244,7 @@ static const EthereumNetworkInfo *get_network( // if we still do not have any network definition try to decode received data memzero(&decoded_network, sizeof(decoded_network)); if (!decode_definition(encoded_network->size, encoded_network->bytes, - EthereumDefinitionType_NETWORK, &decoded_network)) { + DefinitionType_ETHEREUM_NETWORK, &decoded_network)) { // error already sent by decode_definition return NULL; } @@ -292,7 +292,7 @@ static const EthereumTokenInfo *get_token(const EncodedToken *encoded_token, // try to decode received definition memzero(&decoded_token, sizeof(decoded_token)); if (!decode_definition(encoded_token->size, encoded_token->bytes, - EthereumDefinitionType_TOKEN, &decoded_token)) { + DefinitionType_ETHEREUM_TOKEN, &decoded_token)) { // error already sent by decode_definition return NULL; } diff --git a/legacy/firmware/ethereum_definitions.h b/legacy/firmware/ethereum_definitions.h index 520e7d640d..7b92964ad6 100644 --- a/legacy/firmware/ethereum_definitions.h +++ b/legacy/firmware/ethereum_definitions.h @@ -20,7 +20,8 @@ #ifndef __ETHEREUM_DEFINITIONS_H__ #define __ETHEREUM_DEFINITIONS_H__ -#include "messages-ethereum-definitions.pb.h" +#include "messages-definitions.pb.h" +#include "messages-ethereum.pb.h" typedef EthereumDefinitions_encoded_network_t EncodedNetwork; typedef EthereumDefinitions_encoded_token_t EncodedToken; diff --git a/legacy/firmware/ethereum_definitions_constants.h.mako b/legacy/firmware/ethereum_definitions_constants.h.mako index ea4dd82518..2fd067036f 100644 --- a/legacy/firmware/ethereum_definitions_constants.h.mako +++ b/legacy/firmware/ethereum_definitions_constants.h.mako @@ -7,10 +7,9 @@ #include #include "crypto.h" -#include "messages-ethereum-definitions.pb.h" #include "pb.h" -#define MIN_DATA_VERSION ${ethereum_defs_timestamp} +#define MIN_DATA_VERSION ${defs_timestamp} #define FORMAT_VERSION_LENGTH 5 #define FORMAT_VERSION (const pb_byte_t *)"trzd1" diff --git a/legacy/firmware/ethereum_networks.h b/legacy/firmware/ethereum_networks.h index c003f1e6f0..0536637832 100644 --- a/legacy/firmware/ethereum_networks.h +++ b/legacy/firmware/ethereum_networks.h @@ -22,7 +22,7 @@ #include #include -#include "messages-ethereum-definitions.pb.h" +#include "messages-definitions.pb.h" extern const EthereumNetworkInfo UNKNOWN_NETWORK; #define SLIP44_UNKNOWN UINT32_MAX diff --git a/legacy/firmware/protob/Makefile b/legacy/firmware/protob/Makefile index f2a0955511..0b9490a3f1 100644 --- a/legacy/firmware/protob/Makefile +++ b/legacy/firmware/protob/Makefile @@ -21,7 +21,7 @@ SKIPPED_MESSAGES += Ethereum NEM Stellar endif PROTO_NAMES = messages messages-bitcoin messages-common messages-crypto messages-debug \ - messages-ethereum messages-ethereum-definitions messages-management messages-nem \ + messages-ethereum messages-definitions messages-management messages-nem \ messages-stellar options PROTO_OPTIONS = $(PROTO_NAMES:=.options) diff --git a/legacy/firmware/protob/messages-ethereum-definitions.options b/legacy/firmware/protob/messages-definitions.options similarity index 62% rename from legacy/firmware/protob/messages-ethereum-definitions.options rename to legacy/firmware/protob/messages-definitions.options index 1dc15cb050..40665dca0a 100644 --- a/legacy/firmware/protob/messages-ethereum-definitions.options +++ b/legacy/firmware/protob/messages-definitions.options @@ -5,5 +5,6 @@ EthereumTokenInfo.name max_size:256 EthereumTokenInfo.address max_size:20 EthereumTokenInfo.symbol max_size:256 -EthereumDefinitions.encoded_network max_size:1024 -EthereumDefinitions.encoded_token max_size:1024 +SolanaTokenInfo.name type:FT_IGNORE +SolanaTokenInfo.mint type:FT_IGNORE +SolanaTokenInfo.symbol type:FT_IGNORE diff --git a/legacy/firmware/protob/messages-definitions.proto b/legacy/firmware/protob/messages-definitions.proto new file mode 120000 index 0000000000..cd780ff780 --- /dev/null +++ b/legacy/firmware/protob/messages-definitions.proto @@ -0,0 +1 @@ +../../vendor/trezor-common/protob/messages-definitions.proto \ No newline at end of file diff --git a/legacy/firmware/protob/messages-ethereum-definitions.proto b/legacy/firmware/protob/messages-ethereum-definitions.proto deleted file mode 120000 index dd7688aaf0..0000000000 --- a/legacy/firmware/protob/messages-ethereum-definitions.proto +++ /dev/null @@ -1 +0,0 @@ -../../vendor/trezor-common/protob/messages-ethereum-definitions.proto \ No newline at end of file diff --git a/legacy/firmware/protob/messages-ethereum.options b/legacy/firmware/protob/messages-ethereum.options index cebf7c1cb5..953093ade1 100644 --- a/legacy/firmware/protob/messages-ethereum.options +++ b/legacy/firmware/protob/messages-ethereum.options @@ -51,3 +51,6 @@ EthereumGetPublicKey.address_n max_count:8 EthereumAddress._old_address max_size:20 EthereumAddress.address max_size:43 EthereumPublicKey.xpub max_size:113 + +EthereumDefinitions.encoded_network max_size:1024 +EthereumDefinitions.encoded_token max_size:1024