From 771a0c014bd2b777378f559ac40466760ac39bad Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 16 Oct 2016 02:06:49 +0200 Subject: [PATCH] update protobuf --- firmware/protob/messages.pb.c | 7 ++++-- firmware/protob/messages.pb.h | 43 ++++++++++++++++++++--------------- firmware/protob/types.pb.c | 3 ++- firmware/protob/types.pb.h | 26 +++++++++++++-------- vendor/trezor-common | 2 +- 5 files changed, 50 insertions(+), 31 deletions(-) diff --git a/firmware/protob/messages.pb.c b/firmware/protob/messages.pb.c index c16857f90..1d7024fc0 100644 --- a/firmware/protob/messages.pb.c +++ b/firmware/protob/messages.pb.c @@ -4,6 +4,7 @@ #include "messages.pb.h" const char GetAddress_coin_name_default[17] = "Bitcoin"; +const InputScriptType GetAddress_script_type_default = InputScriptType_SPENDADDRESS; const char LoadDevice_language_default[17] = "english"; const uint32_t ResetDevice_strength_default = 256u; const char ResetDevice_language_default[17] = "english"; @@ -28,7 +29,7 @@ const pb_field_t GetFeatures_fields[1] = { PB_LAST_FIELD }; -const pb_field_t Features_fields[18] = { +const pb_field_t Features_fields[19] = { PB_FIELD2( 1, STRING , OPTIONAL, STATIC , FIRST, Features, vendor, vendor, 0), PB_FIELD2( 2, UINT32 , OPTIONAL, STATIC , OTHER, Features, major_version, vendor, 0), PB_FIELD2( 3, UINT32 , OPTIONAL, STATIC , OTHER, Features, minor_version, major_version, 0), @@ -46,6 +47,7 @@ const pb_field_t Features_fields[18] = { PB_FIELD2( 15, BOOL , OPTIONAL, STATIC , OTHER, Features, imported, bootloader_hash, 0), PB_FIELD2( 16, BOOL , OPTIONAL, STATIC , OTHER, Features, pin_cached, imported, 0), PB_FIELD2( 17, BOOL , OPTIONAL, STATIC , OTHER, Features, passphrase_cached, pin_cached, 0), + PB_FIELD2( 18, BOOL , OPTIONAL, STATIC , OTHER, Features, firmware_present, passphrase_cached, 0), PB_LAST_FIELD }; @@ -141,11 +143,12 @@ const pb_field_t PublicKey_fields[3] = { PB_LAST_FIELD }; -const pb_field_t GetAddress_fields[5] = { +const pb_field_t GetAddress_fields[6] = { PB_FIELD2( 1, UINT32 , REPEATED, STATIC , FIRST, GetAddress, address_n, address_n, 0), PB_FIELD2( 2, STRING , OPTIONAL, STATIC , OTHER, GetAddress, coin_name, address_n, &GetAddress_coin_name_default), PB_FIELD2( 3, BOOL , OPTIONAL, STATIC , OTHER, GetAddress, show_display, coin_name, 0), PB_FIELD2( 4, MESSAGE , OPTIONAL, STATIC , OTHER, GetAddress, multisig, show_display, &MultisigRedeemScriptType_fields), + PB_FIELD2( 5, ENUM , OPTIONAL, STATIC , OTHER, GetAddress, script_type, multisig, &GetAddress_script_type_default), PB_LAST_FIELD }; diff --git a/firmware/protob/messages.pb.h b/firmware/protob/messages.pb.h index 36c92b3c8..83173d699 100644 --- a/firmware/protob/messages.pb.h +++ b/firmware/protob/messages.pb.h @@ -130,7 +130,7 @@ typedef struct _WordRequest { } WordRequest; typedef struct _Address { - char address[36]; + char address[41]; } Address; typedef struct { @@ -315,7 +315,7 @@ typedef struct _DecryptedMessage { bool has_message; DecryptedMessage_message_t message; bool has_address; - char address[36]; + char address[41]; } DecryptedMessage; typedef struct { @@ -549,6 +549,8 @@ typedef struct _Features { bool pin_cached; bool has_passphrase_cached; bool passphrase_cached; + bool has_firmware_present; + bool firmware_present; } Features; typedef struct { @@ -569,6 +571,8 @@ typedef struct _GetAddress { bool show_display; bool has_multisig; MultisigRedeemScriptType multisig; + bool has_script_type; + InputScriptType script_type; } GetAddress; typedef struct { @@ -622,7 +626,7 @@ typedef struct { typedef struct _MessageSignature { bool has_address; - char address[36]; + char address[41]; bool has_signature; MessageSignature_signature_t signature; } MessageSignature; @@ -744,7 +748,7 @@ typedef struct { typedef struct _SignedIdentity { bool has_address; - char address[36]; + char address[41]; bool has_public_key; SignedIdentity_public_key_t public_key; bool has_signature; @@ -802,7 +806,7 @@ typedef struct { typedef struct _VerifyMessage { bool has_address; - char address[36]; + char address[41]; bool has_signature; VerifyMessage_signature_t signature; bool has_message; @@ -817,6 +821,7 @@ typedef struct _WordAck { /* Default values for struct fields */ extern const char GetAddress_coin_name_default[17]; +extern const InputScriptType GetAddress_script_type_default; extern const char LoadDevice_language_default[17]; extern const uint32_t ResetDevice_strength_default; extern const char ResetDevice_language_default[17]; @@ -835,7 +840,7 @@ extern const uint32_t SimpleSignTx_lock_time_default; /* Initializer values for message structs */ #define Initialize_init_default {0} #define GetFeatures_init_default {0} -#define Features_init_default {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", 0, {CoinType_init_default, CoinType_init_default, CoinType_init_default, CoinType_init_default, CoinType_init_default, CoinType_init_default, CoinType_init_default, CoinType_init_default}, false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0} +#define Features_init_default {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", 0, {CoinType_init_default, CoinType_init_default, CoinType_init_default, CoinType_init_default, CoinType_init_default, CoinType_init_default, CoinType_init_default, CoinType_init_default}, false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0, false, 0} #define ClearSession_init_default {0} #define ApplySettings_init_default {false, "", false, "", false, 0, false, {0, {0}}} #define ChangePin_init_default {false, 0} @@ -853,7 +858,7 @@ extern const uint32_t SimpleSignTx_lock_time_default; #define Entropy_init_default {{0, {0}}} #define GetPublicKey_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0} #define PublicKey_init_default {HDNodeType_init_default, false, ""} -#define GetAddress_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "Bitcoin", false, 0, false, MultisigRedeemScriptType_init_default} +#define GetAddress_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "Bitcoin", false, 0, false, MultisigRedeemScriptType_init_default, false, InputScriptType_SPENDADDRESS} #define EthereumGetAddress_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, 0} #define Address_init_default {""} #define EthereumAddress_init_default {{0, {0}}} @@ -901,7 +906,7 @@ extern const uint32_t SimpleSignTx_lock_time_default; #define DebugLinkFlashErase_init_default {false, 0} #define Initialize_init_zero {0} #define GetFeatures_init_zero {0} -#define Features_init_zero {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", 0, {CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero}, false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0} +#define Features_init_zero {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", 0, {CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero}, false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0, false, 0} #define ClearSession_init_zero {0} #define ApplySettings_init_zero {false, "", false, "", false, 0, false, {0, {0}}} #define ChangePin_init_zero {false, 0} @@ -919,7 +924,7 @@ extern const uint32_t SimpleSignTx_lock_time_default; #define Entropy_init_zero {{0, {0}}} #define GetPublicKey_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0} #define PublicKey_init_zero {HDNodeType_init_zero, false, ""} -#define GetAddress_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0, false, MultisigRedeemScriptType_init_zero} +#define GetAddress_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0, false, MultisigRedeemScriptType_init_zero, false, (InputScriptType)0} #define EthereumGetAddress_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, 0} #define Address_init_zero {""} #define EthereumAddress_init_zero {{0, {0}}} @@ -1059,11 +1064,13 @@ extern const uint32_t SimpleSignTx_lock_time_default; #define Features_imported_tag 15 #define Features_pin_cached_tag 16 #define Features_passphrase_cached_tag 17 +#define Features_firmware_present_tag 18 #define FirmwareUpload_payload_tag 1 #define GetAddress_address_n_tag 1 #define GetAddress_coin_name_tag 2 #define GetAddress_show_display_tag 3 #define GetAddress_multisig_tag 4 +#define GetAddress_script_type_tag 5 #define GetECDHSessionKey_identity_tag 1 #define GetECDHSessionKey_peer_public_key_tag 2 #define GetECDHSessionKey_ecdsa_curve_name_tag 3 @@ -1138,7 +1145,7 @@ extern const uint32_t SimpleSignTx_lock_time_default; /* Struct field encoding specification for nanopb */ extern const pb_field_t Initialize_fields[1]; extern const pb_field_t GetFeatures_fields[1]; -extern const pb_field_t Features_fields[18]; +extern const pb_field_t Features_fields[19]; extern const pb_field_t ClearSession_fields[1]; extern const pb_field_t ApplySettings_fields[5]; extern const pb_field_t ChangePin_fields[2]; @@ -1156,7 +1163,7 @@ extern const pb_field_t GetEntropy_fields[2]; extern const pb_field_t Entropy_fields[2]; extern const pb_field_t GetPublicKey_fields[4]; extern const pb_field_t PublicKey_fields[3]; -extern const pb_field_t GetAddress_fields[5]; +extern const pb_field_t GetAddress_fields[6]; extern const pb_field_t EthereumGetAddress_fields[3]; extern const pb_field_t Address_fields[2]; extern const pb_field_t EthereumAddress_fields[2]; @@ -1206,7 +1213,7 @@ extern const pb_field_t DebugLinkFlashErase_fields[2]; /* Maximum encoded size of messages (where known) */ #define Initialize_size 0 #define GetFeatures_size 0 -#define Features_size (254 + 8*CoinType_size) +#define Features_size (257 + 8*CoinType_size) #define ClearSession_size 0 #define ApplySettings_size 1083 #define ChangePin_size 2 @@ -1224,9 +1231,9 @@ extern const pb_field_t DebugLinkFlashErase_fields[2]; #define Entropy_size 1027 #define GetPublicKey_size 84 #define PublicKey_size (121 + HDNodeType_size) -#define GetAddress_size (75 + MultisigRedeemScriptType_size) +#define GetAddress_size (81 + MultisigRedeemScriptType_size) #define EthereumGetAddress_size 50 -#define Address_size 38 +#define Address_size 43 #define EthereumAddress_size 22 #define WipeDevice_size 0 #define LoadDevice_size (320 + HDNodeType_size) @@ -1237,12 +1244,12 @@ extern const pb_field_t DebugLinkFlashErase_fields[2]; #define WordRequest_size 0 #define WordAck_size 14 #define SignMessage_size 1094 -#define VerifyMessage_size 1151 -#define MessageSignature_size 105 +#define VerifyMessage_size 1156 +#define MessageSignature_size 110 #define EncryptMessage_size 1131 #define EncryptedMessage_size 1168 #define DecryptMessage_size 1216 -#define DecryptedMessage_size 1065 +#define DecryptedMessage_size 1070 #define CipherKeyValue_size 1358 #define CipheredKeyValue_size 1027 #define EstimateTxSize_size 31 @@ -1255,7 +1262,7 @@ extern const pb_field_t DebugLinkFlashErase_fields[2]; #define EthereumTxRequest_size 80 #define EthereumTxAck_size 1027 #define SignIdentity_size (558 + IdentityType_size) -#define SignedIdentity_size 140 +#define SignedIdentity_size 145 #define GetECDHSessionKey_size (107 + IdentityType_size) #define ECDHSessionKey_size 67 #define SetU2FCounter_size 6 diff --git a/firmware/protob/types.pb.c b/firmware/protob/types.pb.c index 89c11a18c..04ef17f7b 100644 --- a/firmware/protob/types.pb.c +++ b/firmware/protob/types.pb.c @@ -47,7 +47,7 @@ const pb_field_t MultisigRedeemScriptType_fields[4] = { PB_LAST_FIELD }; -const pb_field_t TxInputType_fields[8] = { +const pb_field_t TxInputType_fields[9] = { PB_FIELD2( 1, UINT32 , REPEATED, STATIC , FIRST, TxInputType, address_n, address_n, 0), PB_FIELD2( 2, BYTES , REQUIRED, STATIC , OTHER, TxInputType, prev_hash, address_n, 0), PB_FIELD2( 3, UINT32 , REQUIRED, STATIC , OTHER, TxInputType, prev_index, prev_hash, 0), @@ -55,6 +55,7 @@ const pb_field_t TxInputType_fields[8] = { PB_FIELD2( 5, UINT32 , OPTIONAL, STATIC , OTHER, TxInputType, sequence, script_sig, &TxInputType_sequence_default), PB_FIELD2( 6, ENUM , OPTIONAL, STATIC , OTHER, TxInputType, script_type, sequence, &TxInputType_script_type_default), PB_FIELD2( 7, MESSAGE , OPTIONAL, STATIC , OTHER, TxInputType, multisig, script_type, &MultisigRedeemScriptType_fields), + PB_FIELD2( 8, UINT64 , OPTIONAL, STATIC , OTHER, TxInputType, amount, multisig, 0), PB_LAST_FIELD }; diff --git a/firmware/protob/types.pb.h b/firmware/protob/types.pb.h index e8318e193..de87ac94f 100644 --- a/firmware/protob/types.pb.h +++ b/firmware/protob/types.pb.h @@ -28,12 +28,17 @@ typedef enum _OutputScriptType { OutputScriptType_PAYTOADDRESS = 0, OutputScriptType_PAYTOSCRIPTHASH = 1, OutputScriptType_PAYTOMULTISIG = 2, - OutputScriptType_PAYTOOPRETURN = 3 + OutputScriptType_PAYTOOPRETURN = 3, + OutputScriptType_PAYTOWITNESS = 4, + OutputScriptType_PAYTOP2SHWITNESS = 5 } OutputScriptType; typedef enum _InputScriptType { InputScriptType_SPENDADDRESS = 0, - InputScriptType_SPENDMULTISIG = 1 + InputScriptType_SPENDMULTISIG = 1, + InputScriptType_EXTERNAL = 2, + InputScriptType_SPENDWITNESS = 3, + InputScriptType_SPENDP2SHWITNESS = 4 } InputScriptType; typedef enum _RequestType { @@ -208,6 +213,8 @@ typedef struct _TxInputType { InputScriptType script_type; bool has_multisig; MultisigRedeemScriptType multisig; + bool has_amount; + uint64_t amount; } TxInputType; typedef struct { @@ -217,7 +224,7 @@ typedef struct { typedef struct _TxOutputType { bool has_address; - char address[36]; + char address[41]; size_t address_n_count; uint32_t address_n[8]; uint64_t amount; @@ -265,7 +272,7 @@ extern const uint32_t IdentityType_index_default; #define HDNodePathType_init_default {HDNodeType_init_default, 0, {0, 0, 0, 0, 0, 0, 0, 0}} #define CoinType_init_default {false, "", false, "", false, 0u, false, 0, false, 5u, false, 6u, false, 10u, false, ""} #define MultisigRedeemScriptType_init_default {0, {HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, false, 0} -#define TxInputType_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, 0, false, {0, {0}}, false, 4294967295u, false, InputScriptType_SPENDADDRESS, false, MultisigRedeemScriptType_init_default} +#define TxInputType_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, 0, false, {0, {0}}, false, 4294967295u, false, InputScriptType_SPENDADDRESS, false, MultisigRedeemScriptType_init_default, false, 0} #define TxOutputType_init_default {false, "", 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, (OutputScriptType)0, false, MultisigRedeemScriptType_init_default, false, {0, {0}}} #define TxOutputBinType_init_default {0, {0, {0}}} #define TransactionType_init_default {false, 0, 0, {TxInputType_init_default}, 0, {TxOutputBinType_init_default}, false, 0, 0, {TxOutputType_init_default}, false, 0, false, 0} @@ -276,7 +283,7 @@ extern const uint32_t IdentityType_index_default; #define HDNodePathType_init_zero {HDNodeType_init_zero, 0, {0, 0, 0, 0, 0, 0, 0, 0}} #define CoinType_init_zero {false, "", false, "", false, 0, false, 0, false, 0, false, 0, false, 0, false, ""} #define MultisigRedeemScriptType_init_zero {0, {HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, false, 0} -#define TxInputType_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, 0, false, {0, {0}}, false, 0, false, (InputScriptType)0, false, MultisigRedeemScriptType_init_zero} +#define TxInputType_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, 0, false, {0, {0}}, false, 0, false, (InputScriptType)0, false, MultisigRedeemScriptType_init_zero, false, 0} #define TxOutputType_init_zero {false, "", 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, (OutputScriptType)0, false, MultisigRedeemScriptType_init_zero, false, {0, {0}}} #define TxOutputBinType_init_zero {0, {0, {0}}} #define TransactionType_init_zero {false, 0, 0, {TxInputType_init_zero}, 0, {TxOutputBinType_init_zero}, false, 0, 0, {TxOutputType_init_zero}, false, 0, false, 0} @@ -324,6 +331,7 @@ extern const uint32_t IdentityType_index_default; #define TxInputType_sequence_tag 5 #define TxInputType_script_type_tag 6 #define TxInputType_multisig_tag 7 +#define TxInputType_amount_tag 8 #define TxOutputType_address_tag 1 #define TxOutputType_address_n_tag 2 #define TxOutputType_amount_tag 3 @@ -347,7 +355,7 @@ extern const pb_field_t HDNodeType_fields[7]; extern const pb_field_t HDNodePathType_fields[3]; extern const pb_field_t CoinType_fields[9]; extern const pb_field_t MultisigRedeemScriptType_fields[4]; -extern const pb_field_t TxInputType_fields[8]; +extern const pb_field_t TxInputType_fields[9]; extern const pb_field_t TxOutputType_fields[7]; extern const pb_field_t TxOutputBinType_fields[3]; extern const pb_field_t TransactionType_fields[8]; @@ -360,10 +368,10 @@ extern const pb_field_t IdentityType_fields[7]; #define HDNodePathType_size 171 #define CoinType_size 99 #define MultisigRedeemScriptType_size 3741 -#define TxInputType_size 5497 -#define TxOutputType_size 3929 +#define TxInputType_size 5508 +#define TxOutputType_size 3934 #define TxOutputBinType_size 534 -#define TransactionType_size 9993 +#define TransactionType_size 10009 #define TxRequestDetailsType_size 40 #define TxRequestSerializedType_size 2132 #define IdentityType_size 416 diff --git a/vendor/trezor-common b/vendor/trezor-common index c2a0b255f..1e7495235 160000 --- a/vendor/trezor-common +++ b/vendor/trezor-common @@ -1 +1 @@ -Subproject commit c2a0b255ff1ba174085ebe76c46f8e049f85d197 +Subproject commit 1e749523593506f2f268c038225f2c847ad2d0ef