From 15fcda21ce0597281cada810dac785258414aac1 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 23 Nov 2016 13:12:15 +0100 Subject: [PATCH] update protobuf --- firmware/protob/messages.pb.c | 8 +++++--- firmware/protob/messages.pb.h | 31 ++++++++++++++++++------------- firmware/protob/types.pb.h | 11 +++++++++++ 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/firmware/protob/messages.pb.c b/firmware/protob/messages.pb.c index 7193d53704..7decf55dc0 100644 --- a/firmware/protob/messages.pb.c +++ b/firmware/protob/messages.pb.c @@ -204,18 +204,20 @@ const pb_field_t EntropyAck_fields[2] = { PB_LAST_FIELD }; -const pb_field_t RecoveryDevice_fields[8] = { +const pb_field_t RecoveryDevice_fields[9] = { PB_FIELD2( 1, UINT32 , OPTIONAL, STATIC , FIRST, RecoveryDevice, word_count, word_count, 0), PB_FIELD2( 2, BOOL , OPTIONAL, STATIC , OTHER, RecoveryDevice, passphrase_protection, word_count, 0), PB_FIELD2( 3, BOOL , OPTIONAL, STATIC , OTHER, RecoveryDevice, pin_protection, passphrase_protection, 0), PB_FIELD2( 4, STRING , OPTIONAL, STATIC , OTHER, RecoveryDevice, language, pin_protection, &RecoveryDevice_language_default), PB_FIELD2( 5, STRING , OPTIONAL, STATIC , OTHER, RecoveryDevice, label, language, 0), PB_FIELD2( 6, BOOL , OPTIONAL, STATIC , OTHER, RecoveryDevice, enforce_wordlist, label, 0), - PB_FIELD2( 7, UINT32 , OPTIONAL, STATIC , OTHER, RecoveryDevice, u2f_counter, enforce_wordlist, 0), + PB_FIELD2( 8, UINT32 , OPTIONAL, STATIC , OTHER, RecoveryDevice, type, enforce_wordlist, 0), + PB_FIELD2( 9, UINT32 , OPTIONAL, STATIC , OTHER, RecoveryDevice, u2f_counter, type, 0), PB_LAST_FIELD }; -const pb_field_t WordRequest_fields[1] = { +const pb_field_t WordRequest_fields[2] = { + PB_FIELD2( 1, ENUM , OPTIONAL, STATIC , FIRST, WordRequest, type, type, 0), PB_LAST_FIELD }; diff --git a/firmware/protob/messages.pb.h b/firmware/protob/messages.pb.h index 7123f4495b..55950650ac 100644 --- a/firmware/protob/messages.pb.h +++ b/firmware/protob/messages.pb.h @@ -125,10 +125,6 @@ typedef struct _WipeDevice { uint8_t dummy_field; } WipeDevice; -typedef struct _WordRequest { - uint8_t dummy_field; -} WordRequest; - typedef struct _Address { char address[41]; } Address; @@ -676,6 +672,8 @@ typedef struct _RecoveryDevice { char label[33]; bool has_enforce_wordlist; bool enforce_wordlist; + bool has_type; + uint32_t type; bool has_u2f_counter; uint32_t u2f_counter; } RecoveryDevice; @@ -825,6 +823,11 @@ typedef struct _WordAck { char word[12]; } WordAck; +typedef struct _WordRequest { + bool has_type; + WordRequestType type; +} WordRequest; + /* Default values for struct fields */ extern const char GetAddress_coin_name_default[17]; extern const InputScriptType GetAddress_script_type_default; @@ -873,8 +876,8 @@ extern const uint32_t SimpleSignTx_lock_time_default; #define ResetDevice_init_default {false, 0, false, 256u, false, 0, false, 0, false, "english", false, "", false, 0} #define EntropyRequest_init_default {0} #define EntropyAck_init_default {false, {0, {0}}} -#define RecoveryDevice_init_default {false, 0, false, 0, false, 0, false, "english", false, "", false, 0, false, 0} -#define WordRequest_init_default {0} +#define RecoveryDevice_init_default {false, 0, false, 0, false, 0, false, "english", false, "", false, 0, false, 0, false, 0} +#define WordRequest_init_default {false, (WordRequestType)0} #define WordAck_init_default {""} #define SignMessage_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, false, "Bitcoin"} #define VerifyMessage_init_default {false, "", false, {0, {0}}, false, {0, {0}}, false, "Bitcoin"} @@ -939,8 +942,8 @@ extern const uint32_t SimpleSignTx_lock_time_default; #define ResetDevice_init_zero {false, 0, false, 0, false, 0, false, 0, false, "", false, "", false, 0} #define EntropyRequest_init_zero {0} #define EntropyAck_init_zero {false, {0, {0}}} -#define RecoveryDevice_init_zero {false, 0, false, 0, false, 0, false, "", false, "", false, 0, false, 0} -#define WordRequest_init_zero {0} +#define RecoveryDevice_init_zero {false, 0, false, 0, false, 0, false, "", false, "", false, 0, false, 0, false, 0} +#define WordRequest_init_zero {false, (WordRequestType)0} #define WordAck_init_zero {""} #define SignMessage_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, false, ""} #define VerifyMessage_init_zero {false, "", false, {0, {0}}, false, {0, {0}}, false, ""} @@ -1109,7 +1112,8 @@ extern const uint32_t SimpleSignTx_lock_time_default; #define RecoveryDevice_language_tag 4 #define RecoveryDevice_label_tag 5 #define RecoveryDevice_enforce_wordlist_tag 6 -#define RecoveryDevice_u2f_counter_tag 7 +#define RecoveryDevice_type_tag 8 +#define RecoveryDevice_u2f_counter_tag 9 #define ResetDevice_display_random_tag 1 #define ResetDevice_strength_tag 2 #define ResetDevice_passphrase_protection_tag 3 @@ -1150,6 +1154,7 @@ extern const uint32_t SimpleSignTx_lock_time_default; #define VerifyMessage_message_tag 3 #define VerifyMessage_coin_name_tag 4 #define WordAck_word_tag 1 +#define WordRequest_type_tag 1 /* Struct field encoding specification for nanopb */ extern const pb_field_t Initialize_fields[1]; @@ -1181,8 +1186,8 @@ extern const pb_field_t LoadDevice_fields[9]; extern const pb_field_t ResetDevice_fields[8]; extern const pb_field_t EntropyRequest_fields[1]; extern const pb_field_t EntropyAck_fields[2]; -extern const pb_field_t RecoveryDevice_fields[8]; -extern const pb_field_t WordRequest_fields[1]; +extern const pb_field_t RecoveryDevice_fields[9]; +extern const pb_field_t WordRequest_fields[2]; extern const pb_field_t WordAck_fields[2]; extern const pb_field_t SignMessage_fields[4]; extern const pb_field_t VerifyMessage_fields[5]; @@ -1249,8 +1254,8 @@ extern const pb_field_t DebugLinkFlashErase_fields[2]; #define ResetDevice_size 72 #define EntropyRequest_size 0 #define EntropyAck_size 131 -#define RecoveryDevice_size 72 -#define WordRequest_size 0 +#define RecoveryDevice_size 78 +#define WordRequest_size 6 #define WordAck_size 14 #define SignMessage_size 1094 #define VerifyMessage_size 1156 diff --git a/firmware/protob/types.pb.h b/firmware/protob/types.pb.h index a7dd51e8a2..68b5ec6a55 100644 --- a/firmware/protob/types.pb.h +++ b/firmware/protob/types.pb.h @@ -69,6 +69,17 @@ typedef enum _PinMatrixRequestType { PinMatrixRequestType_PinMatrixRequestType_NewSecond = 3 } PinMatrixRequestType; +typedef enum _RecoveryDeviceType { + RecoveryDeviceType_RecoveryDeviceType_ScrambledWords = 0, + RecoveryDeviceType_RecoveryDeviceType_Matrix = 1 +} RecoveryDeviceType; + +typedef enum _WordRequestType { + WordRequestType_WordRequestType_Plain = 0, + WordRequestType_WordRequestType_Matrix9 = 1, + WordRequestType_WordRequestType_Matrix6 = 2 +} WordRequestType; + /* Struct definitions */ typedef struct _CoinType { bool has_coin_name;