From 5fe2f7e59c3cc76133fd382957fc1cf3f18bd37c Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 23 Oct 2019 15:18:47 +0000 Subject: [PATCH] common/protob: remove ButtonRequest.data field --- common/protob/messages-common.proto | 1 - core/embed/bootloader/protob/messages.options | 2 -- core/embed/bootloader/protob/messages.pb.c | 7 +++---- core/embed/bootloader/protob/messages.pb.h | 17 +++++++---------- core/embed/bootloader/protob/messages.proto | 1 - core/src/trezor/messages/ButtonRequest.py | 3 --- legacy/firmware/protob/messages-common.options | 2 -- python/src/trezorlib/messages/ButtonRequest.py | 3 --- 8 files changed, 10 insertions(+), 26 deletions(-) diff --git a/common/protob/messages-common.proto b/common/protob/messages-common.proto index 4bbc2bb627..1c121ae242 100644 --- a/common/protob/messages-common.proto +++ b/common/protob/messages-common.proto @@ -44,7 +44,6 @@ message Failure { */ message ButtonRequest { optional ButtonRequestType code = 1; - optional string data = 2; /** * Type of button request */ diff --git a/core/embed/bootloader/protob/messages.options b/core/embed/bootloader/protob/messages.options index a0421ed929..90ae4abff9 100644 --- a/core/embed/bootloader/protob/messages.options +++ b/core/embed/bootloader/protob/messages.options @@ -14,6 +14,4 @@ Success.message max_size:256 Failure.message max_size:256 -ButtonRequest.data max_size:256 - FirmwareUpload.hash max_size:32 diff --git a/core/embed/bootloader/protob/messages.pb.c b/core/embed/bootloader/protob/messages.pb.c index d499278b49..295fe2dbc5 100644 --- a/core/embed/bootloader/protob/messages.pb.c +++ b/core/embed/bootloader/protob/messages.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.0-dev */ +/* Generated by nanopb-0.3.9.4 */ #include "messages.pb.h" @@ -58,9 +58,8 @@ const pb_field_t Failure_fields[3] = { PB_LAST_FIELD }; -const pb_field_t ButtonRequest_fields[3] = { +const pb_field_t ButtonRequest_fields[2] = { PB_FIELD( 1, ENUM , OPTIONAL, STATIC , FIRST, ButtonRequest, code, code, 0), - PB_FIELD( 2, STRING , OPTIONAL, STATIC , OTHER, ButtonRequest, data, code, 0), PB_LAST_FIELD }; @@ -89,7 +88,7 @@ const pb_field_t FirmwareUpload_fields[3] = { /* Check that field information fits in pb_field_t */ #if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) -#error Field descriptor for ButtonRequest.data is too large. Define PB_FIELD_16BIT to fix this. +#error Field descriptor for Failure.message is too large. Define PB_FIELD_16BIT to fix this. #endif diff --git a/core/embed/bootloader/protob/messages.pb.h b/core/embed/bootloader/protob/messages.pb.h index e1df00ed07..8ebc696733 100644 --- a/core/embed/bootloader/protob/messages.pb.h +++ b/core/embed/bootloader/protob/messages.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.0-dev */ +/* Generated by nanopb-0.3.9.4 */ #ifndef PB_MESSAGES_PB_H_INCLUDED #define PB_MESSAGES_PB_H_INCLUDED @@ -53,8 +53,6 @@ typedef struct _Initialize { typedef struct _ButtonRequest { bool has_code; ButtonRequestType code; - bool has_data; - char data[256]; /* @@protoc_insertion_point(struct:ButtonRequest) */ } ButtonRequest; @@ -154,8 +152,8 @@ typedef struct _Success { #define Features_init_default {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}, false, 0, false, "", false, 0, false, 0, false, 0, false, "", false, {0, {0}}} #define Ping_init_default {false, "", false, 0, false, 0, false, 0} #define Success_init_default {false, ""} -#define Failure_init_default {false, (FailureType)0, false, ""} -#define ButtonRequest_init_default {false, (ButtonRequestType)0, false, ""} +#define Failure_init_default {false, _FailureType_MIN, false, ""} +#define ButtonRequest_init_default {false, _ButtonRequestType_MIN} #define ButtonAck_init_default {0} #define FirmwareErase_init_default {false, 0} #define FirmwareRequest_init_default {false, 0, false, 0} @@ -165,8 +163,8 @@ typedef struct _Success { #define Features_init_zero {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}, false, 0, false, "", false, 0, false, 0, false, 0, false, "", false, {0, {0}}} #define Ping_init_zero {false, "", false, 0, false, 0, false, 0} #define Success_init_zero {false, ""} -#define Failure_init_zero {false, (FailureType)0, false, ""} -#define ButtonRequest_init_zero {false, (ButtonRequestType)0, false, ""} +#define Failure_init_zero {false, _FailureType_MIN, false, ""} +#define ButtonRequest_init_zero {false, _ButtonRequestType_MIN} #define ButtonAck_init_zero {0} #define FirmwareErase_init_zero {false, 0} #define FirmwareRequest_init_zero {false, 0, false, 0} @@ -174,7 +172,6 @@ typedef struct _Success { /* Field tags (for use in manual encoding/decoding) */ #define ButtonRequest_code_tag 1 -#define ButtonRequest_data_tag 2 #define Failure_code_tag 1 #define Failure_message_tag 2 #define Features_vendor_tag 1 @@ -212,7 +209,7 @@ extern const pb_field_t Features_fields[18]; extern const pb_field_t Ping_fields[5]; extern const pb_field_t Success_fields[2]; extern const pb_field_t Failure_fields[3]; -extern const pb_field_t ButtonRequest_fields[3]; +extern const pb_field_t ButtonRequest_fields[2]; extern const pb_field_t ButtonAck_fields[1]; extern const pb_field_t FirmwareErase_fields[2]; extern const pb_field_t FirmwareRequest_fields[3]; @@ -225,7 +222,7 @@ extern const pb_field_t FirmwareUpload_fields[3]; #define Ping_size 265 #define Success_size 259 #define Failure_size 270 -#define ButtonRequest_size 270 +#define ButtonRequest_size 11 #define ButtonAck_size 0 #define FirmwareErase_size 6 #define FirmwareRequest_size 12 diff --git a/core/embed/bootloader/protob/messages.proto b/core/embed/bootloader/protob/messages.proto index f072d1bc8a..3bbc356e22 100644 --- a/core/embed/bootloader/protob/messages.proto +++ b/core/embed/bootloader/protob/messages.proto @@ -97,7 +97,6 @@ message Failure { */ message ButtonRequest { optional ButtonRequestType code = 1; - optional string data = 2; } /** diff --git a/core/src/trezor/messages/ButtonRequest.py b/core/src/trezor/messages/ButtonRequest.py index c1dafdfa70..69d1b390bd 100644 --- a/core/src/trezor/messages/ButtonRequest.py +++ b/core/src/trezor/messages/ButtonRequest.py @@ -17,14 +17,11 @@ class ButtonRequest(p.MessageType): def __init__( self, code: EnumTypeButtonRequestType = None, - data: str = None, ) -> None: self.code = code - self.data = data @classmethod def get_fields(cls) -> Dict: return { 1: ('code', p.EnumType("ButtonRequestType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)), 0), - 2: ('data', p.UnicodeType, 0), } diff --git a/legacy/firmware/protob/messages-common.options b/legacy/firmware/protob/messages-common.options index 31a54c3fa0..cbb39f1cf6 100644 --- a/legacy/firmware/protob/messages-common.options +++ b/legacy/firmware/protob/messages-common.options @@ -2,8 +2,6 @@ Success.message max_size:256 Failure.message max_size:256 -ButtonRequest.data max_size:256 - PinMatrixAck.pin max_size:10 PassphraseAck.passphrase max_size:51 diff --git a/python/src/trezorlib/messages/ButtonRequest.py b/python/src/trezorlib/messages/ButtonRequest.py index 2e23247c98..57f4b524d1 100644 --- a/python/src/trezorlib/messages/ButtonRequest.py +++ b/python/src/trezorlib/messages/ButtonRequest.py @@ -17,14 +17,11 @@ class ButtonRequest(p.MessageType): def __init__( self, code: EnumTypeButtonRequestType = None, - data: str = None, ) -> None: self.code = code - self.data = data @classmethod def get_fields(cls) -> Dict: return { 1: ('code', p.EnumType("ButtonRequestType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)), 0), - 2: ('data', p.UnicodeType, 0), }