1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

Updated protobuf

This commit is contained in:
Jochen Hoenicke 2016-05-26 20:27:40 +02:00
parent 18d549c83d
commit be0858b7d7
3 changed files with 198 additions and 2 deletions

View File

@ -116,3 +116,6 @@ DebugLinkState.recovery_fake_word max_size:12
DebugLinkLog.bucket max_size:33
DebugLinkLog.text max_size:256
DebugLinkMemory.memory max_size:1024
DebugLinkMemoryWrite.memory max_size:1024

View File

@ -149,11 +149,22 @@ const pb_field_t GetAddress_fields[5] = {
PB_LAST_FIELD
};
const pb_field_t EthereumGetAddress_fields[3] = {
PB_FIELD2( 1, UINT32 , REPEATED, CALLBACK, FIRST, EthereumGetAddress, address_n, address_n, 0),
PB_FIELD2( 2, BOOL , OPTIONAL, STATIC , OTHER, EthereumGetAddress, show_display, address_n, 0),
PB_LAST_FIELD
};
const pb_field_t Address_fields[2] = {
PB_FIELD2( 1, STRING , REQUIRED, STATIC , FIRST, Address, address, address, 0),
PB_LAST_FIELD
};
const pb_field_t EthereumAddress_fields[2] = {
PB_FIELD2( 1, BYTES , REQUIRED, CALLBACK, FIRST, EthereumAddress, address, address, 0),
PB_LAST_FIELD
};
const pb_field_t WipeDevice_fields[1] = {
PB_LAST_FIELD
};
@ -317,6 +328,31 @@ const pb_field_t TxAck_fields[2] = {
PB_LAST_FIELD
};
const pb_field_t EthereumSignTx_fields[9] = {
PB_FIELD2( 1, UINT32 , REPEATED, CALLBACK, FIRST, EthereumSignTx, address_n, address_n, 0),
PB_FIELD2( 2, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, nonce, address_n, 0),
PB_FIELD2( 3, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, gas_price, nonce, 0),
PB_FIELD2( 4, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, gas_limit, gas_price, 0),
PB_FIELD2( 5, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, to, gas_limit, 0),
PB_FIELD2( 6, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, value, to, 0),
PB_FIELD2( 7, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumSignTx, data_initial_chunk, value, 0),
PB_FIELD2( 8, UINT32 , OPTIONAL, STATIC , OTHER, EthereumSignTx, data_length, data_initial_chunk, 0),
PB_LAST_FIELD
};
const pb_field_t EthereumTxRequest_fields[5] = {
PB_FIELD2( 1, UINT32 , OPTIONAL, STATIC , FIRST, EthereumTxRequest, data_length, data_length, 0),
PB_FIELD2( 2, UINT32 , OPTIONAL, STATIC , OTHER, EthereumTxRequest, signature_v, data_length, 0),
PB_FIELD2( 3, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumTxRequest, signature_r, signature_v, 0),
PB_FIELD2( 4, BYTES , OPTIONAL, CALLBACK, OTHER, EthereumTxRequest, signature_s, signature_r, 0),
PB_LAST_FIELD
};
const pb_field_t EthereumTxAck_fields[2] = {
PB_FIELD2( 1, BYTES , OPTIONAL, CALLBACK, FIRST, EthereumTxAck, data_chunk, data_chunk, 0),
PB_LAST_FIELD
};
const pb_field_t SignIdentity_fields[5] = {
PB_FIELD2( 1, MESSAGE , OPTIONAL, STATIC , FIRST, SignIdentity, identity, identity, &IdentityType_fields),
PB_FIELD2( 2, BYTES , OPTIONAL, STATIC , OTHER, SignIdentity, challenge_hidden, identity, 0),
@ -375,6 +411,29 @@ const pb_field_t DebugLinkLog_fields[4] = {
PB_LAST_FIELD
};
const pb_field_t DebugLinkMemoryRead_fields[3] = {
PB_FIELD2( 1, UINT32 , OPTIONAL, STATIC , FIRST, DebugLinkMemoryRead, address, address, 0),
PB_FIELD2( 2, UINT32 , OPTIONAL, STATIC , OTHER, DebugLinkMemoryRead, length, address, 0),
PB_LAST_FIELD
};
const pb_field_t DebugLinkMemory_fields[2] = {
PB_FIELD2( 1, BYTES , OPTIONAL, STATIC , FIRST, DebugLinkMemory, memory, memory, 0),
PB_LAST_FIELD
};
const pb_field_t DebugLinkMemoryWrite_fields[4] = {
PB_FIELD2( 1, UINT32 , OPTIONAL, STATIC , FIRST, DebugLinkMemoryWrite, address, address, 0),
PB_FIELD2( 2, BYTES , OPTIONAL, STATIC , OTHER, DebugLinkMemoryWrite, memory, address, 0),
PB_FIELD2( 3, BOOL , OPTIONAL, STATIC , OTHER, DebugLinkMemoryWrite, flash, memory, 0),
PB_LAST_FIELD
};
const pb_field_t DebugLinkFlashErase_fields[2] = {
PB_FIELD2( 1, UINT32 , OPTIONAL, STATIC , FIRST, DebugLinkFlashErase, sector, sector, 0),
PB_LAST_FIELD
};
/* Check that field information fits in pb_field_t */
#if !defined(PB_FIELD_32BIT)
@ -385,7 +444,7 @@ const pb_field_t DebugLinkLog_fields[4] = {
* 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(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_Address_WipeDevice_LoadDevice_ResetDevice_EntropyRequest_EntropyAck_RecoveryDevice_WordRequest_WordAck_SignMessage_VerifyMessage_MessageSignature_EncryptMessage_EncryptedMessage_DecryptMessage_DecryptedMessage_CipherKeyValue_CipheredKeyValue_EstimateTxSize_TxSize_SignTx_SimpleSignTx_TxRequest_TxAck_SignIdentity_SignedIdentity_FirmwareErase_FirmwareUpload_DebugLinkDecision_DebugLinkGetState_DebugLinkState_DebugLinkStop_DebugLinkLog)
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(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_FirmwareErase_FirmwareUpload_DebugLinkDecision_DebugLinkGetState_DebugLinkState_DebugLinkStop_DebugLinkLog_DebugLinkMemoryRead_DebugLinkMemory_DebugLinkMemoryWrite_DebugLinkFlashErase)
#endif
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)

View File

@ -61,11 +61,20 @@ typedef enum _MessageType {
MessageType_MessageType_SignIdentity = 53,
MessageType_MessageType_SignedIdentity = 54,
MessageType_MessageType_GetFeatures = 55,
MessageType_MessageType_EthereumGetAddress = 56,
MessageType_MessageType_EthereumAddress = 57,
MessageType_MessageType_EthereumSignTx = 58,
MessageType_MessageType_EthereumTxRequest = 59,
MessageType_MessageType_EthereumTxAck = 60,
MessageType_MessageType_DebugLinkDecision = 100,
MessageType_MessageType_DebugLinkGetState = 101,
MessageType_MessageType_DebugLinkState = 102,
MessageType_MessageType_DebugLinkStop = 103,
MessageType_MessageType_DebugLinkLog = 104
MessageType_MessageType_DebugLinkLog = 104,
MessageType_MessageType_DebugLinkMemoryRead = 110,
MessageType_MessageType_DebugLinkMemory = 111,
MessageType_MessageType_DebugLinkMemoryWrite = 112,
MessageType_MessageType_DebugLinkFlashErase = 113
} MessageType;
/* Struct definitions */
@ -190,6 +199,11 @@ typedef struct _DebugLinkDecision {
bool yes_no;
} DebugLinkDecision;
typedef struct _DebugLinkFlashErase {
bool has_sector;
uint32_t sector;
} DebugLinkFlashErase;
typedef struct _DebugLinkLog {
bool has_level;
uint32_t level;
@ -199,6 +213,37 @@ typedef struct _DebugLinkLog {
char text[256];
} DebugLinkLog;
typedef struct {
size_t size;
uint8_t bytes[1024];
} DebugLinkMemory_memory_t;
typedef struct _DebugLinkMemory {
bool has_memory;
DebugLinkMemory_memory_t memory;
} DebugLinkMemory;
typedef struct _DebugLinkMemoryRead {
bool has_address;
uint32_t address;
bool has_length;
uint32_t length;
} DebugLinkMemoryRead;
typedef struct {
size_t size;
uint8_t bytes[1024];
} DebugLinkMemoryWrite_memory_t;
typedef struct _DebugLinkMemoryWrite {
bool has_address;
uint32_t address;
bool has_memory;
DebugLinkMemoryWrite_memory_t memory;
bool has_flash;
bool flash;
} DebugLinkMemoryWrite;
typedef struct {
size_t size;
uint8_t bytes[1024];
@ -343,6 +388,41 @@ typedef struct _EstimateTxSize {
char coin_name[17];
} EstimateTxSize;
typedef struct _EthereumAddress {
pb_callback_t address;
} EthereumAddress;
typedef struct _EthereumGetAddress {
pb_callback_t address_n;
bool has_show_display;
bool show_display;
} EthereumGetAddress;
typedef struct _EthereumSignTx {
pb_callback_t address_n;
pb_callback_t nonce;
pb_callback_t gas_price;
pb_callback_t gas_limit;
pb_callback_t to;
pb_callback_t value;
pb_callback_t data_initial_chunk;
bool has_data_length;
uint32_t data_length;
} EthereumSignTx;
typedef struct _EthereumTxAck {
pb_callback_t data_chunk;
} EthereumTxAck;
typedef struct _EthereumTxRequest {
bool has_data_length;
uint32_t data_length;
bool has_signature_v;
uint32_t signature_v;
pb_callback_t signature_r;
pb_callback_t signature_s;
} EthereumTxRequest;
typedef struct _Failure {
bool has_code;
FailureType code;
@ -681,7 +761,9 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define GetPublicKey_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0}
#define PublicKey_init_default {HDNodeType_init_default, false, ""}
#define GetAddress_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "Bitcoin", false, 0, false, MultisigRedeemScriptType_init_default}
#define EthereumGetAddress_init_default {{{NULL}, NULL}, false, 0}
#define Address_init_default {""}
#define EthereumAddress_init_default {{{NULL}, NULL}}
#define WipeDevice_init_default {0}
#define LoadDevice_init_default {false, "", false, HDNodeType_init_default, false, "", false, 0, false, "english", false, "", false, 0}
#define ResetDevice_init_default {false, 0, false, 256u, false, 0, false, 0, false, "english", false, ""}
@ -705,6 +787,9 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#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 {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, 0}
#define EthereumTxRequest_init_default {false, 0, false, 0, {{NULL}, NULL}, {{NULL}, NULL}}
#define EthereumTxAck_init_default {{{NULL}, NULL}}
#define SignIdentity_init_default {false, IdentityType_init_default, false, {0, {0}}, false, "", false, ""}
#define SignedIdentity_init_default {false, "", false, {0, {0}}, false, {0, {0}}}
#define FirmwareErase_init_default {0}
@ -714,6 +799,10 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define DebugLinkState_init_default {false, {0, {0}}, false, "", false, "", false, "", false, HDNodeType_init_default, false, 0, false, "", false, {0, {0}}, false, "", false, 0}
#define DebugLinkStop_init_default {0}
#define DebugLinkLog_init_default {false, 0, false, "", false, ""}
#define DebugLinkMemoryRead_init_default {false, 0, false, 0}
#define DebugLinkMemory_init_default {false, {0, {0}}}
#define DebugLinkMemoryWrite_init_default {false, 0, false, {0, {0}}, false, 0}
#define DebugLinkFlashErase_init_default {false, 0}
#define Initialize_init_zero {0}
#define GetFeatures_init_zero {0}
#define Features_init_zero {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", 0, {CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero, CoinType_init_zero}, false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0}
@ -735,7 +824,9 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define GetPublicKey_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0}
#define PublicKey_init_zero {HDNodeType_init_zero, false, ""}
#define GetAddress_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0, false, MultisigRedeemScriptType_init_zero}
#define EthereumGetAddress_init_zero {{{NULL}, NULL}, false, 0}
#define Address_init_zero {""}
#define EthereumAddress_init_zero {{{NULL}, NULL}}
#define WipeDevice_init_zero {0}
#define LoadDevice_init_zero {false, "", false, HDNodeType_init_zero, false, "", false, 0, false, "", false, "", false, 0}
#define ResetDevice_init_zero {false, 0, false, 0, false, 0, false, 0, false, "", false, ""}
@ -759,6 +850,9 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#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 {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, 0}
#define EthereumTxRequest_init_zero {false, 0, false, 0, {{NULL}, NULL}, {{NULL}, NULL}}
#define EthereumTxAck_init_zero {{{NULL}, NULL}}
#define SignIdentity_init_zero {false, IdentityType_init_zero, false, {0, {0}}, false, "", false, ""}
#define SignedIdentity_init_zero {false, "", false, {0, {0}}, false, {0, {0}}}
#define FirmwareErase_init_zero {0}
@ -768,6 +862,10 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define DebugLinkState_init_zero {false, {0, {0}}, false, "", false, "", false, "", false, HDNodeType_init_zero, false, 0, false, "", false, {0, {0}}, false, "", false, 0}
#define DebugLinkStop_init_zero {0}
#define DebugLinkLog_init_zero {false, 0, false, "", false, ""}
#define DebugLinkMemoryRead_init_zero {false, 0, false, 0}
#define DebugLinkMemory_init_zero {false, {0, {0}}}
#define DebugLinkMemoryWrite_init_zero {false, 0, false, {0, {0}}, false, 0}
#define DebugLinkFlashErase_init_zero {false, 0}
/* Field tags (for use in manual encoding/decoding) */
#define Address_address_tag 1
@ -787,9 +885,16 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define CipherKeyValue_iv_tag 7
#define CipheredKeyValue_value_tag 1
#define DebugLinkDecision_yes_no_tag 1
#define DebugLinkFlashErase_sector_tag 1
#define DebugLinkLog_level_tag 1
#define DebugLinkLog_bucket_tag 2
#define DebugLinkLog_text_tag 3
#define DebugLinkMemory_memory_tag 1
#define DebugLinkMemoryRead_address_tag 1
#define DebugLinkMemoryRead_length_tag 2
#define DebugLinkMemoryWrite_address_tag 1
#define DebugLinkMemoryWrite_memory_tag 2
#define DebugLinkMemoryWrite_flash_tag 3
#define DebugLinkState_layout_tag 1
#define DebugLinkState_pin_tag 2
#define DebugLinkState_matrix_tag 3
@ -819,6 +924,22 @@ extern const uint32_t SimpleSignTx_lock_time_default;
#define EstimateTxSize_outputs_count_tag 1
#define EstimateTxSize_inputs_count_tag 2
#define EstimateTxSize_coin_name_tag 3
#define EthereumAddress_address_tag 1
#define EthereumGetAddress_address_n_tag 1
#define EthereumGetAddress_show_display_tag 2
#define EthereumSignTx_address_n_tag 1
#define EthereumSignTx_nonce_tag 2
#define EthereumSignTx_gas_price_tag 3
#define EthereumSignTx_gas_limit_tag 4
#define EthereumSignTx_to_tag 5
#define EthereumSignTx_value_tag 6
#define EthereumSignTx_data_initial_chunk_tag 7
#define EthereumSignTx_data_length_tag 8
#define EthereumTxAck_data_chunk_tag 1
#define EthereumTxRequest_data_length_tag 1
#define EthereumTxRequest_signature_v_tag 2
#define EthereumTxRequest_signature_r_tag 3
#define EthereumTxRequest_signature_s_tag 4
#define Failure_code_tag 1
#define Failure_message_tag 2
#define Features_vendor_tag 1
@ -932,7 +1053,9 @@ extern const pb_field_t Entropy_fields[2];
extern const pb_field_t GetPublicKey_fields[4];
extern const pb_field_t PublicKey_fields[3];
extern const pb_field_t GetAddress_fields[5];
extern const pb_field_t EthereumGetAddress_fields[3];
extern const pb_field_t Address_fields[2];
extern const pb_field_t EthereumAddress_fields[2];
extern const pb_field_t WipeDevice_fields[1];
extern const pb_field_t LoadDevice_fields[8];
extern const pb_field_t ResetDevice_fields[7];
@ -956,6 +1079,9 @@ 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[9];
extern const pb_field_t EthereumTxRequest_fields[5];
extern const pb_field_t EthereumTxAck_fields[2];
extern const pb_field_t SignIdentity_fields[5];
extern const pb_field_t SignedIdentity_fields[4];
extern const pb_field_t FirmwareErase_fields[1];
@ -965,6 +1091,10 @@ extern const pb_field_t DebugLinkGetState_fields[1];
extern const pb_field_t DebugLinkState_fields[11];
extern const pb_field_t DebugLinkStop_fields[1];
extern const pb_field_t DebugLinkLog_fields[4];
extern const pb_field_t DebugLinkMemoryRead_fields[3];
extern const pb_field_t DebugLinkMemory_fields[2];
extern const pb_field_t DebugLinkMemoryWrite_fields[4];
extern const pb_field_t DebugLinkFlashErase_fields[2];
/* Maximum encoded size of messages (where known) */
#define Initialize_size 0
@ -1021,6 +1151,10 @@ extern const pb_field_t DebugLinkLog_fields[4];
#define DebugLinkState_size (1468 + HDNodeType_size)
#define DebugLinkStop_size 0
#define DebugLinkLog_size 300
#define DebugLinkMemoryRead_size 12
#define DebugLinkMemory_size 1027
#define DebugLinkMemoryWrite_size 1035
#define DebugLinkFlashErase_size 6
#ifdef __cplusplus
} /* extern "C" */