From ba06f21a0ea9eccc8088239a6f6105288b86cfcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Thu, 13 Mar 2025 18:18:56 +0100 Subject: [PATCH] feat(common/protobuf): add ethereum transaction signing anti-exfil protocol messages [no changelog] --- common/protob/messages-ethereum.proto | 12 +- core/src/trezor/messages.py | 8 + .../firmware/protob/messages-ethereum.options | 4 + python/src/trezorlib/messages.py | 12 + .../src/protos/generated/messages_ethereum.rs | 272 ++++++++++++++++-- 5 files changed, 278 insertions(+), 30 deletions(-) diff --git a/common/protob/messages-ethereum.proto b/common/protob/messages-ethereum.proto index ee4010bd08..20247aaa57 100644 --- a/common/protob/messages-ethereum.proto +++ b/common/protob/messages-ethereum.proto @@ -72,6 +72,7 @@ message EthereumSignTx { optional uint32 tx_type = 10; // Used for Wanchain optional ethereum_definitions.EthereumDefinitions definitions = 12; // network and/or token definitions for tx optional bool chunkify = 13; // display the address in chunks of 4 characters + optional bytes entropy_commitment = 14; // commitment to host's entropy, non-empty value indicates anti-exfil protocol will be used } /** @@ -95,6 +96,7 @@ message EthereumSignTxEIP1559 { repeated EthereumAccessList access_list = 11; // Access List optional ethereum_definitions.EthereumDefinitions definitions = 12; // network and/or token definitions for tx optional bool chunkify = 13; // display the address in chunks of 4 characters + optional bytes entropy_commitment = 14; // commitment to host's entropy, non-empty value indicates anti-exfil protocol will be used message EthereumAccessList { required string address = 1; @@ -110,10 +112,11 @@ message EthereumSignTxEIP1559 { * @next EthereumTxAck */ message EthereumTxRequest { - optional uint32 data_length = 1; // Number of bytes being requested (<= 1024) - optional uint32 signature_v = 2; // Computed signature (recovery parameter, limited to 27 or 28) - optional bytes signature_r = 3; // Computed signature R component (256 bit) - optional bytes signature_s = 4; // Computed signature S component (256 bit) + optional uint32 data_length = 1; // Number of bytes being requested (<= 1024) + optional uint32 signature_v = 2; // Computed signature (recovery parameter, limited to 27 or 28) + optional bytes signature_r = 3; // Computed signature R component (256 bit) + optional bytes signature_s = 4; // Computed signature S component (256 bit) + optional bytes nonce_commitment = 5; // Commitment to signature nonce, used in anti-exfil protocol } /** @@ -122,6 +125,7 @@ message EthereumTxRequest { */ message EthereumTxAck { required bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes) + optional bytes entropy = 2; // Host's entropy, used in anti-exfil protocol } /** diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index 9d4c93f782..546f05ae95 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -3833,6 +3833,7 @@ if TYPE_CHECKING: tx_type: "int | None" definitions: "EthereumDefinitions | None" chunkify: "bool | None" + entropy_commitment: "bytes | None" def __init__( self, @@ -3849,6 +3850,7 @@ if TYPE_CHECKING: tx_type: "int | None" = None, definitions: "EthereumDefinitions | None" = None, chunkify: "bool | None" = None, + entropy_commitment: "bytes | None" = None, ) -> None: pass @@ -3870,6 +3872,7 @@ if TYPE_CHECKING: access_list: "list[EthereumAccessList]" definitions: "EthereumDefinitions | None" chunkify: "bool | None" + entropy_commitment: "bytes | None" def __init__( self, @@ -3887,6 +3890,7 @@ if TYPE_CHECKING: data_initial_chunk: "bytes | None" = None, definitions: "EthereumDefinitions | None" = None, chunkify: "bool | None" = None, + entropy_commitment: "bytes | None" = None, ) -> None: pass @@ -3899,6 +3903,7 @@ if TYPE_CHECKING: signature_v: "int | None" signature_r: "bytes | None" signature_s: "bytes | None" + nonce_commitment: "bytes | None" def __init__( self, @@ -3907,6 +3912,7 @@ if TYPE_CHECKING: signature_v: "int | None" = None, signature_r: "bytes | None" = None, signature_s: "bytes | None" = None, + nonce_commitment: "bytes | None" = None, ) -> None: pass @@ -3916,11 +3922,13 @@ if TYPE_CHECKING: class EthereumTxAck(protobuf.MessageType): data_chunk: "bytes" + entropy: "bytes | None" def __init__( self, *, data_chunk: "bytes", + entropy: "bytes | None" = None, ) -> None: pass diff --git a/legacy/firmware/protob/messages-ethereum.options b/legacy/firmware/protob/messages-ethereum.options index cebf7c1cb5..27f8b36aa5 100644 --- a/legacy/firmware/protob/messages-ethereum.options +++ b/legacy/firmware/protob/messages-ethereum.options @@ -5,6 +5,7 @@ EthereumSignTx.gas_limit max_size:32 EthereumSignTx.to max_size:43 EthereumSignTx.value max_size:32 EthereumSignTx.data_initial_chunk max_size:1024 +EthereumSignTx.entropy_commitment max_size:32 EthereumSignTxEIP1559.address_n max_count:8 EthereumSignTxEIP1559.nonce max_size:32 @@ -15,14 +16,17 @@ EthereumSignTxEIP1559.to max_size:43 EthereumSignTxEIP1559.value max_size:32 EthereumSignTxEIP1559.data_initial_chunk max_size:1024 EthereumSignTxEIP1559.access_list max_count:8 +EthereumSignTxEIP1559.entropy_commitment max_size:32 EthereumAccessList.address max_size:43 EthereumAccessList.storage_keys max_count:8 max_size:32 EthereumTxRequest.signature_r max_size:32 EthereumTxRequest.signature_s max_size:32 +EthereumTxRequest.nonce_commitment max_size:32 EthereumTxAck.data_chunk max_size:1024 +EthereumTxAck.entropy max_size:32 EthereumSignMessage.address_n max_count:8 EthereumSignMessage.message max_size:1024 diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index 412b4410e7..0541234134 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -5203,6 +5203,7 @@ class EthereumSignTx(protobuf.MessageType): 10: protobuf.Field("tx_type", "uint32", repeated=False, required=False, default=None), 12: protobuf.Field("definitions", "EthereumDefinitions", repeated=False, required=False, default=None), 13: protobuf.Field("chunkify", "bool", repeated=False, required=False, default=None), + 14: protobuf.Field("entropy_commitment", "bytes", repeated=False, required=False, default=None), } def __init__( @@ -5220,6 +5221,7 @@ class EthereumSignTx(protobuf.MessageType): tx_type: Optional["int"] = None, definitions: Optional["EthereumDefinitions"] = None, chunkify: Optional["bool"] = None, + entropy_commitment: Optional["bytes"] = None, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.gas_price = gas_price @@ -5233,6 +5235,7 @@ class EthereumSignTx(protobuf.MessageType): self.tx_type = tx_type self.definitions = definitions self.chunkify = chunkify + self.entropy_commitment = entropy_commitment class EthereumSignTxEIP1559(protobuf.MessageType): @@ -5251,6 +5254,7 @@ class EthereumSignTxEIP1559(protobuf.MessageType): 11: protobuf.Field("access_list", "EthereumAccessList", repeated=True, required=False, default=None), 12: protobuf.Field("definitions", "EthereumDefinitions", repeated=False, required=False, default=None), 13: protobuf.Field("chunkify", "bool", repeated=False, required=False, default=None), + 14: protobuf.Field("entropy_commitment", "bytes", repeated=False, required=False, default=None), } def __init__( @@ -5269,6 +5273,7 @@ class EthereumSignTxEIP1559(protobuf.MessageType): data_initial_chunk: Optional["bytes"] = b'', definitions: Optional["EthereumDefinitions"] = None, chunkify: Optional["bool"] = None, + entropy_commitment: Optional["bytes"] = None, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.access_list: Sequence["EthereumAccessList"] = access_list if access_list is not None else [] @@ -5283,6 +5288,7 @@ class EthereumSignTxEIP1559(protobuf.MessageType): self.data_initial_chunk = data_initial_chunk self.definitions = definitions self.chunkify = chunkify + self.entropy_commitment = entropy_commitment class EthereumTxRequest(protobuf.MessageType): @@ -5292,6 +5298,7 @@ class EthereumTxRequest(protobuf.MessageType): 2: protobuf.Field("signature_v", "uint32", repeated=False, required=False, default=None), 3: protobuf.Field("signature_r", "bytes", repeated=False, required=False, default=None), 4: protobuf.Field("signature_s", "bytes", repeated=False, required=False, default=None), + 5: protobuf.Field("nonce_commitment", "bytes", repeated=False, required=False, default=None), } def __init__( @@ -5301,25 +5308,30 @@ class EthereumTxRequest(protobuf.MessageType): signature_v: Optional["int"] = None, signature_r: Optional["bytes"] = None, signature_s: Optional["bytes"] = None, + nonce_commitment: Optional["bytes"] = None, ) -> None: self.data_length = data_length self.signature_v = signature_v self.signature_r = signature_r self.signature_s = signature_s + self.nonce_commitment = nonce_commitment class EthereumTxAck(protobuf.MessageType): MESSAGE_WIRE_TYPE = 60 FIELDS = { 1: protobuf.Field("data_chunk", "bytes", repeated=False, required=True), + 2: protobuf.Field("entropy", "bytes", repeated=False, required=False, default=None), } def __init__( self, *, data_chunk: "bytes", + entropy: Optional["bytes"] = None, ) -> None: self.data_chunk = data_chunk + self.entropy = entropy class EthereumSignMessage(protobuf.MessageType): diff --git a/rust/trezor-client/src/protos/generated/messages_ethereum.rs b/rust/trezor-client/src/protos/generated/messages_ethereum.rs index 98650c8319..24acddc20a 100644 --- a/rust/trezor-client/src/protos/generated/messages_ethereum.rs +++ b/rust/trezor-client/src/protos/generated/messages_ethereum.rs @@ -868,6 +868,8 @@ pub struct EthereumSignTx { pub definitions: ::protobuf::MessageField, // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.chunkify) pub chunkify: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTx.entropy_commitment) + pub entropy_commitment: ::std::option::Option<::std::vec::Vec>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignTx.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -1176,8 +1178,44 @@ impl EthereumSignTx { self.chunkify = ::std::option::Option::Some(v); } + // optional bytes entropy_commitment = 14; + + pub fn entropy_commitment(&self) -> &[u8] { + match self.entropy_commitment.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_entropy_commitment(&mut self) { + self.entropy_commitment = ::std::option::Option::None; + } + + pub fn has_entropy_commitment(&self) -> bool { + self.entropy_commitment.is_some() + } + + // Param is passed by value, moved + pub fn set_entropy_commitment(&mut self, v: ::std::vec::Vec) { + self.entropy_commitment = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_entropy_commitment(&mut self) -> &mut ::std::vec::Vec { + if self.entropy_commitment.is_none() { + self.entropy_commitment = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.entropy_commitment.as_mut().unwrap() + } + + // Take field + pub fn take_entropy_commitment(&mut self) -> ::std::vec::Vec { + self.entropy_commitment.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(12); + let mut fields = ::std::vec::Vec::with_capacity(13); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "address_n", @@ -1239,6 +1277,11 @@ impl EthereumSignTx { |m: &EthereumSignTx| { &m.chunkify }, |m: &mut EthereumSignTx| { &mut m.chunkify }, )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "entropy_commitment", + |m: &EthereumSignTx| { &m.entropy_commitment }, + |m: &mut EthereumSignTx| { &mut m.entropy_commitment }, + )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "EthereumSignTx", fields, @@ -1310,6 +1353,9 @@ impl ::protobuf::Message for EthereumSignTx { 104 => { self.chunkify = ::std::option::Option::Some(is.read_bool()?); }, + 114 => { + self.entropy_commitment = ::std::option::Option::Some(is.read_bytes()?); + }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, @@ -1359,6 +1405,9 @@ impl ::protobuf::Message for EthereumSignTx { if let Some(v) = self.chunkify { my_size += 1 + 1; } + if let Some(v) = self.entropy_commitment.as_ref() { + my_size += ::protobuf::rt::bytes_size(14, &v); + } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size @@ -1401,6 +1450,9 @@ impl ::protobuf::Message for EthereumSignTx { if let Some(v) = self.chunkify { os.write_bool(13, v)?; } + if let Some(v) = self.entropy_commitment.as_ref() { + os.write_bytes(14, v)?; + } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } @@ -1430,6 +1482,7 @@ impl ::protobuf::Message for EthereumSignTx { self.tx_type = ::std::option::Option::None; self.definitions.clear(); self.chunkify = ::std::option::Option::None; + self.entropy_commitment = ::std::option::Option::None; self.special_fields.clear(); } @@ -1447,6 +1500,7 @@ impl ::protobuf::Message for EthereumSignTx { tx_type: ::std::option::Option::None, definitions: ::protobuf::MessageField::none(), chunkify: ::std::option::Option::None, + entropy_commitment: ::std::option::Option::None, special_fields: ::protobuf::SpecialFields::new(), }; &instance @@ -1500,6 +1554,8 @@ pub struct EthereumSignTxEIP1559 { pub definitions: ::protobuf::MessageField, // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.chunkify) pub chunkify: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.entropy_commitment) + pub entropy_commitment: ::std::option::Option<::std::vec::Vec>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumSignTxEIP1559.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -1825,8 +1881,44 @@ impl EthereumSignTxEIP1559 { self.chunkify = ::std::option::Option::Some(v); } + // optional bytes entropy_commitment = 14; + + pub fn entropy_commitment(&self) -> &[u8] { + match self.entropy_commitment.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_entropy_commitment(&mut self) { + self.entropy_commitment = ::std::option::Option::None; + } + + pub fn has_entropy_commitment(&self) -> bool { + self.entropy_commitment.is_some() + } + + // Param is passed by value, moved + pub fn set_entropy_commitment(&mut self, v: ::std::vec::Vec) { + self.entropy_commitment = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_entropy_commitment(&mut self) -> &mut ::std::vec::Vec { + if self.entropy_commitment.is_none() { + self.entropy_commitment = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.entropy_commitment.as_mut().unwrap() + } + + // Take field + pub fn take_entropy_commitment(&mut self) -> ::std::vec::Vec { + self.entropy_commitment.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(13); + let mut fields = ::std::vec::Vec::with_capacity(14); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "address_n", @@ -1893,6 +1985,11 @@ impl EthereumSignTxEIP1559 { |m: &EthereumSignTxEIP1559| { &m.chunkify }, |m: &mut EthereumSignTxEIP1559| { &mut m.chunkify }, )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "entropy_commitment", + |m: &EthereumSignTxEIP1559| { &m.entropy_commitment }, + |m: &mut EthereumSignTxEIP1559| { &mut m.entropy_commitment }, + )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "EthereumSignTxEIP1559", fields, @@ -1984,6 +2081,9 @@ impl ::protobuf::Message for EthereumSignTxEIP1559 { 104 => { self.chunkify = ::std::option::Option::Some(is.read_bool()?); }, + 114 => { + self.entropy_commitment = ::std::option::Option::Some(is.read_bytes()?); + }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, @@ -2037,6 +2137,9 @@ impl ::protobuf::Message for EthereumSignTxEIP1559 { if let Some(v) = self.chunkify { my_size += 1 + 1; } + if let Some(v) = self.entropy_commitment.as_ref() { + my_size += ::protobuf::rt::bytes_size(14, &v); + } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size @@ -2082,6 +2185,9 @@ impl ::protobuf::Message for EthereumSignTxEIP1559 { if let Some(v) = self.chunkify { os.write_bool(13, v)?; } + if let Some(v) = self.entropy_commitment.as_ref() { + os.write_bytes(14, v)?; + } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } @@ -2112,6 +2218,7 @@ impl ::protobuf::Message for EthereumSignTxEIP1559 { self.access_list.clear(); self.definitions.clear(); self.chunkify = ::std::option::Option::None; + self.entropy_commitment = ::std::option::Option::None; self.special_fields.clear(); } @@ -2130,6 +2237,7 @@ impl ::protobuf::Message for EthereumSignTxEIP1559 { access_list: ::std::vec::Vec::new(), definitions: ::protobuf::MessageField::none(), chunkify: ::std::option::Option::None, + entropy_commitment: ::std::option::Option::None, special_fields: ::protobuf::SpecialFields::new(), }; &instance @@ -2347,6 +2455,8 @@ pub struct EthereumTxRequest { pub signature_r: ::std::option::Option<::std::vec::Vec>, // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxRequest.signature_s) pub signature_s: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxRequest.nonce_commitment) + pub nonce_commitment: ::std::option::Option<::std::vec::Vec>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumTxRequest.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -2473,8 +2583,44 @@ impl EthereumTxRequest { self.signature_s.take().unwrap_or_else(|| ::std::vec::Vec::new()) } + // optional bytes nonce_commitment = 5; + + pub fn nonce_commitment(&self) -> &[u8] { + match self.nonce_commitment.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_nonce_commitment(&mut self) { + self.nonce_commitment = ::std::option::Option::None; + } + + pub fn has_nonce_commitment(&self) -> bool { + self.nonce_commitment.is_some() + } + + // Param is passed by value, moved + pub fn set_nonce_commitment(&mut self, v: ::std::vec::Vec) { + self.nonce_commitment = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_nonce_commitment(&mut self) -> &mut ::std::vec::Vec { + if self.nonce_commitment.is_none() { + self.nonce_commitment = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.nonce_commitment.as_mut().unwrap() + } + + // Take field + pub fn take_nonce_commitment(&mut self) -> ::std::vec::Vec { + self.nonce_commitment.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(4); + let mut fields = ::std::vec::Vec::with_capacity(5); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( "data_length", @@ -2496,6 +2642,11 @@ impl EthereumTxRequest { |m: &EthereumTxRequest| { &m.signature_s }, |m: &mut EthereumTxRequest| { &mut m.signature_s }, )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "nonce_commitment", + |m: &EthereumTxRequest| { &m.nonce_commitment }, + |m: &mut EthereumTxRequest| { &mut m.nonce_commitment }, + )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "EthereumTxRequest", fields, @@ -2526,6 +2677,9 @@ impl ::protobuf::Message for EthereumTxRequest { 34 => { self.signature_s = ::std::option::Option::Some(is.read_bytes()?); }, + 42 => { + self.nonce_commitment = ::std::option::Option::Some(is.read_bytes()?); + }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, @@ -2550,6 +2704,9 @@ impl ::protobuf::Message for EthereumTxRequest { if let Some(v) = self.signature_s.as_ref() { my_size += ::protobuf::rt::bytes_size(4, &v); } + if let Some(v) = self.nonce_commitment.as_ref() { + my_size += ::protobuf::rt::bytes_size(5, &v); + } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size @@ -2568,6 +2725,9 @@ impl ::protobuf::Message for EthereumTxRequest { if let Some(v) = self.signature_s.as_ref() { os.write_bytes(4, v)?; } + if let Some(v) = self.nonce_commitment.as_ref() { + os.write_bytes(5, v)?; + } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } @@ -2589,6 +2749,7 @@ impl ::protobuf::Message for EthereumTxRequest { self.signature_v = ::std::option::Option::None; self.signature_r = ::std::option::Option::None; self.signature_s = ::std::option::Option::None; + self.nonce_commitment = ::std::option::Option::None; self.special_fields.clear(); } @@ -2598,6 +2759,7 @@ impl ::protobuf::Message for EthereumTxRequest { signature_v: ::std::option::Option::None, signature_r: ::std::option::Option::None, signature_s: ::std::option::Option::None, + nonce_commitment: ::std::option::Option::None, special_fields: ::protobuf::SpecialFields::new(), }; &instance @@ -2627,6 +2789,8 @@ pub struct EthereumTxAck { // message fields // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxAck.data_chunk) pub data_chunk: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.ethereum.EthereumTxAck.entropy) + pub entropy: ::std::option::Option<::std::vec::Vec>, // special fields // @@protoc_insertion_point(special_field:hw.trezor.messages.ethereum.EthereumTxAck.special_fields) pub special_fields: ::protobuf::SpecialFields, @@ -2679,14 +2843,55 @@ impl EthereumTxAck { self.data_chunk.take().unwrap_or_else(|| ::std::vec::Vec::new()) } + // optional bytes entropy = 2; + + pub fn entropy(&self) -> &[u8] { + match self.entropy.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_entropy(&mut self) { + self.entropy = ::std::option::Option::None; + } + + pub fn has_entropy(&self) -> bool { + self.entropy.is_some() + } + + // Param is passed by value, moved + pub fn set_entropy(&mut self, v: ::std::vec::Vec) { + self.entropy = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_entropy(&mut self) -> &mut ::std::vec::Vec { + if self.entropy.is_none() { + self.entropy = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.entropy.as_mut().unwrap() + } + + // Take field + pub fn take_entropy(&mut self) -> ::std::vec::Vec { + self.entropy.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(1); + let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( "data_chunk", |m: &EthereumTxAck| { &m.data_chunk }, |m: &mut EthereumTxAck| { &mut m.data_chunk }, )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "entropy", + |m: &EthereumTxAck| { &m.entropy }, + |m: &mut EthereumTxAck| { &mut m.entropy }, + )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "EthereumTxAck", fields, @@ -2711,6 +2916,9 @@ impl ::protobuf::Message for EthereumTxAck { 10 => { self.data_chunk = ::std::option::Option::Some(is.read_bytes()?); }, + 18 => { + self.entropy = ::std::option::Option::Some(is.read_bytes()?); + }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, @@ -2726,6 +2934,9 @@ impl ::protobuf::Message for EthereumTxAck { if let Some(v) = self.data_chunk.as_ref() { my_size += ::protobuf::rt::bytes_size(1, &v); } + if let Some(v) = self.entropy.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size @@ -2735,6 +2946,9 @@ impl ::protobuf::Message for EthereumTxAck { if let Some(v) = self.data_chunk.as_ref() { os.write_bytes(1, v)?; } + if let Some(v) = self.entropy.as_ref() { + os.write_bytes(2, v)?; + } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } @@ -2753,12 +2967,14 @@ impl ::protobuf::Message for EthereumTxAck { fn clear(&mut self) { self.data_chunk = ::std::option::Option::None; + self.entropy = ::std::option::Option::None; self.special_fields.clear(); } fn default_instance() -> &'static EthereumTxAck { static instance: EthereumTxAck = EthereumTxAck { data_chunk: ::std::option::Option::None, + entropy: ::std::option::Option::None, special_fields: ::protobuf::SpecialFields::new(), }; &instance @@ -4105,7 +4321,7 @@ static file_descriptor_proto_data: &'static [u8] = b"\ lay\x12'\n\x0fencoded_network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\ \x12\x1a\n\x08chunkify\x18\x04\x20\x01(\x08R\x08chunkify\"Q\n\x0fEthereu\ mAddress\x12$\n\x0c_old_address\x18\x01\x20\x01(\x0cR\nOldAddressB\x02\ - \x18\x01\x12\x18\n\x07address\x18\x02\x20\x01(\tR\x07address\"\xad\x03\n\ + \x18\x01\x12\x18\n\x07address\x18\x02\x20\x01(\tR\x07address\"\xdc\x03\n\ \x0eEthereumSignTx\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ \x12\x16\n\x05nonce\x18\x02\x20\x01(\x0c:\0R\x05nonce\x12\x1b\n\tgas_pri\ ce\x18\x03\x20\x02(\x0cR\x08gasPrice\x12\x1b\n\tgas_limit\x18\x04\x20\ @@ -4116,7 +4332,8 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x02(\x04R\x07chainId\x12\x17\n\x07tx_type\x18\n\x20\x01(\rR\x06txType\ \x12^\n\x0bdefinitions\x18\x0c\x20\x01(\x0b2<.hw.trezor.messages.ethereu\ m_definitions.EthereumDefinitionsR\x0bdefinitions\x12\x1a\n\x08chunkify\ - \x18\r\x20\x01(\x08R\x08chunkify\"\xfc\x04\n\x15EthereumSignTxEIP1559\ + \x18\r\x20\x01(\x08R\x08chunkify\x12-\n\x12entropy_commitment\x18\x0e\ + \x20\x01(\x0cR\x11entropyCommitment\"\xab\x05\n\x15EthereumSignTxEIP1559\ \x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x14\n\x05nonce\ \x18\x02\x20\x02(\x0cR\x05nonce\x12\x1e\n\x0bmax_gas_fee\x18\x03\x20\x02\ (\x0cR\tmaxGasFee\x12(\n\x10max_priority_fee\x18\x04\x20\x02(\x0cR\x0ema\ @@ -4129,29 +4346,32 @@ static file_descriptor_proto_data: &'static [u8] = b"\ xEIP1559.EthereumAccessListR\naccessList\x12^\n\x0bdefinitions\x18\x0c\ \x20\x01(\x0b2<.hw.trezor.messages.ethereum_definitions.EthereumDefiniti\ onsR\x0bdefinitions\x12\x1a\n\x08chunkify\x18\r\x20\x01(\x08R\x08chunkif\ - y\x1aQ\n\x12EthereumAccessList\x12\x18\n\x07address\x18\x01\x20\x02(\tR\ + y\x12-\n\x12entropy_commitment\x18\x0e\x20\x01(\x0cR\x11entropyCommitmen\ + t\x1aQ\n\x12EthereumAccessList\x12\x18\n\x07address\x18\x01\x20\x02(\tR\ \x07address\x12!\n\x0cstorage_keys\x18\x02\x20\x03(\x0cR\x0bstorageKeys\ - \"\x97\x01\n\x11EthereumTxRequest\x12\x1f\n\x0bdata_length\x18\x01\x20\ + \"\xc2\x01\n\x11EthereumTxRequest\x12\x1f\n\x0bdata_length\x18\x01\x20\ \x01(\rR\ndataLength\x12\x1f\n\x0bsignature_v\x18\x02\x20\x01(\rR\nsigna\ tureV\x12\x1f\n\x0bsignature_r\x18\x03\x20\x01(\x0cR\nsignatureR\x12\x1f\ - \n\x0bsignature_s\x18\x04\x20\x01(\x0cR\nsignatureS\".\n\rEthereumTxAck\ - \x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataChunk\"\x91\x01\n\x13E\ - thereumSignMessage\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ - \x12\x18\n\x07message\x18\x02\x20\x02(\x0cR\x07message\x12'\n\x0fencoded\ - _network\x18\x03\x20\x01(\x0cR\x0eencodedNetwork\x12\x1a\n\x08chunkify\ - \x18\x04\x20\x01(\x08R\x08chunkify\"R\n\x18EthereumMessageSignature\x12\ - \x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07address\ - \x18\x03\x20\x02(\tR\x07address\"\x85\x01\n\x15EthereumVerifyMessage\x12\ - \x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07message\ - \x18\x03\x20\x02(\x0cR\x07message\x12\x18\n\x07address\x18\x04\x20\x02(\ - \tR\x07address\x12\x1a\n\x08chunkify\x18\x05\x20\x01(\x08R\x08chunkify\"\ - \xb4\x01\n\x15EthereumSignTypedHash\x12\x1b\n\taddress_n\x18\x01\x20\x03\ - (\rR\x08addressN\x122\n\x15domain_separator_hash\x18\x02\x20\x02(\x0cR\ - \x13domainSeparatorHash\x12!\n\x0cmessage_hash\x18\x03\x20\x01(\x0cR\x0b\ - messageHash\x12'\n\x0fencoded_network\x18\x04\x20\x01(\x0cR\x0eencodedNe\ - twork\"T\n\x1aEthereumTypedDataSignature\x12\x1c\n\tsignature\x18\x01\ - \x20\x02(\x0cR\tsignature\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07ad\ - dressB<\n#com.satoshilabs.trezor.lib.protobufB\x15TrezorMessageEthereum\ + \n\x0bsignature_s\x18\x04\x20\x01(\x0cR\nsignatureS\x12)\n\x10nonce_comm\ + itment\x18\x05\x20\x01(\x0cR\x0fnonceCommitment\"H\n\rEthereumTxAck\x12\ + \x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataChunk\x12\x18\n\x07entropy\ + \x18\x02\x20\x01(\x0cR\x07entropy\"\x91\x01\n\x13EthereumSignMessage\x12\ + \x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x18\n\x07message\ + \x18\x02\x20\x02(\x0cR\x07message\x12'\n\x0fencoded_network\x18\x03\x20\ + \x01(\x0cR\x0eencodedNetwork\x12\x1a\n\x08chunkify\x18\x04\x20\x01(\x08R\ + \x08chunkify\"R\n\x18EthereumMessageSignature\x12\x1c\n\tsignature\x18\ + \x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07address\x18\x03\x20\x02(\tR\ + \x07address\"\x85\x01\n\x15EthereumVerifyMessage\x12\x1c\n\tsignature\ + \x18\x02\x20\x02(\x0cR\tsignature\x12\x18\n\x07message\x18\x03\x20\x02(\ + \x0cR\x07message\x12\x18\n\x07address\x18\x04\x20\x02(\tR\x07address\x12\ + \x1a\n\x08chunkify\x18\x05\x20\x01(\x08R\x08chunkify\"\xb4\x01\n\x15Ethe\ + reumSignTypedHash\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\ + \x122\n\x15domain_separator_hash\x18\x02\x20\x02(\x0cR\x13domainSeparato\ + rHash\x12!\n\x0cmessage_hash\x18\x03\x20\x01(\x0cR\x0bmessageHash\x12'\n\ + \x0fencoded_network\x18\x04\x20\x01(\x0cR\x0eencodedNetwork\"T\n\x1aEthe\ + reumTypedDataSignature\x12\x1c\n\tsignature\x18\x01\x20\x02(\x0cR\tsigna\ + ture\x12\x18\n\x07address\x18\x02\x20\x02(\tR\x07addressB<\n#com.satoshi\ + labs.trezor.lib.protobufB\x15TrezorMessageEthereum\ "; /// `FileDescriptorProto` object which was a source for this generated file