diff --git a/firmware/fsm.c b/firmware/fsm.c index 35aa7b30ac..383a2f5128 100644 --- a/firmware/fsm.c +++ b/firmware/fsm.c @@ -273,7 +273,8 @@ void fsm_msgGetPublicKey(GetPublicKey *msg) resp->node.has_public_key = true; resp->node.public_key.size = 33; memcpy(resp->node.public_key.bytes, node->public_key, 33); - + resp->has_xpub = true; + hdnode_serialize_public(node, resp->xpub); msg_write(MessageType_MessageType_PublicKey, resp); layoutHome(); } diff --git a/firmware/protob/messages.options b/firmware/protob/messages.options index 6e2ffaf64c..c0c2c634c4 100644 --- a/firmware/protob/messages.options +++ b/firmware/protob/messages.options @@ -26,6 +26,8 @@ Entropy.entropy max_size:1024 GetPublicKey.address_n max_count:8 +PublicKey.xpub max_size:113 + GetAddress.address_n max_count:8 GetAddress.coin_name max_size:17 diff --git a/firmware/protob/messages.pb.c b/firmware/protob/messages.pb.c index 02f7617ddf..6c0097fd08 100644 --- a/firmware/protob/messages.pb.c +++ b/firmware/protob/messages.pb.c @@ -120,8 +120,9 @@ const pb_field_t GetPublicKey_fields[2] = { PB_LAST_FIELD }; -const pb_field_t PublicKey_fields[2] = { +const pb_field_t PublicKey_fields[3] = { PB_FIELD2( 1, MESSAGE , REQUIRED, STATIC , FIRST, PublicKey, node, node, &HDNodeType_fields), + PB_FIELD2( 2, STRING , OPTIONAL, STATIC , OTHER, PublicKey, xpub, node, 0), PB_LAST_FIELD }; diff --git a/firmware/protob/messages.pb.h b/firmware/protob/messages.pb.h index d296af26c2..234ea073b5 100644 --- a/firmware/protob/messages.pb.h +++ b/firmware/protob/messages.pb.h @@ -364,6 +364,8 @@ typedef struct _Ping { typedef struct _PublicKey { HDNodeType node; + bool has_xpub; + char xpub[113]; } PublicKey; typedef struct _RecoveryDevice { @@ -568,6 +570,7 @@ extern const char SimpleSignTx_coin_name_default[17]; #define Ping_pin_protection_tag 3 #define Ping_passphrase_protection_tag 4 #define PublicKey_node_tag 1 +#define PublicKey_xpub_tag 2 #define RecoveryDevice_word_count_tag 1 #define RecoveryDevice_passphrase_protection_tag 2 #define RecoveryDevice_pin_protection_tag 3 @@ -621,7 +624,7 @@ extern const pb_field_t PassphraseAck_fields[2]; extern const pb_field_t GetEntropy_fields[2]; extern const pb_field_t Entropy_fields[2]; extern const pb_field_t GetPublicKey_fields[2]; -extern const pb_field_t PublicKey_fields[2]; +extern const pb_field_t PublicKey_fields[3]; extern const pb_field_t GetAddress_fields[3]; extern const pb_field_t Address_fields[2]; extern const pb_field_t WipeDevice_fields[1]; @@ -671,7 +674,7 @@ extern const pb_field_t DebugLinkLog_fields[4]; #define GetEntropy_size 6 #define Entropy_size 1027 #define GetPublicKey_size 48 -#define PublicKey_size (6 + HDNodeType_size) +#define PublicKey_size (121 + HDNodeType_size) #define GetAddress_size 67 #define Address_size 37 #define WipeDevice_size 0 diff --git a/trezor-common b/trezor-common index fc98712da5..ce8e99465e 160000 --- a/trezor-common +++ b/trezor-common @@ -1 +1 @@ -Subproject commit fc98712da5c260f3828dab703880eb5e9da00580 +Subproject commit ce8e99465ea1fbcbdc5e7b477cfdab73244a444d