1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

Merge branch 'master' into segwit

This commit is contained in:
Pavol Rusnak 2017-05-03 17:16:30 +02:00
commit 8e017526ab
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
13 changed files with 75 additions and 112 deletions

View File

@ -30,6 +30,15 @@ for c in coins:
'true' if c['signed_message_header'] is not None else 'false',
'"\\x%02x" "%s"' % (len(c['signed_message_header']), c['signed_message_header'].replace('\n', '\\n')) if c['signed_message_header'] is not None else 'NULL',
'true' if c['xpub_magic'] is not None else 'false',
'0x%s' % c['xpub_magic'] if c['xpub_magic'] is not None else '00000000',
'true' if c['xprv_magic'] is not None else 'false',
'0x%s' % c['xprv_magic'] if c['xprv_magic'] is not None else '00000000',
'true' if c['segwit'] is not None else 'false',
'true' if c['segwit'] else 'false'
])
for j in range(len(fields[0])):

View File

@ -26,14 +26,14 @@
// filled CoinType Protobuf structure defined in https://github.com/trezor/trezor-common/blob/master/protob/types.proto#L133
// address types > 0xFF represent a two-byte prefix in big-endian order
const CoinType coins[COINS_COUNT] = {
{true, "Bitcoin", true, "BTC", true, 0, true, 300000, true, 5, true, 6, true, 10, true, "\x18" "Bitcoin Signed Message:\n", },
{true, "Testnet", true, "TEST", true, 111, true, 10000000, true, 196, true, 3, true, 40, true, "\x18" "Bitcoin Signed Message:\n", },
{true, "Namecoin", true, "NMC", true, 52, true, 10000000, true, 5, false, 0, false, 0, true, "\x19" "Namecoin Signed Message:\n", },
{true, "Litecoin", true, "LTC", true, 48, true, 1000000, true, 5, false, 0, false, 0, true, "\x19" "Litecoin Signed Message:\n", },
{true, "Dogecoin", true, "DOGE", true, 30, true, 1000000000, true, 22, false, 0, false, 0, true, "\x19" "Dogecoin Signed Message:\n", },
{true, "Dash", true, "DASH", true, 76, true, 100000, true, 16, false, 0, false, 0, true, "\x19" "DarkCoin Signed Message:\n", },
{true, "Zcash", true, "ZEC", true, 7352, true, 1000000, true, 7357, false, 0, false, 0, true, "\x16" "Zcash Signed Message:\n", },
{true, "Zcash Testnet", true, "TAZ", true, 7461, true, 10000000, true, 7354, false, 0, false, 0, true, "\x16" "Zcash Signed Message:\n", },
{true, "Bitcoin", true, "BTC", true, 0, true, 300000, true, 5, true, 6, true, 10, true, "\x18" "Bitcoin Signed Message:\n", true, 0x0488b21e, true, 0x0488ade4, true, false, },
{true, "Testnet", true, "TEST", true, 111, true, 10000000, true, 196, true, 3, true, 40, true, "\x18" "Bitcoin Signed Message:\n", true, 0x043587cf, true, 0x04358394, true, true, },
{true, "Namecoin", true, "NMC", true, 52, true, 10000000, true, 5, false, 0, false, 0, true, "\x19" "Namecoin Signed Message:\n", true, 0x019da462, true, 0x019d9cfe, true, false, },
{true, "Litecoin", true, "LTC", true, 48, true, 1000000, true, 5, false, 0, false, 0, true, "\x19" "Litecoin Signed Message:\n", true, 0x019da462, true, 0x019d9cfe, true, true, },
{true, "Dogecoin", true, "DOGE", true, 30, true, 1000000000, true, 22, false, 0, false, 0, true, "\x19" "Dogecoin Signed Message:\n", true, 0x02facafd, true, 0x02fac398, true, false, },
{true, "Dash", true, "DASH", true, 76, true, 100000, true, 16, false, 0, false, 0, true, "\x19" "DarkCoin Signed Message:\n", true, 0x02fe52cc, true, 0x02fe52f8, true, false, },
{true, "Zcash", true, "ZEC", true, 7352, true, 1000000, true, 7357, false, 0, false, 0, true, "\x16" "Zcash Signed Message:\n", true, 0x0488b21e, true, 0x0488ade4, true, false, },
{true, "Zcash Testnet", true, "TAZ", true, 7461, true, 10000000, true, 7354, false, 0, false, 0, true, "\x16" "Zcash Signed Message:\n", true, 0x043587cf, true, 0x04358394, true, false, },
};
const CoinType *coinByShortcut(const char *shortcut)

View File

@ -118,9 +118,14 @@ void fsm_sendFailure(FailureType code, const char *text)
msg_write(MessageType_MessageType_Failure, resp);
}
const CoinType *fsm_getCoin(const char *name)
const CoinType *fsm_getCoin(bool has_name, const char *name)
{
const CoinType *coin = coinByName(name);
const CoinType *coin;
if (has_name) {
coin = coinByName(name);
} else {
coin = coinByName("Bitcoin");
}
if (!coin) {
fsm_sendFailure(FailureType_Failure_Other, "Invalid coin name");
layoutHome();
@ -280,18 +285,6 @@ void fsm_msgWipeDevice(WipeDevice *msg)
layoutHome();
}
void fsm_msgFirmwareErase(FirmwareErase *msg)
{
(void)msg;
fsm_sendFailure(FailureType_Failure_UnexpectedMessage, "Not in bootloader mode");
}
void fsm_msgFirmwareUpload(FirmwareUpload *msg)
{
(void)msg;
fsm_sendFailure(FailureType_Failure_UnexpectedMessage, "Not in bootloader mode");
}
void fsm_msgGetEntropy(GetEntropy *msg)
{
layoutDialogSwipe(&bmp_icon_question, "Cancel", "Confirm", NULL, "Do you really want to", "send entropy?", NULL, NULL, NULL, NULL);
@ -319,6 +312,9 @@ void fsm_msgGetPublicKey(GetPublicKey *msg)
CHECK_PIN
const CoinType *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
if (!coin) return;
const char *curve = SECP256K1_NAME;
if (msg->has_ecdsa_curve_name) {
curve = msg->ecdsa_curve_name;
@ -362,7 +358,7 @@ void fsm_msgGetPublicKey(GetPublicKey *msg)
resp->node.public_key.bytes[0] = 0;
}
resp->has_xpub = true;
hdnode_serialize_public(node, fingerprint, resp->xpub, sizeof(resp->xpub));
hdnode_serialize_public(node, fingerprint, coin->xpub_magic, resp->xpub, sizeof(resp->xpub));
msg_write(MessageType_MessageType_PublicKey, resp);
layoutHome();
}
@ -418,7 +414,7 @@ void fsm_msgSignTx(SignTx *msg)
CHECK_PIN
const CoinType *coin = fsm_getCoin(msg->coin_name);
const CoinType *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
if (!coin) return;
const HDNode *node = fsm_getDerivedNode(SECP256K1_NAME, 0, 0);
if (!node) return;
@ -579,7 +575,7 @@ void fsm_msgGetAddress(GetAddress *msg)
CHECK_PIN
const CoinType *coin = fsm_getCoin(msg->coin_name);
const CoinType *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
if (!coin) return;
HDNode *node = fsm_getDerivedNode(SECP256K1_NAME, msg->address_n, msg->address_n_count);
if (!node) return;
@ -682,7 +678,7 @@ void fsm_msgSignMessage(SignMessage *msg)
CHECK_PIN
const CoinType *coin = fsm_getCoin(msg->coin_name);
const CoinType *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
if (!coin) return;
HDNode *node = fsm_getDerivedNode(SECP256K1_NAME, msg->address_n, msg->address_n_count);
if (!node) return;
@ -705,7 +701,7 @@ void fsm_msgVerifyMessage(VerifyMessage *msg)
CHECK_PARAM(msg->has_address, "No address provided");
CHECK_PARAM(msg->has_message, "No message provided");
const CoinType *coin = fsm_getCoin(msg->coin_name);
const CoinType *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
if (!coin) return;
uint8_t addr_raw[MAX_ADDR_RAW_SIZE];
uint32_t address_type;
@ -875,7 +871,7 @@ void fsm_msgEncryptMessage(EncryptMessage *msg)
const HDNode *node = 0;
uint8_t address_raw[MAX_ADDR_RAW_SIZE];
if (signing) {
const CoinType *coin = fsm_getCoin(msg->coin_name);
const CoinType *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
if (!coin) return;
CHECK_PIN

View File

@ -32,8 +32,6 @@ void fsm_msgGetFeatures(GetFeatures *msg);
void fsm_msgPing(Ping *msg);
void fsm_msgChangePin(ChangePin *msg);
void fsm_msgWipeDevice(WipeDevice *msg);
void fsm_msgFirmwareErase(FirmwareErase *msg);
void fsm_msgFirmwareUpload(FirmwareUpload *msg);
void fsm_msgGetEntropy(GetEntropy *msg);
void fsm_msgGetPublicKey(GetPublicKey *msg);
void fsm_msgLoadDevice(LoadDevice *msg);

View File

@ -44,8 +44,6 @@ static const struct MessagesMap_t MessagesMap[] = {
{'n', 'i', MessageType_MessageType_Ping, Ping_fields, (void (*)(void *))fsm_msgPing},
{'n', 'i', MessageType_MessageType_ChangePin, ChangePin_fields, (void (*)(void *))fsm_msgChangePin},
{'n', 'i', MessageType_MessageType_WipeDevice, WipeDevice_fields, (void (*)(void *))fsm_msgWipeDevice},
{'n', 'i', MessageType_MessageType_FirmwareErase, FirmwareErase_fields, (void (*)(void *))fsm_msgFirmwareErase},
{'n', 'i', MessageType_MessageType_FirmwareUpload, FirmwareUpload_fields, (void (*)(void *))fsm_msgFirmwareUpload},
{'n', 'i', MessageType_MessageType_GetEntropy, GetEntropy_fields, (void (*)(void *))fsm_msgGetEntropy},
{'n', 'i', MessageType_MessageType_GetPublicKey, GetPublicKey_fields, (void (*)(void *))fsm_msgGetPublicKey},
{'n', 'i', MessageType_MessageType_LoadDevice, LoadDevice_fields, (void (*)(void *))fsm_msgLoadDevice},

View File

@ -26,6 +26,7 @@ Entropy.entropy max_size:1024
GetPublicKey.address_n max_count:8
GetPublicKey.ecdsa_curve_name max_size:32
GetPublicKey.coin_name max_size:17
PublicKey.xpub max_size:113
@ -119,13 +120,11 @@ GetECDHSessionKey.ecdsa_curve_name max_size:32
ECDHSessionKey.session_key max_size:65
# not used in firmware
SimpleSignTx.inputs max_count:0
SimpleSignTx.outputs max_count:0
SimpleSignTx.transactions max_count:0
SimpleSignTx.coin_name max_size:17
SimpleSignTx skip_message:true
FirmwareRequest skip_message:true
FirmwareUpload skip_message:true
# not used in firmware
FirmwareUpload.payload max_size:0
# used in debug firmware
DebugLinkState.layout max_size:1024
DebugLinkState.pin max_size:10

View File

@ -3,6 +3,7 @@
#include "messages.pb.h"
const char GetPublicKey_coin_name_default[17] = "Bitcoin";
const char GetAddress_coin_name_default[17] = "Bitcoin";
const InputScriptType GetAddress_script_type_default = InputScriptType_SPENDADDRESS;
const char LoadDevice_language_default[17] = "english";
@ -16,9 +17,6 @@ const char EstimateTxSize_coin_name_default[17] = "Bitcoin";
const char SignTx_coin_name_default[17] = "Bitcoin";
const uint32_t SignTx_version_default = 1u;
const uint32_t SignTx_lock_time_default = 0u;
const char SimpleSignTx_coin_name_default[17] = "Bitcoin";
const uint32_t SimpleSignTx_version_default = 1u;
const uint32_t SimpleSignTx_lock_time_default = 0u;
const pb_field_t Initialize_fields[1] = {
@ -130,10 +128,11 @@ const pb_field_t Entropy_fields[2] = {
PB_LAST_FIELD
};
const pb_field_t GetPublicKey_fields[4] = {
const pb_field_t GetPublicKey_fields[5] = {
PB_FIELD2( 1, UINT32 , REPEATED, STATIC , FIRST, GetPublicKey, address_n, address_n, 0),
PB_FIELD2( 2, STRING , OPTIONAL, STATIC , OTHER, GetPublicKey, ecdsa_curve_name, address_n, 0),
PB_FIELD2( 3, BOOL , OPTIONAL, STATIC , OTHER, GetPublicKey, show_display, ecdsa_curve_name, 0),
PB_FIELD2( 4, STRING , OPTIONAL, STATIC , OTHER, GetPublicKey, coin_name, show_display, &GetPublicKey_coin_name_default),
PB_LAST_FIELD
};
@ -314,16 +313,6 @@ const pb_field_t SignTx_fields[6] = {
PB_LAST_FIELD
};
const pb_field_t SimpleSignTx_fields[7] = {
PB_FIELD2( 1, MESSAGE , REPEATED, STATIC , FIRST, SimpleSignTx, inputs, inputs, &TxInputType_fields),
PB_FIELD2( 2, MESSAGE , REPEATED, STATIC , OTHER, SimpleSignTx, outputs, inputs, &TxOutputType_fields),
PB_FIELD2( 3, MESSAGE , REPEATED, STATIC , OTHER, SimpleSignTx, transactions, outputs, &TransactionType_fields),
PB_FIELD2( 4, STRING , OPTIONAL, STATIC , OTHER, SimpleSignTx, coin_name, transactions, &SimpleSignTx_coin_name_default),
PB_FIELD2( 5, UINT32 , OPTIONAL, STATIC , OTHER, SimpleSignTx, version, coin_name, &SimpleSignTx_version_default),
PB_FIELD2( 6, UINT32 , OPTIONAL, STATIC , OTHER, SimpleSignTx, lock_time, version, &SimpleSignTx_lock_time_default),
PB_LAST_FIELD
};
const pb_field_t TxRequest_fields[4] = {
PB_FIELD2( 1, ENUM , OPTIONAL, STATIC , FIRST, TxRequest, request_type, request_type, 0),
PB_FIELD2( 2, MESSAGE , OPTIONAL, STATIC , OTHER, TxRequest, details, request_type, &TxRequestDetailsType_fields),
@ -398,11 +387,6 @@ const pb_field_t FirmwareErase_fields[1] = {
PB_LAST_FIELD
};
const pb_field_t FirmwareUpload_fields[2] = {
PB_FIELD2( 1, BYTES , REQUIRED, STATIC , FIRST, FirmwareUpload, payload, payload, 0),
PB_LAST_FIELD
};
const pb_field_t DebugLinkDecision_fields[2] = {
PB_FIELD2( 1, BOOL , REQUIRED, STATIC , FIRST, DebugLinkDecision, yes_no, yes_no, 0),
PB_LAST_FIELD
@ -470,7 +454,7 @@ const pb_field_t DebugLinkFlashErase_fields[2] = {
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
* field descriptors.
*/
STATIC_ASSERT((pb_membersize(Features, coins[0]) < 65536 && pb_membersize(PublicKey, node) < 65536 && pb_membersize(GetAddress, multisig) < 65536 && pb_membersize(LoadDevice, node) < 65536 && pb_membersize(SimpleSignTx, inputs[0]) < 65536 && pb_membersize(SimpleSignTx, outputs[0]) < 65536 && pb_membersize(SimpleSignTx, transactions[0]) < 65536 && pb_membersize(TxRequest, details) < 65536 && pb_membersize(TxRequest, serialized) < 65536 && pb_membersize(TxAck, tx) < 65536 && pb_membersize(SignIdentity, identity) < 65536 && pb_membersize(GetECDHSessionKey, identity) < 65536 && pb_membersize(DebugLinkState, node) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_Initialize_GetFeatures_Features_ClearSession_ApplySettings_ChangePin_Ping_Success_Failure_ButtonRequest_ButtonAck_PinMatrixRequest_PinMatrixAck_Cancel_PassphraseRequest_PassphraseAck_GetEntropy_Entropy_GetPublicKey_PublicKey_GetAddress_EthereumGetAddress_Address_EthereumAddress_WipeDevice_LoadDevice_ResetDevice_EntropyRequest_EntropyAck_RecoveryDevice_WordRequest_WordAck_SignMessage_VerifyMessage_MessageSignature_EncryptMessage_EncryptedMessage_DecryptMessage_DecryptedMessage_CipherKeyValue_CipheredKeyValue_EstimateTxSize_TxSize_SignTx_SimpleSignTx_TxRequest_TxAck_EthereumSignTx_EthereumTxRequest_EthereumTxAck_SignIdentity_SignedIdentity_GetECDHSessionKey_ECDHSessionKey_SetU2FCounter_FirmwareErase_FirmwareUpload_DebugLinkDecision_DebugLinkGetState_DebugLinkState_DebugLinkStop_DebugLinkLog_DebugLinkMemoryRead_DebugLinkMemory_DebugLinkMemoryWrite_DebugLinkFlashErase)
STATIC_ASSERT((pb_membersize(Features, coins[0]) < 65536 && pb_membersize(PublicKey, node) < 65536 && pb_membersize(GetAddress, multisig) < 65536 && pb_membersize(LoadDevice, node) < 65536 && pb_membersize(TxRequest, details) < 65536 && pb_membersize(TxRequest, serialized) < 65536 && pb_membersize(TxAck, tx) < 65536 && pb_membersize(SignIdentity, identity) < 65536 && pb_membersize(GetECDHSessionKey, identity) < 65536 && pb_membersize(DebugLinkState, node) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_Initialize_GetFeatures_Features_ClearSession_ApplySettings_ChangePin_Ping_Success_Failure_ButtonRequest_ButtonAck_PinMatrixRequest_PinMatrixAck_Cancel_PassphraseRequest_PassphraseAck_GetEntropy_Entropy_GetPublicKey_PublicKey_GetAddress_EthereumGetAddress_Address_EthereumAddress_WipeDevice_LoadDevice_ResetDevice_EntropyRequest_EntropyAck_RecoveryDevice_WordRequest_WordAck_SignMessage_VerifyMessage_MessageSignature_EncryptMessage_EncryptedMessage_DecryptMessage_DecryptedMessage_CipherKeyValue_CipheredKeyValue_EstimateTxSize_TxSize_SignTx_TxRequest_TxAck_EthereumSignTx_EthereumTxRequest_EthereumTxAck_SignIdentity_SignedIdentity_GetECDHSessionKey_ECDHSessionKey_SetU2FCounter_FirmwareErase_DebugLinkDecision_DebugLinkGetState_DebugLinkState_DebugLinkStop_DebugLinkLog_DebugLinkMemoryRead_DebugLinkMemory_DebugLinkMemoryWrite_DebugLinkFlashErase)
#endif
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)

View File

@ -20,6 +20,7 @@ typedef enum _MessageType {
MessageType_MessageType_WipeDevice = 5,
MessageType_MessageType_FirmwareErase = 6,
MessageType_MessageType_FirmwareUpload = 7,
MessageType_MessageType_FirmwareRequest = 8,
MessageType_MessageType_GetEntropy = 9,
MessageType_MessageType_Entropy = 10,
MessageType_MessageType_GetPublicKey = 11,
@ -551,15 +552,6 @@ typedef struct _Features {
bool firmware_present;
} Features;
typedef struct {
size_t size;
uint8_t bytes[0];
} FirmwareUpload_payload_t;
typedef struct _FirmwareUpload {
FirmwareUpload_payload_t payload;
} FirmwareUpload;
typedef struct _GetAddress {
size_t address_n_count;
uint32_t address_n[8];
@ -598,6 +590,8 @@ typedef struct _GetPublicKey {
char ecdsa_curve_name[32];
bool has_show_display;
bool show_display;
bool has_coin_name;
char coin_name[17];
} GetPublicKey;
typedef struct _LoadDevice {
@ -761,21 +755,6 @@ typedef struct _SignedIdentity {
SignedIdentity_signature_t signature;
} SignedIdentity;
typedef struct _SimpleSignTx {
size_t inputs_count;
TxInputType inputs[0];
size_t outputs_count;
TxOutputType outputs[0];
size_t transactions_count;
TransactionType transactions[0];
bool has_coin_name;
char coin_name[17];
bool has_version;
uint32_t version;
bool has_lock_time;
uint32_t lock_time;
} SimpleSignTx;
typedef struct _Success {
bool has_message;
char message[256];
@ -831,6 +810,7 @@ typedef struct _WordRequest {
} WordRequest;
/* Default values for struct fields */
extern const char GetPublicKey_coin_name_default[17];
extern const char GetAddress_coin_name_default[17];
extern const InputScriptType GetAddress_script_type_default;
extern const char LoadDevice_language_default[17];
@ -844,9 +824,6 @@ extern const char EstimateTxSize_coin_name_default[17];
extern const char SignTx_coin_name_default[17];
extern const uint32_t SignTx_version_default;
extern const uint32_t SignTx_lock_time_default;
extern const char SimpleSignTx_coin_name_default[17];
extern const uint32_t SimpleSignTx_version_default;
extern const uint32_t SimpleSignTx_lock_time_default;
/* Initializer values for message structs */
#define Initialize_init_default {0}
@ -867,7 +844,7 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define PassphraseAck_init_default {""}
#define GetEntropy_init_default {0}
#define Entropy_init_default {{0, {0}}}
#define GetPublicKey_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0}
#define GetPublicKey_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0, false, "Bitcoin"}
#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, false, InputScriptType_SPENDADDRESS}
#define EthereumGetAddress_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, 0}
@ -893,7 +870,6 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define EstimateTxSize_init_default {0, 0, false, "Bitcoin"}
#define TxSize_init_default {false, 0}
#define SignTx_init_default {0, 0, false, "Bitcoin", false, 1u, false, 0u}
#define SimpleSignTx_init_default {0, {}, 0, {}, 0, {}, false, "Bitcoin", false, 1u, false, 0u}
#define TxRequest_init_default {false, (RequestType)0, false, TxRequestDetailsType_init_default, false, TxRequestSerializedType_init_default}
#define TxAck_init_default {false, TransactionType_init_default}
#define EthereumSignTx_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, {0, {0}}, false, {0, {0}}, false, {0, {0}}, false, {0, {0}}, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0}
@ -905,7 +881,6 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define ECDHSessionKey_init_default {false, {0, {0}}}
#define SetU2FCounter_init_default {false, 0}
#define FirmwareErase_init_default {0}
#define FirmwareUpload_init_default {{0, {0}}}
#define DebugLinkDecision_init_default {0}
#define DebugLinkGetState_init_default {0}
#define DebugLinkState_init_default {false, {0, {0}}, false, "", false, "", false, "", false, HDNodeType_init_default, false, 0, false, "", false, {0, {0}}, false, "", false, 0}
@ -933,7 +908,7 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define PassphraseAck_init_zero {""}
#define GetEntropy_init_zero {0}
#define Entropy_init_zero {{0, {0}}}
#define GetPublicKey_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0}
#define GetPublicKey_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0, false, ""}
#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, false, (InputScriptType)0}
#define EthereumGetAddress_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, 0}
@ -959,7 +934,6 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define EstimateTxSize_init_zero {0, 0, false, ""}
#define TxSize_init_zero {false, 0}
#define SignTx_init_zero {0, 0, false, "", false, 0, false, 0}
#define SimpleSignTx_init_zero {0, {}, 0, {}, 0, {}, false, "", false, 0, false, 0}
#define TxRequest_init_zero {false, (RequestType)0, false, TxRequestDetailsType_init_zero, false, TxRequestSerializedType_init_zero}
#define TxAck_init_zero {false, TransactionType_init_zero}
#define EthereumSignTx_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, {0, {0}}, false, {0, {0}}, false, {0, {0}}, false, {0, {0}}, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0}
@ -971,7 +945,6 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define ECDHSessionKey_init_zero {false, {0, {0}}}
#define SetU2FCounter_init_zero {false, 0}
#define FirmwareErase_init_zero {0}
#define FirmwareUpload_init_zero {{0, {0}}}
#define DebugLinkDecision_init_zero {0}
#define DebugLinkGetState_init_zero {0}
#define DebugLinkState_init_zero {false, {0, {0}}, false, "", false, "", false, "", false, HDNodeType_init_zero, false, 0, false, "", false, {0, {0}}, false, "", false, 0}
@ -1077,7 +1050,6 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#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
@ -1090,6 +1062,7 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define GetPublicKey_address_n_tag 1
#define GetPublicKey_ecdsa_curve_name_tag 2
#define GetPublicKey_show_display_tag 3
#define GetPublicKey_coin_name_tag 4
#define LoadDevice_mnemonic_tag 1
#define LoadDevice_node_tag 2
#define LoadDevice_pin_tag 3
@ -1140,12 +1113,6 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define SignedIdentity_address_tag 1
#define SignedIdentity_public_key_tag 2
#define SignedIdentity_signature_tag 3
#define SimpleSignTx_inputs_tag 1
#define SimpleSignTx_outputs_tag 2
#define SimpleSignTx_transactions_tag 3
#define SimpleSignTx_coin_name_tag 4
#define SimpleSignTx_version_tag 5
#define SimpleSignTx_lock_time_tag 6
#define Success_message_tag 1
#define TxAck_tx_tag 1
#define TxRequest_request_type_tag 1
@ -1178,7 +1145,7 @@ extern const pb_field_t PassphraseRequest_fields[1];
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[4];
extern const pb_field_t GetPublicKey_fields[5];
extern const pb_field_t PublicKey_fields[3];
extern const pb_field_t GetAddress_fields[6];
extern const pb_field_t EthereumGetAddress_fields[3];
@ -1204,7 +1171,6 @@ extern const pb_field_t CipheredKeyValue_fields[2];
extern const pb_field_t EstimateTxSize_fields[4];
extern const pb_field_t TxSize_fields[2];
extern const pb_field_t SignTx_fields[6];
extern const pb_field_t SimpleSignTx_fields[7];
extern const pb_field_t TxRequest_fields[4];
extern const pb_field_t TxAck_fields[2];
extern const pb_field_t EthereumSignTx_fields[10];
@ -1216,7 +1182,6 @@ extern const pb_field_t GetECDHSessionKey_fields[4];
extern const pb_field_t ECDHSessionKey_fields[2];
extern const pb_field_t SetU2FCounter_fields[2];
extern const pb_field_t FirmwareErase_fields[1];
extern const pb_field_t FirmwareUpload_fields[2];
extern const pb_field_t DebugLinkDecision_fields[2];
extern const pb_field_t DebugLinkGetState_fields[1];
extern const pb_field_t DebugLinkState_fields[11];
@ -1246,7 +1211,7 @@ extern const pb_field_t DebugLinkFlashErase_fields[2];
#define PassphraseAck_size 53
#define GetEntropy_size 6
#define Entropy_size 1027
#define GetPublicKey_size 84
#define GetPublicKey_size 103
#define PublicKey_size (121 + HDNodeType_size)
#define GetAddress_size (81 + MultisigRedeemScriptType_size)
#define EthereumGetAddress_size 50
@ -1272,7 +1237,6 @@ extern const pb_field_t DebugLinkFlashErase_fields[2];
#define EstimateTxSize_size 31
#define TxSize_size 6
#define SignTx_size 43
#define SimpleSignTx_size (31 + 0*TxInputType_size + 0*TxOutputType_size + 0*TransactionType_size)
#define TxRequest_size (18 + TxRequestDetailsType_size + TxRequestSerializedType_size)
#define TxAck_size (6 + TransactionType_size)
#define EthereumSignTx_size 1245
@ -1284,7 +1248,6 @@ extern const pb_field_t DebugLinkFlashErase_fields[2];
#define ECDHSessionKey_size 67
#define SetU2FCounter_size 6
#define FirmwareErase_size 0
#define FirmwareUpload_size 2
#define DebugLinkDecision_size 2
#define DebugLinkGetState_size 0
#define DebugLinkState_size (1468 + HDNodeType_size)

View File

@ -7,6 +7,8 @@ const uint32_t CoinType_address_type_default = 0u;
const uint32_t CoinType_address_type_p2sh_default = 5u;
const uint32_t CoinType_address_type_p2wpkh_default = 6u;
const uint32_t CoinType_address_type_p2wsh_default = 10u;
const uint32_t CoinType_xpub_magic_default = 76067358u;
const uint32_t CoinType_xprv_magic_default = 76066276u;
const uint32_t TxInputType_sequence_default = 4294967295u;
const InputScriptType TxInputType_script_type_default = InputScriptType_SPENDADDRESS;
const uint32_t IdentityType_index_default = 0u;
@ -28,7 +30,7 @@ const pb_field_t HDNodePathType_fields[3] = {
PB_LAST_FIELD
};
const pb_field_t CoinType_fields[9] = {
const pb_field_t CoinType_fields[12] = {
PB_FIELD2( 1, STRING , OPTIONAL, STATIC , FIRST, CoinType, coin_name, coin_name, 0),
PB_FIELD2( 2, STRING , OPTIONAL, STATIC , OTHER, CoinType, coin_shortcut, coin_name, 0),
PB_FIELD2( 3, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, address_type, coin_shortcut, &CoinType_address_type_default),
@ -37,6 +39,9 @@ const pb_field_t CoinType_fields[9] = {
PB_FIELD2( 6, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, address_type_p2wpkh, address_type_p2sh, &CoinType_address_type_p2wpkh_default),
PB_FIELD2( 7, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, address_type_p2wsh, address_type_p2wpkh, &CoinType_address_type_p2wsh_default),
PB_FIELD2( 8, STRING , OPTIONAL, STATIC , OTHER, CoinType, signed_message_header, address_type_p2wsh, 0),
PB_FIELD2( 9, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, xpub_magic, signed_message_header, &CoinType_xpub_magic_default),
PB_FIELD2( 10, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, xprv_magic, xpub_magic, &CoinType_xprv_magic_default),
PB_FIELD2( 11, BOOL , OPTIONAL, STATIC , OTHER, CoinType, segwit, xprv_magic, 0),
PB_LAST_FIELD
};

View File

@ -98,6 +98,12 @@ typedef struct _CoinType {
uint32_t address_type_p2wsh;
bool has_signed_message_header;
char signed_message_header[32];
bool has_xpub_magic;
uint32_t xpub_magic;
bool has_xprv_magic;
uint32_t xprv_magic;
bool has_segwit;
bool segwit;
} CoinType;
typedef struct {
@ -288,6 +294,8 @@ extern const uint32_t CoinType_address_type_default;
extern const uint32_t CoinType_address_type_p2sh_default;
extern const uint32_t CoinType_address_type_p2wpkh_default;
extern const uint32_t CoinType_address_type_p2wsh_default;
extern const uint32_t CoinType_xpub_magic_default;
extern const uint32_t CoinType_xprv_magic_default;
extern const uint32_t TxInputType_sequence_default;
extern const InputScriptType TxInputType_script_type_default;
extern const uint32_t IdentityType_index_default;
@ -295,7 +303,7 @@ extern const uint32_t IdentityType_index_default;
/* Initializer values for message structs */
#define HDNodeType_init_default {0, 0, 0, {0, {0}}, false, {0, {0}}, false, {0, {0}}}
#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 CoinType_init_default {false, "", false, "", false, 0u, false, 0, false, 5u, false, 6u, false, 10u, false, "", false, 76067358u, false, 76066276u, false, 0}
#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, 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}}}
@ -306,7 +314,7 @@ extern const uint32_t IdentityType_index_default;
#define IdentityType_init_default {false, "", false, "", false, "", false, "", false, "", false, 0u}
#define HDNodeType_init_zero {0, 0, 0, {0, {0}}, false, {0, {0}}, false, {0, {0}}}
#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 CoinType_init_zero {false, "", false, "", false, 0, false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, 0}
#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, 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}}}
@ -325,6 +333,9 @@ extern const uint32_t IdentityType_index_default;
#define CoinType_address_type_p2wpkh_tag 6
#define CoinType_address_type_p2wsh_tag 7
#define CoinType_signed_message_header_tag 8
#define CoinType_xpub_magic_tag 9
#define CoinType_xprv_magic_tag 10
#define CoinType_segwit_tag 11
#define HDNodeType_depth_tag 1
#define HDNodeType_fingerprint_tag 2
#define HDNodeType_child_num_tag 3
@ -382,7 +393,7 @@ extern const uint32_t IdentityType_index_default;
/* Struct field encoding specification for nanopb */
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 CoinType_fields[12];
extern const pb_field_t MultisigRedeemScriptType_fields[4];
extern const pb_field_t TxInputType_fields[9];
extern const pb_field_t TxOutputType_fields[7];
@ -395,7 +406,7 @@ extern const pb_field_t IdentityType_fields[7];
/* Maximum encoded size of messages (where known) */
#define HDNodeType_size 121
#define HDNodePathType_size 171
#define CoinType_size 99
#define CoinType_size 113
#define MultisigRedeemScriptType_size 3741
#define TxInputType_size 5508
#define TxOutputType_size 3947

@ -1 +1 @@
Subproject commit 80c7b666a204c74be1d1ed6b019d1fad2d2fe909
Subproject commit fe6e62c11f7dca8cb601e53c5865f15f770fd079

@ -1 +1 @@
Subproject commit df2524e35bc7d10129b965be017277ce46d2cae0
Subproject commit fa82ba6d3f4ca9bbfee0c3dd7f8da22a8bfc6f11

2
vendor/trezor-qrenc vendored

@ -1 +1 @@
Subproject commit 9344f23d869030fbe7261d3361862eaba12b9975
Subproject commit 392ee5654f4862f2e2b49b69a4e802997715d34f