mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
bootloader: drop streaming for all cases except FirmwareUpload.payload, skip unused messages
This commit is contained in:
parent
aa6c96046e
commit
26267d532d
@ -1,3 +1,5 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <pb_decode.h>
|
||||
#include <pb_encode.h>
|
||||
#include "messages.pb.h"
|
||||
@ -110,17 +112,10 @@ static bool _send_msg(uint8_t iface_num, uint16_t msg_id, const pb_field_t field
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool _encode_string(pb_ostream_t *stream, const pb_field_t *field, void * const *arg)
|
||||
{
|
||||
if (!pb_encode_tag_for_field(stream, field)) {
|
||||
return false;
|
||||
}
|
||||
return pb_encode_string(stream, *arg, strlen(*arg));
|
||||
}
|
||||
|
||||
#define MSG_SEND_INIT(TYPE) TYPE msg_send = TYPE##_init_default
|
||||
#define MSG_SEND_ASSIGN_VALUE(FIELD, VALUE) do { msg_send.has_##FIELD = true; msg_send.FIELD = VALUE; } while (0)
|
||||
#define MSG_SEND_ASSIGN_STRING(FIELD, VALUE) do { msg_send.FIELD.funcs.encode = &_encode_string; msg_send.FIELD.arg = VALUE; } while (0)
|
||||
// FIXME: strcpy -> strncpy
|
||||
#define MSG_SEND_ASSIGN_STRING(FIELD, VALUE) do { msg_send.has_##FIELD = true; strcpy(msg_send.FIELD, VALUE); } while (0)
|
||||
#define MSG_SEND(TYPE) do { _send_msg(iface_num, MessageType_MessageType_##TYPE, TYPE##_fields, &msg_send); } while (0)
|
||||
|
||||
typedef struct {
|
||||
@ -191,7 +186,8 @@ static bool _recv_msg(uint8_t iface_num, uint32_t msg_size, uint8_t *buf, const
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool _decode_string(pb_istream_t *stream, const pb_field_t *field, void **arg)
|
||||
/*
|
||||
static bool _decode(pb_istream_t *stream, const pb_field_t *field, void **arg)
|
||||
{
|
||||
pb_byte_t *buf = *arg;
|
||||
memset(buf, 0, 1024);
|
||||
@ -203,9 +199,9 @@ static bool _decode_string(pb_istream_t *stream, const pb_field_t *field, void *
|
||||
}
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
#define MSG_RECV_INIT(TYPE) TYPE msg_recv = TYPE##_init_default
|
||||
#define MSG_RECV_ASSIGN_STRING(FIELD, VALUE) do { msg_recv.FIELD.funcs.decode = &_decode_string; msg_recv.FIELD.arg = VALUE; } while (0)
|
||||
#define MSG_RECV(TYPE) do { _recv_msg(iface_num, msg_size, buf, TYPE##_fields, &msg_recv); } while(0)
|
||||
|
||||
void process_msg_Initialize(uint8_t iface_num, uint32_t msg_size, uint8_t *buf)
|
||||
@ -226,14 +222,11 @@ void process_msg_Initialize(uint8_t iface_num, uint32_t msg_size, uint8_t *buf)
|
||||
|
||||
void process_msg_Ping(uint8_t iface_num, uint32_t msg_size, uint8_t *buf)
|
||||
{
|
||||
char m[1024];
|
||||
|
||||
MSG_RECV_INIT(Ping);
|
||||
MSG_RECV_ASSIGN_STRING(message, m);
|
||||
MSG_RECV(Ping);
|
||||
|
||||
MSG_SEND_INIT(Success);
|
||||
MSG_SEND_ASSIGN_STRING(message, m);
|
||||
MSG_SEND_ASSIGN_STRING(message, msg_recv.message);
|
||||
MSG_SEND(Success);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
Features.vendor max_size:33
|
||||
Features.device_id max_size:25
|
||||
Features.language max_size:17
|
||||
Features.label max_size:33
|
||||
Features.revision max_size:20
|
||||
Features.bootloader_hash max_size:32
|
||||
|
||||
Ping.message max_size:256
|
||||
|
||||
Success.message max_size:256
|
||||
|
||||
Failure.message max_size:256
|
||||
|
||||
ButtonRequest.data max_size:256
|
||||
|
||||
FirmwareUpload.hash max_size:32
|
@ -8,12 +8,6 @@
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
const InputScriptType GetAddress_script_type_default = InputScriptType_SPENDADDRESS;
|
||||
const uint32_t ResetDevice_strength_default = 256u;
|
||||
const uint32_t SignTx_version_default = 1u;
|
||||
const uint32_t SignTx_lock_time_default = 0u;
|
||||
const uint32_t SimpleSignTx_version_default = 1u;
|
||||
const uint32_t SimpleSignTx_lock_time_default = 0u;
|
||||
|
||||
|
||||
const pb_field_t Initialize_fields[1] = {
|
||||
@ -24,21 +18,20 @@ const pb_field_t GetFeatures_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t Features_fields[19] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, Features, vendor, vendor, 0),
|
||||
const pb_field_t Features_fields[18] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, Features, vendor, vendor, 0),
|
||||
PB_FIELD( 2, UINT32 , OPTIONAL, STATIC , OTHER, Features, major_version, vendor, 0),
|
||||
PB_FIELD( 3, UINT32 , OPTIONAL, STATIC , OTHER, Features, minor_version, major_version, 0),
|
||||
PB_FIELD( 4, UINT32 , OPTIONAL, STATIC , OTHER, Features, patch_version, minor_version, 0),
|
||||
PB_FIELD( 5, BOOL , OPTIONAL, STATIC , OTHER, Features, bootloader_mode, patch_version, 0),
|
||||
PB_FIELD( 6, STRING , OPTIONAL, CALLBACK, OTHER, Features, device_id, bootloader_mode, 0),
|
||||
PB_FIELD( 6, STRING , OPTIONAL, STATIC , OTHER, Features, device_id, bootloader_mode, 0),
|
||||
PB_FIELD( 7, BOOL , OPTIONAL, STATIC , OTHER, Features, pin_protection, device_id, 0),
|
||||
PB_FIELD( 8, BOOL , OPTIONAL, STATIC , OTHER, Features, passphrase_protection, pin_protection, 0),
|
||||
PB_FIELD( 9, STRING , OPTIONAL, CALLBACK, OTHER, Features, language, passphrase_protection, 0),
|
||||
PB_FIELD( 10, STRING , OPTIONAL, CALLBACK, OTHER, Features, label, language, 0),
|
||||
PB_FIELD( 11, MESSAGE , REPEATED, CALLBACK, OTHER, Features, coins, label, &CoinType_fields),
|
||||
PB_FIELD( 12, BOOL , OPTIONAL, STATIC , OTHER, Features, initialized, coins, 0),
|
||||
PB_FIELD( 13, BYTES , OPTIONAL, CALLBACK, OTHER, Features, revision, initialized, 0),
|
||||
PB_FIELD( 14, BYTES , OPTIONAL, CALLBACK, OTHER, Features, bootloader_hash, revision, 0),
|
||||
PB_FIELD( 9, STRING , OPTIONAL, STATIC , OTHER, Features, language, passphrase_protection, 0),
|
||||
PB_FIELD( 10, STRING , OPTIONAL, STATIC , OTHER, Features, label, language, 0),
|
||||
PB_FIELD( 12, BOOL , OPTIONAL, STATIC , OTHER, Features, initialized, label, 0),
|
||||
PB_FIELD( 13, BYTES , OPTIONAL, STATIC , OTHER, Features, revision, initialized, 0),
|
||||
PB_FIELD( 14, BYTES , OPTIONAL, STATIC , OTHER, Features, bootloader_hash, revision, 0),
|
||||
PB_FIELD( 15, BOOL , OPTIONAL, STATIC , OTHER, Features, imported, bootloader_hash, 0),
|
||||
PB_FIELD( 16, BOOL , OPTIONAL, STATIC , OTHER, Features, pin_cached, imported, 0),
|
||||
PB_FIELD( 17, BOOL , OPTIONAL, STATIC , OTHER, Features, passphrase_cached, pin_cached, 0),
|
||||
@ -46,25 +39,8 @@ const pb_field_t Features_fields[19] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t ClearSession_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t ApplySettings_fields[5] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, ApplySettings, language, language, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, ApplySettings, label, language, 0),
|
||||
PB_FIELD( 3, BOOL , OPTIONAL, STATIC , OTHER, ApplySettings, use_passphrase, label, 0),
|
||||
PB_FIELD( 4, BYTES , OPTIONAL, CALLBACK, OTHER, ApplySettings, homescreen, use_passphrase, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t ChangePin_fields[2] = {
|
||||
PB_FIELD( 1, BOOL , OPTIONAL, STATIC , FIRST, ChangePin, remove, remove, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t Ping_fields[5] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, Ping, message, message, 0),
|
||||
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, Ping, message, message, 0),
|
||||
PB_FIELD( 2, BOOL , OPTIONAL, STATIC , OTHER, Ping, button_protection, message, 0),
|
||||
PB_FIELD( 3, BOOL , OPTIONAL, STATIC , OTHER, Ping, pin_protection, button_protection, 0),
|
||||
PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, Ping, passphrase_protection, pin_protection, 0),
|
||||
@ -72,19 +48,19 @@ const pb_field_t Ping_fields[5] = {
|
||||
};
|
||||
|
||||
const pb_field_t Success_fields[2] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, Success, message, message, 0),
|
||||
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, Success, message, message, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t Failure_fields[3] = {
|
||||
PB_FIELD( 1, ENUM , OPTIONAL, STATIC , FIRST, Failure, code, code, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, Failure, message, code, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, STATIC , OTHER, Failure, message, code, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t ButtonRequest_fields[3] = {
|
||||
PB_FIELD( 1, ENUM , OPTIONAL, STATIC , FIRST, ButtonRequest, code, code, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, ButtonRequest, data, code, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, STATIC , OTHER, ButtonRequest, data, code, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
@ -92,304 +68,6 @@ const pb_field_t ButtonAck_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t PinMatrixRequest_fields[2] = {
|
||||
PB_FIELD( 1, ENUM , OPTIONAL, STATIC , FIRST, PinMatrixRequest, type, type, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t PinMatrixAck_fields[2] = {
|
||||
PB_FIELD( 1, STRING , REQUIRED, CALLBACK, FIRST, PinMatrixAck, pin, pin, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t Cancel_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t PassphraseRequest_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t PassphraseAck_fields[2] = {
|
||||
PB_FIELD( 1, STRING , REQUIRED, CALLBACK, FIRST, PassphraseAck, passphrase, passphrase, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t GetEntropy_fields[2] = {
|
||||
PB_FIELD( 1, UINT32 , REQUIRED, STATIC , FIRST, GetEntropy, size, size, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t Entropy_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , REQUIRED, CALLBACK, FIRST, Entropy, entropy, entropy, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t GetPublicKey_fields[5] = {
|
||||
PB_FIELD( 1, UINT32 , REPEATED, CALLBACK, FIRST, GetPublicKey, address_n, address_n, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, GetPublicKey, ecdsa_curve_name, address_n, 0),
|
||||
PB_FIELD( 3, BOOL , OPTIONAL, STATIC , OTHER, GetPublicKey, show_display, ecdsa_curve_name, 0),
|
||||
PB_FIELD( 4, STRING , OPTIONAL, CALLBACK, OTHER, GetPublicKey, coin_name, show_display, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t PublicKey_fields[3] = {
|
||||
PB_FIELD( 1, MESSAGE , REQUIRED, STATIC , FIRST, PublicKey, node, node, &HDNodeType_fields),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, PublicKey, xpub, node, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t GetAddress_fields[6] = {
|
||||
PB_FIELD( 1, UINT32 , REPEATED, CALLBACK, FIRST, GetAddress, address_n, address_n, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, GetAddress, coin_name, address_n, 0),
|
||||
PB_FIELD( 3, BOOL , OPTIONAL, STATIC , OTHER, GetAddress, show_display, coin_name, 0),
|
||||
PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, GetAddress, multisig, show_display, &MultisigRedeemScriptType_fields),
|
||||
PB_FIELD( 5, ENUM , OPTIONAL, STATIC , OTHER, GetAddress, script_type, multisig, &GetAddress_script_type_default),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t EthereumGetAddress_fields[3] = {
|
||||
PB_FIELD( 1, UINT32 , REPEATED, CALLBACK, FIRST, EthereumGetAddress, address_n, address_n, 0),
|
||||
PB_FIELD( 2, BOOL , OPTIONAL, STATIC , OTHER, EthereumGetAddress, show_display, address_n, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t Address_fields[2] = {
|
||||
PB_FIELD( 1, STRING , REQUIRED, CALLBACK, FIRST, Address, address, address, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t EthereumAddress_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , REQUIRED, CALLBACK, FIRST, EthereumAddress, address, address, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t WipeDevice_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t LoadDevice_fields[9] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, LoadDevice, mnemonic, mnemonic, 0),
|
||||
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, LoadDevice, node, mnemonic, &HDNodeType_fields),
|
||||
PB_FIELD( 3, STRING , OPTIONAL, CALLBACK, OTHER, LoadDevice, pin, node, 0),
|
||||
PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, LoadDevice, passphrase_protection, pin, 0),
|
||||
PB_FIELD( 5, STRING , OPTIONAL, CALLBACK, OTHER, LoadDevice, language, passphrase_protection, 0),
|
||||
PB_FIELD( 6, STRING , OPTIONAL, CALLBACK, OTHER, LoadDevice, label, language, 0),
|
||||
PB_FIELD( 7, BOOL , OPTIONAL, STATIC , OTHER, LoadDevice, skip_checksum, label, 0),
|
||||
PB_FIELD( 8, UINT32 , OPTIONAL, STATIC , OTHER, LoadDevice, u2f_counter, skip_checksum, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t ResetDevice_fields[8] = {
|
||||
PB_FIELD( 1, BOOL , OPTIONAL, STATIC , FIRST, ResetDevice, display_random, display_random, 0),
|
||||
PB_FIELD( 2, UINT32 , OPTIONAL, STATIC , OTHER, ResetDevice, strength, display_random, &ResetDevice_strength_default),
|
||||
PB_FIELD( 3, BOOL , OPTIONAL, STATIC , OTHER, ResetDevice, passphrase_protection, strength, 0),
|
||||
PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, ResetDevice, pin_protection, passphrase_protection, 0),
|
||||
PB_FIELD( 5, STRING , OPTIONAL, CALLBACK, OTHER, ResetDevice, language, pin_protection, 0),
|
||||
PB_FIELD( 6, STRING , OPTIONAL, CALLBACK, OTHER, ResetDevice, label, language, 0),
|
||||
PB_FIELD( 7, UINT32 , OPTIONAL, STATIC , OTHER, ResetDevice, u2f_counter, label, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t EntropyRequest_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t EntropyAck_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, EntropyAck, entropy, entropy, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t RecoveryDevice_fields[9] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, RecoveryDevice, word_count, word_count, 0),
|
||||
PB_FIELD( 2, BOOL , OPTIONAL, STATIC , OTHER, RecoveryDevice, passphrase_protection, word_count, 0),
|
||||
PB_FIELD( 3, BOOL , OPTIONAL, STATIC , OTHER, RecoveryDevice, pin_protection, passphrase_protection, 0),
|
||||
PB_FIELD( 4, STRING , OPTIONAL, CALLBACK, OTHER, RecoveryDevice, language, pin_protection, 0),
|
||||
PB_FIELD( 5, STRING , OPTIONAL, CALLBACK, OTHER, RecoveryDevice, label, language, 0),
|
||||
PB_FIELD( 6, BOOL , OPTIONAL, STATIC , OTHER, RecoveryDevice, enforce_wordlist, label, 0),
|
||||
PB_FIELD( 8, UINT32 , OPTIONAL, STATIC , OTHER, RecoveryDevice, type, enforce_wordlist, 0),
|
||||
PB_FIELD( 9, UINT32 , OPTIONAL, STATIC , OTHER, RecoveryDevice, u2f_counter, type, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t WordRequest_fields[2] = {
|
||||
PB_FIELD( 1, ENUM , OPTIONAL, STATIC , FIRST, WordRequest, type, type, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t WordAck_fields[2] = {
|
||||
PB_FIELD( 1, STRING , REQUIRED, CALLBACK, FIRST, WordAck, word, word, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t SignMessage_fields[4] = {
|
||||
PB_FIELD( 1, UINT32 , REPEATED, CALLBACK, FIRST, SignMessage, address_n, address_n, 0),
|
||||
PB_FIELD( 2, BYTES , REQUIRED, CALLBACK, OTHER, SignMessage, message, address_n, 0),
|
||||
PB_FIELD( 3, STRING , OPTIONAL, CALLBACK, OTHER, SignMessage, coin_name, message, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t VerifyMessage_fields[5] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, VerifyMessage, address, address, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, VerifyMessage, signature, address, 0),
|
||||
PB_FIELD( 3, BYTES , OPTIONAL, CALLBACK, OTHER, VerifyMessage, message, signature, 0),
|
||||
PB_FIELD( 4, STRING , OPTIONAL, CALLBACK, OTHER, VerifyMessage, coin_name, message, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t MessageSignature_fields[3] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, MessageSignature, address, address, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, MessageSignature, signature, address, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t EncryptMessage_fields[6] = {
|
||||
PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, EncryptMessage, pubkey, pubkey, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, EncryptMessage, message, pubkey, 0),
|
||||
PB_FIELD( 3, BOOL , OPTIONAL, STATIC , OTHER, EncryptMessage, display_only, message, 0),
|
||||
PB_FIELD( 4, UINT32 , REPEATED, CALLBACK, OTHER, EncryptMessage, address_n, display_only, 0),
|
||||
PB_FIELD( 5, STRING , OPTIONAL, CALLBACK, OTHER, EncryptMessage, coin_name, address_n, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t EncryptedMessage_fields[4] = {
|
||||
PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, EncryptedMessage, nonce, nonce, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, EncryptedMessage, message, nonce, 0),
|
||||
PB_FIELD( 3, BYTES , OPTIONAL, CALLBACK, OTHER, EncryptedMessage, hmac, message, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DecryptMessage_fields[5] = {
|
||||
PB_FIELD( 1, UINT32 , REPEATED, CALLBACK, FIRST, DecryptMessage, address_n, address_n, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, DecryptMessage, nonce, address_n, 0),
|
||||
PB_FIELD( 3, BYTES , OPTIONAL, CALLBACK, OTHER, DecryptMessage, message, nonce, 0),
|
||||
PB_FIELD( 4, BYTES , OPTIONAL, CALLBACK, OTHER, DecryptMessage, hmac, message, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DecryptedMessage_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, DecryptedMessage, message, message, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, DecryptedMessage, address, message, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t CipherKeyValue_fields[8] = {
|
||||
PB_FIELD( 1, UINT32 , REPEATED, CALLBACK, FIRST, CipherKeyValue, address_n, address_n, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, CipherKeyValue, key, address_n, 0),
|
||||
PB_FIELD( 3, BYTES , OPTIONAL, CALLBACK, OTHER, CipherKeyValue, value, key, 0),
|
||||
PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, CipherKeyValue, encrypt, value, 0),
|
||||
PB_FIELD( 5, BOOL , OPTIONAL, STATIC , OTHER, CipherKeyValue, ask_on_encrypt, encrypt, 0),
|
||||
PB_FIELD( 6, BOOL , OPTIONAL, STATIC , OTHER, CipherKeyValue, ask_on_decrypt, ask_on_encrypt, 0),
|
||||
PB_FIELD( 7, BYTES , OPTIONAL, CALLBACK, OTHER, CipherKeyValue, iv, ask_on_decrypt, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t CipheredKeyValue_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, CipheredKeyValue, value, value, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t EstimateTxSize_fields[4] = {
|
||||
PB_FIELD( 1, UINT32 , REQUIRED, STATIC , FIRST, EstimateTxSize, outputs_count, outputs_count, 0),
|
||||
PB_FIELD( 2, UINT32 , REQUIRED, STATIC , OTHER, EstimateTxSize, inputs_count, outputs_count, 0),
|
||||
PB_FIELD( 3, STRING , OPTIONAL, CALLBACK, OTHER, EstimateTxSize, coin_name, inputs_count, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t TxSize_fields[2] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, TxSize, tx_size, tx_size, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t SignTx_fields[6] = {
|
||||
PB_FIELD( 1, UINT32 , REQUIRED, STATIC , FIRST, SignTx, outputs_count, outputs_count, 0),
|
||||
PB_FIELD( 2, UINT32 , REQUIRED, STATIC , OTHER, SignTx, inputs_count, outputs_count, 0),
|
||||
PB_FIELD( 3, STRING , OPTIONAL, CALLBACK, OTHER, SignTx, coin_name, inputs_count, 0),
|
||||
PB_FIELD( 4, UINT32 , OPTIONAL, STATIC , OTHER, SignTx, version, coin_name, &SignTx_version_default),
|
||||
PB_FIELD( 5, UINT32 , OPTIONAL, STATIC , OTHER, SignTx, lock_time, version, &SignTx_lock_time_default),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t SimpleSignTx_fields[7] = {
|
||||
PB_FIELD( 1, MESSAGE , REPEATED, CALLBACK, FIRST, SimpleSignTx, inputs, inputs, &TxInputType_fields),
|
||||
PB_FIELD( 2, MESSAGE , REPEATED, CALLBACK, OTHER, SimpleSignTx, outputs, inputs, &TxOutputType_fields),
|
||||
PB_FIELD( 3, MESSAGE , REPEATED, CALLBACK, OTHER, SimpleSignTx, transactions, outputs, &TransactionType_fields),
|
||||
PB_FIELD( 4, STRING , OPTIONAL, CALLBACK, OTHER, SimpleSignTx, coin_name, transactions, 0),
|
||||
PB_FIELD( 5, UINT32 , OPTIONAL, STATIC , OTHER, SimpleSignTx, version, coin_name, &SimpleSignTx_version_default),
|
||||
PB_FIELD( 6, UINT32 , OPTIONAL, STATIC , OTHER, SimpleSignTx, lock_time, version, &SimpleSignTx_lock_time_default),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t TxRequest_fields[4] = {
|
||||
PB_FIELD( 1, ENUM , OPTIONAL, STATIC , FIRST, TxRequest, request_type, request_type, 0),
|
||||
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, TxRequest, details, request_type, &TxRequestDetailsType_fields),
|
||||
PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, TxRequest, serialized, details, &TxRequestSerializedType_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t TxAck_fields[2] = {
|
||||
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, TxAck, tx, tx, &TransactionType_fields),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t EthereumSignTx_fields[10] = {
|
||||
PB_FIELD( 1, UINT32 , REPEATED, CALLBACK, FIRST, EthereumSignTx, address_n, address_n, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, nonce, address_n, 0),
|
||||
PB_FIELD( 3, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, gas_price, nonce, 0),
|
||||
PB_FIELD( 4, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, gas_limit, gas_price, 0),
|
||||
PB_FIELD( 5, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, to, gas_limit, 0),
|
||||
PB_FIELD( 6, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, value, to, 0),
|
||||
PB_FIELD( 7, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, data_initial_chunk, value, 0),
|
||||
PB_FIELD( 8, UINT32 , OPTIONAL, STATIC , OTHER, EthereumSignTx, data_length, data_initial_chunk, 0),
|
||||
PB_FIELD( 9, UINT32 , OPTIONAL, STATIC , OTHER, EthereumSignTx, chain_id, data_length, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t EthereumTxRequest_fields[5] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, EthereumTxRequest, data_length, data_length, 0),
|
||||
PB_FIELD( 2, UINT32 , OPTIONAL, STATIC , OTHER, EthereumTxRequest, signature_v, data_length, 0),
|
||||
PB_FIELD( 3, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumTxRequest, signature_r, signature_v, 0),
|
||||
PB_FIELD( 4, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumTxRequest, signature_s, signature_r, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t EthereumTxAck_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, EthereumTxAck, data_chunk, data_chunk, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t SignIdentity_fields[5] = {
|
||||
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, SignIdentity, identity, identity, &IdentityType_fields),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, SignIdentity, challenge_hidden, identity, 0),
|
||||
PB_FIELD( 3, STRING , OPTIONAL, CALLBACK, OTHER, SignIdentity, challenge_visual, challenge_hidden, 0),
|
||||
PB_FIELD( 4, STRING , OPTIONAL, CALLBACK, OTHER, SignIdentity, ecdsa_curve_name, challenge_visual, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t SignedIdentity_fields[4] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, SignedIdentity, address, address, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, SignedIdentity, public_key, address, 0),
|
||||
PB_FIELD( 3, BYTES , OPTIONAL, CALLBACK, OTHER, SignedIdentity, signature, public_key, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t GetECDHSessionKey_fields[4] = {
|
||||
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, GetECDHSessionKey, identity, identity, &IdentityType_fields),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, GetECDHSessionKey, peer_public_key, identity, 0),
|
||||
PB_FIELD( 3, STRING , OPTIONAL, CALLBACK, OTHER, GetECDHSessionKey, ecdsa_curve_name, peer_public_key, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t ECDHSessionKey_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, ECDHSessionKey, session_key, session_key, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t SetU2FCounter_fields[2] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, SetU2FCounter, u2f_counter, u2f_counter, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t FirmwareErase_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
@ -402,90 +80,15 @@ const pb_field_t FirmwareRequest_fields[3] = {
|
||||
|
||||
const pb_field_t FirmwareUpload_fields[3] = {
|
||||
PB_FIELD( 1, BYTES , REQUIRED, CALLBACK, FIRST, FirmwareUpload, payload, payload, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, FirmwareUpload, hash, payload, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DebugLinkDecision_fields[2] = {
|
||||
PB_FIELD( 1, BOOL , REQUIRED, STATIC , FIRST, DebugLinkDecision, yes_no, yes_no, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DebugLinkGetState_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DebugLinkState_fields[11] = {
|
||||
PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, DebugLinkState, layout, layout, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, DebugLinkState, pin, layout, 0),
|
||||
PB_FIELD( 3, STRING , OPTIONAL, CALLBACK, OTHER, DebugLinkState, matrix, pin, 0),
|
||||
PB_FIELD( 4, STRING , OPTIONAL, CALLBACK, OTHER, DebugLinkState, mnemonic, matrix, 0),
|
||||
PB_FIELD( 5, MESSAGE , OPTIONAL, STATIC , OTHER, DebugLinkState, node, mnemonic, &HDNodeType_fields),
|
||||
PB_FIELD( 6, BOOL , OPTIONAL, STATIC , OTHER, DebugLinkState, passphrase_protection, node, 0),
|
||||
PB_FIELD( 7, STRING , OPTIONAL, CALLBACK, OTHER, DebugLinkState, reset_word, passphrase_protection, 0),
|
||||
PB_FIELD( 8, BYTES , OPTIONAL, CALLBACK, OTHER, DebugLinkState, reset_entropy, reset_word, 0),
|
||||
PB_FIELD( 9, STRING , OPTIONAL, CALLBACK, OTHER, DebugLinkState, recovery_fake_word, reset_entropy, 0),
|
||||
PB_FIELD( 10, UINT32 , OPTIONAL, STATIC , OTHER, DebugLinkState, recovery_word_pos, recovery_fake_word, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DebugLinkStop_fields[1] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DebugLinkLog_fields[4] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, DebugLinkLog, level, level, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, DebugLinkLog, bucket, level, 0),
|
||||
PB_FIELD( 3, STRING , OPTIONAL, CALLBACK, OTHER, DebugLinkLog, text, bucket, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DebugLinkMemoryRead_fields[3] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, DebugLinkMemoryRead, address, address, 0),
|
||||
PB_FIELD( 2, UINT32 , OPTIONAL, STATIC , OTHER, DebugLinkMemoryRead, length, address, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DebugLinkMemory_fields[2] = {
|
||||
PB_FIELD( 1, BYTES , OPTIONAL, CALLBACK, FIRST, DebugLinkMemory, memory, memory, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DebugLinkMemoryWrite_fields[4] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, DebugLinkMemoryWrite, address, address, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, DebugLinkMemoryWrite, memory, address, 0),
|
||||
PB_FIELD( 3, BOOL , OPTIONAL, STATIC , OTHER, DebugLinkMemoryWrite, flash, memory, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t DebugLinkFlashErase_fields[2] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, DebugLinkFlashErase, sector, sector, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, STATIC , OTHER, FirmwareUpload, hash, payload, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((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_SimpleSignTx_TxRequest_TxAck_EthereumSignTx_EthereumTxRequest_EthereumTxAck_SignIdentity_SignedIdentity_GetECDHSessionKey_ECDHSessionKey_SetU2FCounter_FirmwareErase_FirmwareRequest_FirmwareUpload_DebugLinkDecision_DebugLinkGetState_DebugLinkState_DebugLinkStop_DebugLinkLog_DebugLinkMemoryRead_DebugLinkMemory_DebugLinkMemoryWrite_DebugLinkFlashErase)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(PublicKey, node) < 256 && pb_membersize(GetAddress, multisig) < 256 && pb_membersize(LoadDevice, node) < 256 && pb_membersize(TxRequest, details) < 256 && pb_membersize(TxRequest, serialized) < 256 && pb_membersize(TxAck, tx) < 256 && pb_membersize(SignIdentity, identity) < 256 && pb_membersize(GetECDHSessionKey, identity) < 256 && pb_membersize(DebugLinkState, node) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_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_FirmwareRequest_FirmwareUpload_DebugLinkDecision_DebugLinkGetState_DebugLinkState_DebugLinkStop_DebugLinkLog_DebugLinkMemoryRead_DebugLinkMemory_DebugLinkMemoryWrite_DebugLinkFlashErase)
|
||||
#error Field descriptor for ButtonRequest.data is too large. Define PB_FIELD_16BIT to fix this.
|
||||
#endif
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
../../../vendor/trezor-common/protob/messages.proto
|
129
micropython/bootloader/protob/messages.proto
Normal file
129
micropython/bootloader/protob/messages.proto
Normal file
@ -0,0 +1,129 @@
|
||||
import "types.proto";
|
||||
|
||||
/**
|
||||
* Mapping between Trezor wire identifier (uint) and a protobuf message
|
||||
*/
|
||||
enum MessageType {
|
||||
MessageType_Initialize = 0;
|
||||
MessageType_Ping = 1;
|
||||
MessageType_Success = 2;
|
||||
MessageType_Failure = 3;
|
||||
MessageType_FirmwareErase = 6;
|
||||
MessageType_FirmwareUpload = 7;
|
||||
MessageType_FirmwareRequest = 8;
|
||||
MessageType_Features = 17;
|
||||
MessageType_ButtonRequest = 26;
|
||||
MessageType_ButtonAck = 27;
|
||||
MessageType_GetFeatures = 55;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Reset device to default state and ask for device details
|
||||
* @next Features
|
||||
*/
|
||||
message Initialize {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Ask for device details (no device reset)
|
||||
* @next Features
|
||||
*/
|
||||
message GetFeatures {
|
||||
}
|
||||
|
||||
/**
|
||||
* Response: Reports various information about the device
|
||||
* @prev Initialize
|
||||
* @prev GetFeatures
|
||||
*/
|
||||
message Features {
|
||||
optional string vendor = 1; // name of the manufacturer, e.g. "bitcointrezor.com"
|
||||
optional uint32 major_version = 2; // major version of the device, e.g. 1
|
||||
optional uint32 minor_version = 3; // minor version of the device, e.g. 0
|
||||
optional uint32 patch_version = 4; // patch version of the device, e.g. 0
|
||||
optional bool bootloader_mode = 5; // is device in bootloader mode?
|
||||
optional string device_id = 6; // device's unique identifier
|
||||
optional bool pin_protection = 7; // is device protected by PIN?
|
||||
optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase?
|
||||
optional string language = 9; // device language
|
||||
optional string label = 10; // device description label
|
||||
// repeated CoinType coins = 11; // supported coins
|
||||
optional bool initialized = 12; // does device contain seed?
|
||||
optional bytes revision = 13; // SCM revision of firmware
|
||||
optional bytes bootloader_hash = 14; // hash of the bootloader
|
||||
optional bool imported = 15; // was storage imported from an external source?
|
||||
optional bool pin_cached = 16; // is PIN already cached in session?
|
||||
optional bool passphrase_cached = 17; // is passphrase already cached in session?
|
||||
optional bool firmware_present = 18; // is valid firmware loaded?
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Test if the device is alive, device sends back the message in Success response
|
||||
* @next Success
|
||||
*/
|
||||
message Ping {
|
||||
optional string message = 1; // message to send back in Success message
|
||||
optional bool button_protection = 2; // ask for button press
|
||||
optional bool pin_protection = 3; // ask for PIN if set in device
|
||||
optional bool passphrase_protection = 4; // ask for passphrase if set in device
|
||||
}
|
||||
|
||||
/**
|
||||
* Response: Success of the previous request
|
||||
*/
|
||||
message Success {
|
||||
optional string message = 1; // human readable description of action or request-specific payload
|
||||
}
|
||||
|
||||
/**
|
||||
* Response: Failure of the previous request
|
||||
*/
|
||||
message Failure {
|
||||
optional FailureType code = 1; // computer-readable definition of the error state
|
||||
optional string message = 2; // human-readable message of the error state
|
||||
}
|
||||
|
||||
/**
|
||||
* Response: Device is waiting for HW button press.
|
||||
* @next ButtonAck
|
||||
* @next Cancel
|
||||
*/
|
||||
message ButtonRequest {
|
||||
optional ButtonRequestType code = 1;
|
||||
optional string data = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Computer agrees to wait for HW button press
|
||||
* @prev ButtonRequest
|
||||
*/
|
||||
message ButtonAck {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Ask device to erase its firmware (so it can be replaced via FirmwareUpload)
|
||||
* @next Success
|
||||
* @next FirmwareRequest
|
||||
* @next Failure
|
||||
*/
|
||||
message FirmwareErase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Response: Ask for firmware chunk
|
||||
* @next FirmwareUpload
|
||||
*/
|
||||
message FirmwareRequest {
|
||||
optional uint32 offset = 1; // offset of requested firmware chunk
|
||||
optional uint32 length = 2; // length of requested firmware chunk
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Send firmware in binary form to the device
|
||||
* @next Success
|
||||
* @next Failure
|
||||
*/
|
||||
message FirmwareUpload {
|
||||
required bytes payload = 1; // firmware to be loaded into device
|
||||
optional bytes hash = 2; // hash of the payload
|
||||
}
|
@ -8,226 +8,9 @@
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
const uint32_t CoinType_address_type_default = 0u;
|
||||
const uint32_t CoinType_address_type_p2sh_default = 5u;
|
||||
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;
|
||||
|
||||
|
||||
const pb_field_t HDNodeType_fields[7] = {
|
||||
PB_FIELD( 1, UINT32 , REQUIRED, STATIC , FIRST, HDNodeType, depth, depth, 0),
|
||||
PB_FIELD( 2, UINT32 , REQUIRED, STATIC , OTHER, HDNodeType, fingerprint, depth, 0),
|
||||
PB_FIELD( 3, UINT32 , REQUIRED, STATIC , OTHER, HDNodeType, child_num, fingerprint, 0),
|
||||
PB_FIELD( 4, BYTES , REQUIRED, CALLBACK, OTHER, HDNodeType, chain_code, child_num, 0),
|
||||
PB_FIELD( 5, BYTES , OPTIONAL, CALLBACK, OTHER, HDNodeType, private_key, chain_code, 0),
|
||||
PB_FIELD( 6, BYTES , OPTIONAL, CALLBACK, OTHER, HDNodeType, public_key, private_key, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t HDNodePathType_fields[3] = {
|
||||
PB_FIELD( 1, MESSAGE , REQUIRED, STATIC , FIRST, HDNodePathType, node, node, &HDNodeType_fields),
|
||||
PB_FIELD( 2, UINT32 , REPEATED, CALLBACK, OTHER, HDNodePathType, address_n, node, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t CoinType_fields[10] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, CoinType, coin_name, coin_name, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, CoinType, coin_shortcut, coin_name, 0),
|
||||
PB_FIELD( 3, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, address_type, coin_shortcut, &CoinType_address_type_default),
|
||||
PB_FIELD( 4, UINT64 , OPTIONAL, STATIC , OTHER, CoinType, maxfee_kb, address_type, 0),
|
||||
PB_FIELD( 5, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, address_type_p2sh, maxfee_kb, &CoinType_address_type_p2sh_default),
|
||||
PB_FIELD( 8, STRING , OPTIONAL, CALLBACK, OTHER, CoinType, signed_message_header, address_type_p2sh, 0),
|
||||
PB_FIELD( 9, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, xpub_magic, signed_message_header, &CoinType_xpub_magic_default),
|
||||
PB_FIELD( 10, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, xprv_magic, xpub_magic, &CoinType_xprv_magic_default),
|
||||
PB_FIELD( 11, BOOL , OPTIONAL, STATIC , OTHER, CoinType, segwit, xprv_magic, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t MultisigRedeemScriptType_fields[4] = {
|
||||
PB_FIELD( 1, MESSAGE , REPEATED, CALLBACK, FIRST, MultisigRedeemScriptType, pubkeys, pubkeys, &HDNodePathType_fields),
|
||||
PB_FIELD( 2, BYTES , REPEATED, CALLBACK, OTHER, MultisigRedeemScriptType, signatures, pubkeys, 0),
|
||||
PB_FIELD( 3, UINT32 , OPTIONAL, STATIC , OTHER, MultisigRedeemScriptType, m, signatures, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t TxInputType_fields[9] = {
|
||||
PB_FIELD( 1, UINT32 , REPEATED, CALLBACK, FIRST, TxInputType, address_n, address_n, 0),
|
||||
PB_FIELD( 2, BYTES , REQUIRED, CALLBACK, OTHER, TxInputType, prev_hash, address_n, 0),
|
||||
PB_FIELD( 3, UINT32 , REQUIRED, STATIC , OTHER, TxInputType, prev_index, prev_hash, 0),
|
||||
PB_FIELD( 4, BYTES , OPTIONAL, CALLBACK, OTHER, TxInputType, script_sig, prev_index, 0),
|
||||
PB_FIELD( 5, UINT32 , OPTIONAL, STATIC , OTHER, TxInputType, sequence, script_sig, &TxInputType_sequence_default),
|
||||
PB_FIELD( 6, UENUM , OPTIONAL, STATIC , OTHER, TxInputType, script_type, sequence, &TxInputType_script_type_default),
|
||||
PB_FIELD( 7, MESSAGE , OPTIONAL, STATIC , OTHER, TxInputType, multisig, script_type, &MultisigRedeemScriptType_fields),
|
||||
PB_FIELD( 8, UINT64 , OPTIONAL, STATIC , OTHER, TxInputType, amount, multisig, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t TxOutputType_fields[7] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, TxOutputType, address, address, 0),
|
||||
PB_FIELD( 2, UINT32 , REPEATED, CALLBACK, OTHER, TxOutputType, address_n, address, 0),
|
||||
PB_FIELD( 3, UINT64 , REQUIRED, STATIC , OTHER, TxOutputType, amount, address_n, 0),
|
||||
PB_FIELD( 4, UENUM , REQUIRED, STATIC , OTHER, TxOutputType, script_type, amount, 0),
|
||||
PB_FIELD( 5, MESSAGE , OPTIONAL, STATIC , OTHER, TxOutputType, multisig, script_type, &MultisigRedeemScriptType_fields),
|
||||
PB_FIELD( 6, BYTES , OPTIONAL, CALLBACK, OTHER, TxOutputType, op_return_data, multisig, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t TxOutputBinType_fields[3] = {
|
||||
PB_FIELD( 1, UINT64 , REQUIRED, STATIC , FIRST, TxOutputBinType, amount, amount, 0),
|
||||
PB_FIELD( 2, BYTES , REQUIRED, CALLBACK, OTHER, TxOutputBinType, script_pubkey, amount, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t TransactionType_fields[10] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, TransactionType, version, version, 0),
|
||||
PB_FIELD( 2, MESSAGE , REPEATED, CALLBACK, OTHER, TransactionType, inputs, version, &TxInputType_fields),
|
||||
PB_FIELD( 3, MESSAGE , REPEATED, CALLBACK, OTHER, TransactionType, bin_outputs, inputs, &TxOutputBinType_fields),
|
||||
PB_FIELD( 4, UINT32 , OPTIONAL, STATIC , OTHER, TransactionType, lock_time, bin_outputs, 0),
|
||||
PB_FIELD( 5, MESSAGE , REPEATED, CALLBACK, OTHER, TransactionType, outputs, lock_time, &TxOutputType_fields),
|
||||
PB_FIELD( 6, UINT32 , OPTIONAL, STATIC , OTHER, TransactionType, inputs_cnt, outputs, 0),
|
||||
PB_FIELD( 7, UINT32 , OPTIONAL, STATIC , OTHER, TransactionType, outputs_cnt, inputs_cnt, 0),
|
||||
PB_FIELD( 8, BYTES , OPTIONAL, CALLBACK, OTHER, TransactionType, extra_data, outputs_cnt, 0),
|
||||
PB_FIELD( 9, UINT32 , OPTIONAL, STATIC , OTHER, TransactionType, extra_data_len, extra_data, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t TxRequestDetailsType_fields[5] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, TxRequestDetailsType, request_index, request_index, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, TxRequestDetailsType, tx_hash, request_index, 0),
|
||||
PB_FIELD( 3, UINT32 , OPTIONAL, STATIC , OTHER, TxRequestDetailsType, extra_data_len, tx_hash, 0),
|
||||
PB_FIELD( 4, UINT32 , OPTIONAL, STATIC , OTHER, TxRequestDetailsType, extra_data_offset, extra_data_len, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t TxRequestSerializedType_fields[4] = {
|
||||
PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, TxRequestSerializedType, signature_index, signature_index, 0),
|
||||
PB_FIELD( 2, BYTES , OPTIONAL, CALLBACK, OTHER, TxRequestSerializedType, signature, signature_index, 0),
|
||||
PB_FIELD( 3, BYTES , OPTIONAL, CALLBACK, OTHER, TxRequestSerializedType, serialized_tx, signature, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t IdentityType_fields[7] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, IdentityType, proto, proto, 0),
|
||||
PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, IdentityType, user, proto, 0),
|
||||
PB_FIELD( 3, STRING , OPTIONAL, CALLBACK, OTHER, IdentityType, host, user, 0),
|
||||
PB_FIELD( 4, STRING , OPTIONAL, CALLBACK, OTHER, IdentityType, port, host, 0),
|
||||
PB_FIELD( 5, STRING , OPTIONAL, CALLBACK, OTHER, IdentityType, path, port, 0),
|
||||
PB_FIELD( 6, UINT32 , OPTIONAL, STATIC , OTHER, IdentityType, index, path, &IdentityType_index_default),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
bool wire_in;
|
||||
} wire_in_struct;
|
||||
|
||||
static const pb_field_t wire_in_field =
|
||||
PB_FIELD(50002, BOOL , OPTEXT, STATIC , FIRST, wire_in_struct, wire_in, wire_in, 0);
|
||||
|
||||
const pb_extension_type_t wire_in = {
|
||||
NULL,
|
||||
NULL,
|
||||
&wire_in_field
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
bool wire_out;
|
||||
} wire_out_struct;
|
||||
|
||||
static const pb_field_t wire_out_field =
|
||||
PB_FIELD(50003, BOOL , OPTEXT, STATIC , FIRST, wire_out_struct, wire_out, wire_out, 0);
|
||||
|
||||
const pb_extension_type_t wire_out = {
|
||||
NULL,
|
||||
NULL,
|
||||
&wire_out_field
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
bool wire_debug_in;
|
||||
} wire_debug_in_struct;
|
||||
|
||||
static const pb_field_t wire_debug_in_field =
|
||||
PB_FIELD(50004, BOOL , OPTEXT, STATIC , FIRST, wire_debug_in_struct, wire_debug_in, wire_debug_in, 0);
|
||||
|
||||
const pb_extension_type_t wire_debug_in = {
|
||||
NULL,
|
||||
NULL,
|
||||
&wire_debug_in_field
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
bool wire_debug_out;
|
||||
} wire_debug_out_struct;
|
||||
|
||||
static const pb_field_t wire_debug_out_field =
|
||||
PB_FIELD(50005, BOOL , OPTEXT, STATIC , FIRST, wire_debug_out_struct, wire_debug_out, wire_debug_out, 0);
|
||||
|
||||
const pb_extension_type_t wire_debug_out = {
|
||||
NULL,
|
||||
NULL,
|
||||
&wire_debug_out_field
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
bool wire_tiny;
|
||||
} wire_tiny_struct;
|
||||
|
||||
static const pb_field_t wire_tiny_field =
|
||||
PB_FIELD(50006, BOOL , OPTEXT, STATIC , FIRST, wire_tiny_struct, wire_tiny, wire_tiny, 0);
|
||||
|
||||
const pb_extension_type_t wire_tiny = {
|
||||
NULL,
|
||||
NULL,
|
||||
&wire_tiny_field
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
bool wire_bootloader;
|
||||
} wire_bootloader_struct;
|
||||
|
||||
static const pb_field_t wire_bootloader_field =
|
||||
PB_FIELD(50007, BOOL , OPTEXT, STATIC , FIRST, wire_bootloader_struct, wire_bootloader, wire_bootloader, 0);
|
||||
|
||||
const pb_extension_type_t wire_bootloader = {
|
||||
NULL,
|
||||
NULL,
|
||||
&wire_bootloader_field
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Check that field information fits in pb_field_t */
|
||||
#if !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
||||
* field descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(HDNodePathType, node) < 65536 && pb_membersize(TxInputType, multisig) < 65536 && pb_membersize(TxOutputType, multisig) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_HDNodeType_HDNodePathType_CoinType_MultisigRedeemScriptType_TxInputType_TxOutputType_TxOutputBinType_TransactionType_TxRequestDetailsType_TxRequestSerializedType_IdentityType)
|
||||
#endif
|
||||
|
||||
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
||||
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
||||
* compile-time option. You can do that in pb.h or on compiler command line.
|
||||
*
|
||||
* The reason you need to do this is that some of your messages contain tag
|
||||
* numbers or field sizes that are larger than what can fit in the default
|
||||
* 8 bit descriptors.
|
||||
*/
|
||||
PB_STATIC_ASSERT((pb_membersize(HDNodePathType, node) < 256 && pb_membersize(TxInputType, multisig) < 256 && pb_membersize(TxOutputType, multisig) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_HDNodeType_HDNodePathType_CoinType_MultisigRedeemScriptType_TxInputType_TxOutputType_TxOutputBinType_TransactionType_TxRequestDetailsType_TxRequestSerializedType_IdentityType)
|
||||
#endif
|
||||
|
||||
|
||||
/* @@protoc_insertion_point(eof) */
|
||||
|
@ -33,40 +33,6 @@ typedef enum _FailureType {
|
||||
#define _FailureType_MAX FailureType_Failure_FirmwareError
|
||||
#define _FailureType_ARRAYSIZE ((FailureType)(FailureType_Failure_FirmwareError+1))
|
||||
|
||||
typedef enum _OutputScriptType {
|
||||
OutputScriptType_PAYTOADDRESS = 0,
|
||||
OutputScriptType_PAYTOSCRIPTHASH = 1,
|
||||
OutputScriptType_PAYTOMULTISIG = 2,
|
||||
OutputScriptType_PAYTOOPRETURN = 3,
|
||||
OutputScriptType_PAYTOWITNESS = 4,
|
||||
OutputScriptType_PAYTOP2SHWITNESS = 5
|
||||
} OutputScriptType;
|
||||
#define _OutputScriptType_MIN OutputScriptType_PAYTOADDRESS
|
||||
#define _OutputScriptType_MAX OutputScriptType_PAYTOP2SHWITNESS
|
||||
#define _OutputScriptType_ARRAYSIZE ((OutputScriptType)(OutputScriptType_PAYTOP2SHWITNESS+1))
|
||||
|
||||
typedef enum _InputScriptType {
|
||||
InputScriptType_SPENDADDRESS = 0,
|
||||
InputScriptType_SPENDMULTISIG = 1,
|
||||
InputScriptType_EXTERNAL = 2,
|
||||
InputScriptType_SPENDWITNESS = 3,
|
||||
InputScriptType_SPENDP2SHWITNESS = 4
|
||||
} InputScriptType;
|
||||
#define _InputScriptType_MIN InputScriptType_SPENDADDRESS
|
||||
#define _InputScriptType_MAX InputScriptType_SPENDP2SHWITNESS
|
||||
#define _InputScriptType_ARRAYSIZE ((InputScriptType)(InputScriptType_SPENDP2SHWITNESS+1))
|
||||
|
||||
typedef enum _RequestType {
|
||||
RequestType_TXINPUT = 0,
|
||||
RequestType_TXOUTPUT = 1,
|
||||
RequestType_TXMETA = 2,
|
||||
RequestType_TXFINISHED = 3,
|
||||
RequestType_TXEXTRADATA = 4
|
||||
} RequestType;
|
||||
#define _RequestType_MIN RequestType_TXINPUT
|
||||
#define _RequestType_MAX RequestType_TXEXTRADATA
|
||||
#define _RequestType_ARRAYSIZE ((RequestType)(RequestType_TXEXTRADATA+1))
|
||||
|
||||
typedef enum _ButtonRequestType {
|
||||
ButtonRequestType_ButtonRequest_Other = 1,
|
||||
ButtonRequestType_ButtonRequest_FeeOverThreshold = 2,
|
||||
@ -84,298 +50,6 @@ typedef enum _ButtonRequestType {
|
||||
#define _ButtonRequestType_MAX ButtonRequestType_ButtonRequest_PublicKey
|
||||
#define _ButtonRequestType_ARRAYSIZE ((ButtonRequestType)(ButtonRequestType_ButtonRequest_PublicKey+1))
|
||||
|
||||
typedef enum _PinMatrixRequestType {
|
||||
PinMatrixRequestType_PinMatrixRequestType_Current = 1,
|
||||
PinMatrixRequestType_PinMatrixRequestType_NewFirst = 2,
|
||||
PinMatrixRequestType_PinMatrixRequestType_NewSecond = 3
|
||||
} PinMatrixRequestType;
|
||||
#define _PinMatrixRequestType_MIN PinMatrixRequestType_PinMatrixRequestType_Current
|
||||
#define _PinMatrixRequestType_MAX PinMatrixRequestType_PinMatrixRequestType_NewSecond
|
||||
#define _PinMatrixRequestType_ARRAYSIZE ((PinMatrixRequestType)(PinMatrixRequestType_PinMatrixRequestType_NewSecond+1))
|
||||
|
||||
typedef enum _RecoveryDeviceType {
|
||||
RecoveryDeviceType_RecoveryDeviceType_ScrambledWords = 0,
|
||||
RecoveryDeviceType_RecoveryDeviceType_Matrix = 1
|
||||
} RecoveryDeviceType;
|
||||
#define _RecoveryDeviceType_MIN RecoveryDeviceType_RecoveryDeviceType_ScrambledWords
|
||||
#define _RecoveryDeviceType_MAX RecoveryDeviceType_RecoveryDeviceType_Matrix
|
||||
#define _RecoveryDeviceType_ARRAYSIZE ((RecoveryDeviceType)(RecoveryDeviceType_RecoveryDeviceType_Matrix+1))
|
||||
|
||||
typedef enum _WordRequestType {
|
||||
WordRequestType_WordRequestType_Plain = 0,
|
||||
WordRequestType_WordRequestType_Matrix9 = 1,
|
||||
WordRequestType_WordRequestType_Matrix6 = 2
|
||||
} WordRequestType;
|
||||
#define _WordRequestType_MIN WordRequestType_WordRequestType_Plain
|
||||
#define _WordRequestType_MAX WordRequestType_WordRequestType_Matrix6
|
||||
#define _WordRequestType_ARRAYSIZE ((WordRequestType)(WordRequestType_WordRequestType_Matrix6+1))
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _CoinType {
|
||||
pb_callback_t coin_name;
|
||||
pb_callback_t coin_shortcut;
|
||||
bool has_address_type;
|
||||
uint32_t address_type;
|
||||
bool has_maxfee_kb;
|
||||
uint64_t maxfee_kb;
|
||||
bool has_address_type_p2sh;
|
||||
uint32_t address_type_p2sh;
|
||||
pb_callback_t signed_message_header;
|
||||
bool has_xpub_magic;
|
||||
uint32_t xpub_magic;
|
||||
bool has_xprv_magic;
|
||||
uint32_t xprv_magic;
|
||||
bool has_segwit;
|
||||
bool segwit;
|
||||
/* @@protoc_insertion_point(struct:CoinType) */
|
||||
} CoinType;
|
||||
|
||||
typedef struct _HDNodeType {
|
||||
uint32_t depth;
|
||||
uint32_t fingerprint;
|
||||
uint32_t child_num;
|
||||
pb_callback_t chain_code;
|
||||
pb_callback_t private_key;
|
||||
pb_callback_t public_key;
|
||||
/* @@protoc_insertion_point(struct:HDNodeType) */
|
||||
} HDNodeType;
|
||||
|
||||
typedef struct _IdentityType {
|
||||
pb_callback_t proto;
|
||||
pb_callback_t user;
|
||||
pb_callback_t host;
|
||||
pb_callback_t port;
|
||||
pb_callback_t path;
|
||||
bool has_index;
|
||||
uint32_t index;
|
||||
/* @@protoc_insertion_point(struct:IdentityType) */
|
||||
} IdentityType;
|
||||
|
||||
typedef struct _MultisigRedeemScriptType {
|
||||
pb_callback_t pubkeys;
|
||||
pb_callback_t signatures;
|
||||
bool has_m;
|
||||
uint32_t m;
|
||||
/* @@protoc_insertion_point(struct:MultisigRedeemScriptType) */
|
||||
} MultisigRedeemScriptType;
|
||||
|
||||
typedef struct _TransactionType {
|
||||
bool has_version;
|
||||
uint32_t version;
|
||||
pb_callback_t inputs;
|
||||
pb_callback_t bin_outputs;
|
||||
bool has_lock_time;
|
||||
uint32_t lock_time;
|
||||
pb_callback_t outputs;
|
||||
bool has_inputs_cnt;
|
||||
uint32_t inputs_cnt;
|
||||
bool has_outputs_cnt;
|
||||
uint32_t outputs_cnt;
|
||||
pb_callback_t extra_data;
|
||||
bool has_extra_data_len;
|
||||
uint32_t extra_data_len;
|
||||
/* @@protoc_insertion_point(struct:TransactionType) */
|
||||
} TransactionType;
|
||||
|
||||
typedef struct _TxOutputBinType {
|
||||
uint64_t amount;
|
||||
pb_callback_t script_pubkey;
|
||||
/* @@protoc_insertion_point(struct:TxOutputBinType) */
|
||||
} TxOutputBinType;
|
||||
|
||||
typedef struct _TxRequestDetailsType {
|
||||
bool has_request_index;
|
||||
uint32_t request_index;
|
||||
pb_callback_t tx_hash;
|
||||
bool has_extra_data_len;
|
||||
uint32_t extra_data_len;
|
||||
bool has_extra_data_offset;
|
||||
uint32_t extra_data_offset;
|
||||
/* @@protoc_insertion_point(struct:TxRequestDetailsType) */
|
||||
} TxRequestDetailsType;
|
||||
|
||||
typedef struct _TxRequestSerializedType {
|
||||
bool has_signature_index;
|
||||
uint32_t signature_index;
|
||||
pb_callback_t signature;
|
||||
pb_callback_t serialized_tx;
|
||||
/* @@protoc_insertion_point(struct:TxRequestSerializedType) */
|
||||
} TxRequestSerializedType;
|
||||
|
||||
typedef struct _HDNodePathType {
|
||||
HDNodeType node;
|
||||
pb_callback_t address_n;
|
||||
/* @@protoc_insertion_point(struct:HDNodePathType) */
|
||||
} HDNodePathType;
|
||||
|
||||
typedef struct _TxInputType {
|
||||
pb_callback_t address_n;
|
||||
pb_callback_t prev_hash;
|
||||
uint32_t prev_index;
|
||||
pb_callback_t script_sig;
|
||||
bool has_sequence;
|
||||
uint32_t sequence;
|
||||
bool has_script_type;
|
||||
InputScriptType script_type;
|
||||
bool has_multisig;
|
||||
MultisigRedeemScriptType multisig;
|
||||
bool has_amount;
|
||||
uint64_t amount;
|
||||
/* @@protoc_insertion_point(struct:TxInputType) */
|
||||
} TxInputType;
|
||||
|
||||
typedef struct _TxOutputType {
|
||||
pb_callback_t address;
|
||||
pb_callback_t address_n;
|
||||
uint64_t amount;
|
||||
OutputScriptType script_type;
|
||||
bool has_multisig;
|
||||
MultisigRedeemScriptType multisig;
|
||||
pb_callback_t op_return_data;
|
||||
/* @@protoc_insertion_point(struct:TxOutputType) */
|
||||
} TxOutputType;
|
||||
|
||||
/* Extensions */
|
||||
extern const pb_extension_type_t wire_in; /* field type: bool wire_in; */
|
||||
extern const pb_extension_type_t wire_out; /* field type: bool wire_out; */
|
||||
extern const pb_extension_type_t wire_debug_in; /* field type: bool wire_debug_in; */
|
||||
extern const pb_extension_type_t wire_debug_out; /* field type: bool wire_debug_out; */
|
||||
extern const pb_extension_type_t wire_tiny; /* field type: bool wire_tiny; */
|
||||
extern const pb_extension_type_t wire_bootloader; /* field type: bool wire_bootloader; */
|
||||
|
||||
/* Default values for struct fields */
|
||||
extern const uint32_t CoinType_address_type_default;
|
||||
extern const uint32_t CoinType_address_type_p2sh_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;
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define HDNodeType_init_default {0, 0, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
|
||||
#define HDNodePathType_init_default {HDNodeType_init_default, {{NULL}, NULL}}
|
||||
#define CoinType_init_default {{{NULL}, NULL}, {{NULL}, NULL}, false, 0u, false, 0, false, 5u, {{NULL}, NULL}, false, 76067358u, false, 76066276u, false, 0}
|
||||
#define MultisigRedeemScriptType_init_default {{{NULL}, NULL}, {{NULL}, NULL}, false, 0}
|
||||
#define TxInputType_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0, {{NULL}, NULL}, false, 4294967295u, false, InputScriptType_SPENDADDRESS, false, MultisigRedeemScriptType_init_default, false, 0}
|
||||
#define TxOutputType_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0, (OutputScriptType)0, false, MultisigRedeemScriptType_init_default, {{NULL}, NULL}}
|
||||
#define TxOutputBinType_init_default {0, {{NULL}, NULL}}
|
||||
#define TransactionType_init_default {false, 0, {{NULL}, NULL}, {{NULL}, NULL}, false, 0, {{NULL}, NULL}, false, 0, false, 0, {{NULL}, NULL}, false, 0}
|
||||
#define TxRequestDetailsType_init_default {false, 0, {{NULL}, NULL}, false, 0, false, 0}
|
||||
#define TxRequestSerializedType_init_default {false, 0, {{NULL}, NULL}, {{NULL}, NULL}}
|
||||
#define IdentityType_init_default {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, 0u}
|
||||
#define HDNodeType_init_zero {0, 0, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
|
||||
#define HDNodePathType_init_zero {HDNodeType_init_zero, {{NULL}, NULL}}
|
||||
#define CoinType_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, false, 0, false, 0, false, 0, {{NULL}, NULL}, false, 0, false, 0, false, 0}
|
||||
#define MultisigRedeemScriptType_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, false, 0}
|
||||
#define TxInputType_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0, {{NULL}, NULL}, false, 0, false, (InputScriptType)0, false, MultisigRedeemScriptType_init_zero, false, 0}
|
||||
#define TxOutputType_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0, (OutputScriptType)0, false, MultisigRedeemScriptType_init_zero, {{NULL}, NULL}}
|
||||
#define TxOutputBinType_init_zero {0, {{NULL}, NULL}}
|
||||
#define TransactionType_init_zero {false, 0, {{NULL}, NULL}, {{NULL}, NULL}, false, 0, {{NULL}, NULL}, false, 0, false, 0, {{NULL}, NULL}, false, 0}
|
||||
#define TxRequestDetailsType_init_zero {false, 0, {{NULL}, NULL}, false, 0, false, 0}
|
||||
#define TxRequestSerializedType_init_zero {false, 0, {{NULL}, NULL}, {{NULL}, NULL}}
|
||||
#define IdentityType_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define CoinType_coin_name_tag 1
|
||||
#define CoinType_coin_shortcut_tag 2
|
||||
#define CoinType_address_type_tag 3
|
||||
#define CoinType_maxfee_kb_tag 4
|
||||
#define CoinType_address_type_p2sh_tag 5
|
||||
#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
|
||||
#define HDNodeType_chain_code_tag 4
|
||||
#define HDNodeType_private_key_tag 5
|
||||
#define HDNodeType_public_key_tag 6
|
||||
#define IdentityType_proto_tag 1
|
||||
#define IdentityType_user_tag 2
|
||||
#define IdentityType_host_tag 3
|
||||
#define IdentityType_port_tag 4
|
||||
#define IdentityType_path_tag 5
|
||||
#define IdentityType_index_tag 6
|
||||
#define MultisigRedeemScriptType_pubkeys_tag 1
|
||||
#define MultisigRedeemScriptType_signatures_tag 2
|
||||
#define MultisigRedeemScriptType_m_tag 3
|
||||
#define TransactionType_version_tag 1
|
||||
#define TransactionType_inputs_tag 2
|
||||
#define TransactionType_bin_outputs_tag 3
|
||||
#define TransactionType_outputs_tag 5
|
||||
#define TransactionType_lock_time_tag 4
|
||||
#define TransactionType_inputs_cnt_tag 6
|
||||
#define TransactionType_outputs_cnt_tag 7
|
||||
#define TransactionType_extra_data_tag 8
|
||||
#define TransactionType_extra_data_len_tag 9
|
||||
#define TxOutputBinType_amount_tag 1
|
||||
#define TxOutputBinType_script_pubkey_tag 2
|
||||
#define TxRequestDetailsType_request_index_tag 1
|
||||
#define TxRequestDetailsType_tx_hash_tag 2
|
||||
#define TxRequestDetailsType_extra_data_len_tag 3
|
||||
#define TxRequestDetailsType_extra_data_offset_tag 4
|
||||
#define TxRequestSerializedType_signature_index_tag 1
|
||||
#define TxRequestSerializedType_signature_tag 2
|
||||
#define TxRequestSerializedType_serialized_tx_tag 3
|
||||
#define HDNodePathType_node_tag 1
|
||||
#define HDNodePathType_address_n_tag 2
|
||||
#define TxInputType_address_n_tag 1
|
||||
#define TxInputType_prev_hash_tag 2
|
||||
#define TxInputType_prev_index_tag 3
|
||||
#define TxInputType_script_sig_tag 4
|
||||
#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
|
||||
#define TxOutputType_script_type_tag 4
|
||||
#define TxOutputType_multisig_tag 5
|
||||
#define TxOutputType_op_return_data_tag 6
|
||||
#define wire_in_tag 50002
|
||||
#define wire_out_tag 50003
|
||||
#define wire_debug_in_tag 50004
|
||||
#define wire_debug_out_tag 50005
|
||||
#define wire_tiny_tag 50006
|
||||
#define wire_bootloader_tag 50007
|
||||
|
||||
/* 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[10];
|
||||
extern const pb_field_t MultisigRedeemScriptType_fields[4];
|
||||
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[10];
|
||||
extern const pb_field_t TxRequestDetailsType_fields[5];
|
||||
extern const pb_field_t TxRequestSerializedType_fields[4];
|
||||
extern const pb_field_t IdentityType_fields[7];
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* HDNodeType_size depends on runtime parameters */
|
||||
/* HDNodePathType_size depends on runtime parameters */
|
||||
/* CoinType_size depends on runtime parameters */
|
||||
/* MultisigRedeemScriptType_size depends on runtime parameters */
|
||||
/* TxInputType_size depends on runtime parameters */
|
||||
/* TxOutputType_size depends on runtime parameters */
|
||||
/* TxOutputBinType_size depends on runtime parameters */
|
||||
/* TransactionType_size depends on runtime parameters */
|
||||
/* TxRequestDetailsType_size depends on runtime parameters */
|
||||
/* TxRequestSerializedType_size depends on runtime parameters */
|
||||
/* IdentityType_size depends on runtime parameters */
|
||||
|
||||
/* Message IDs (where set with "msgid" option) */
|
||||
#ifdef PB_MSGID
|
||||
|
||||
#define TYPES_MESSAGES \
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
@ -1 +0,0 @@
|
||||
../../../vendor/trezor-common/protob/types.proto
|
36
micropython/bootloader/protob/types.proto
Normal file
36
micropython/bootloader/protob/types.proto
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Type of failures returned by Failure message
|
||||
* @used_in Failure
|
||||
*/
|
||||
enum FailureType {
|
||||
Failure_UnexpectedMessage = 1;
|
||||
Failure_ButtonExpected = 2;
|
||||
Failure_SyntaxError = 3;
|
||||
Failure_ActionCancelled = 4;
|
||||
Failure_PinExpected = 5;
|
||||
Failure_PinCancelled = 6;
|
||||
Failure_PinInvalid = 7;
|
||||
Failure_InvalidSignature = 8;
|
||||
Failure_Other = 9;
|
||||
Failure_NotEnoughFunds = 10;
|
||||
Failure_NotInitialized = 11;
|
||||
Failure_FirmwareError = 99;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of button request
|
||||
* @used_in ButtonRequest
|
||||
*/
|
||||
enum ButtonRequestType {
|
||||
ButtonRequest_Other = 1;
|
||||
ButtonRequest_FeeOverThreshold = 2;
|
||||
ButtonRequest_ConfirmOutput = 3;
|
||||
ButtonRequest_ResetDevice = 4;
|
||||
ButtonRequest_ConfirmWord = 5;
|
||||
ButtonRequest_WipeDevice = 6;
|
||||
ButtonRequest_ProtectCall = 7;
|
||||
ButtonRequest_SignTx = 8;
|
||||
ButtonRequest_FirmwareCheck = 9;
|
||||
ButtonRequest_Address = 10;
|
||||
ButtonRequest_PublicKey = 11;
|
||||
}
|
Loading…
Reference in New Issue
Block a user