mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-27 14:52:10 +00:00
wip
This commit is contained in:
parent
34ae443d82
commit
8599e2d320
@ -355,6 +355,7 @@ class Channel:
|
|||||||
ENCRYPTED_TRANSPORT, memoryview(self.buffer[:payload_length])
|
ENCRYPTED_TRANSPORT, memoryview(self.buffer[:payload_length])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
utils.print_and_update_alloc("After establishing write task spawn")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def write_handshake_message(self, ctrl_byte: int, payload: bytes) -> None:
|
def write_handshake_message(self, ctrl_byte: int, payload: bytes) -> None:
|
||||||
@ -370,6 +371,8 @@ class Channel:
|
|||||||
async def _write_encrypted_payload_loop(
|
async def _write_encrypted_payload_loop(
|
||||||
self, ctrl_byte: int, payload: bytes
|
self, ctrl_byte: int, payload: bytes
|
||||||
) -> None:
|
) -> None:
|
||||||
|
utils.print_and_update_alloc("Write encrypted payload loop start")
|
||||||
|
|
||||||
if __debug__ and utils.ALLOW_DEBUG_MESSAGES:
|
if __debug__ and utils.ALLOW_DEBUG_MESSAGES:
|
||||||
log.debug(
|
log.debug(
|
||||||
__name__,
|
__name__,
|
||||||
@ -381,12 +384,16 @@ class Channel:
|
|||||||
ctrl_byte = control_byte.add_seq_bit_to_ctrl_byte(ctrl_byte, sync_bit)
|
ctrl_byte = control_byte.add_seq_bit_to_ctrl_byte(ctrl_byte, sync_bit)
|
||||||
header = PacketHeader(ctrl_byte, self.get_channel_id_int(), payload_len)
|
header = PacketHeader(ctrl_byte, self.get_channel_id_int(), payload_len)
|
||||||
self.transmission_loop = TransmissionLoop(self, header, payload)
|
self.transmission_loop = TransmissionLoop(self, header, payload)
|
||||||
|
utils.print_and_update_alloc("Write encrypted payload loop before transmission")
|
||||||
|
|
||||||
await self.transmission_loop.start()
|
await self.transmission_loop.start()
|
||||||
|
utils.print_and_update_alloc("Write encrypted payload loop after transmission")
|
||||||
|
|
||||||
ABP.set_send_seq_bit_to_opposite(self.channel_cache)
|
ABP.set_send_seq_bit_to_opposite(self.channel_cache)
|
||||||
|
|
||||||
# Let the main loop be restarted and clear loop, if there is no other
|
# Let the main loop be restarted and clear loop, if there is no other
|
||||||
# workflow and the state is ENCRYPTED_TRANSPORT
|
# workflow and the state is ENCRYPTED_TRANSPORT
|
||||||
|
|
||||||
if self._can_clear_loop():
|
if self._can_clear_loop():
|
||||||
if __debug__ and utils.ALLOW_DEBUG_MESSAGES:
|
if __debug__ and utils.ALLOW_DEBUG_MESSAGES:
|
||||||
log.debug(
|
log.debug(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from micropython import const
|
from micropython import const
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from trezor import loop
|
from trezor import loop, utils
|
||||||
from trezor.wire.thp.thp_messages import PacketHeader
|
from trezor.wire.thp.thp_messages import PacketHeader
|
||||||
from trezor.wire.thp.writer import write_payload_to_wire_and_add_checksum
|
from trezor.wire.thp.writer import write_payload_to_wire_and_add_checksum
|
||||||
|
|
||||||
@ -24,6 +24,7 @@ class TransmissionLoop:
|
|||||||
self.min_retransmisson_count_achieved: bool = False
|
self.min_retransmisson_count_achieved: bool = False
|
||||||
|
|
||||||
async def start(self, max_retransmission_count: int = MAX_RETRANSMISSION_COUNT):
|
async def start(self, max_retransmission_count: int = MAX_RETRANSMISSION_COUNT):
|
||||||
|
utils.print_and_update_alloc("TransmissionLoop - start of start")
|
||||||
self.min_retransmisson_count_achieved = False
|
self.min_retransmisson_count_achieved = False
|
||||||
for i in range(max_retransmission_count):
|
for i in range(max_retransmission_count):
|
||||||
if i >= MIN_RETRANSMISSION_COUNT:
|
if i >= MIN_RETRANSMISSION_COUNT:
|
||||||
|
Loading…
Reference in New Issue
Block a user