1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-04 13:38:28 +00:00

fixup! refactor(core): improve readability and logging in channel.py [no changelog]

This commit is contained in:
M1nd3r 2024-12-03 17:25:26 +01:00
parent f6ea5ea630
commit 2b07f499d2

View File

@ -29,7 +29,7 @@ from .writer import (
)
if __debug__:
from ubinascii import hexlify
from trezor.utils import get_bytes_as_str
from . import state_to_str
@ -194,19 +194,19 @@ class Channel:
assert nonce_receive is not None
if __debug__ and utils.ALLOW_DEBUG_MESSAGES:
self._log("Buffer before decryption: ", hexlify(noise_buffer))
self._log("Buffer before decryption: ", get_bytes_as_str(noise_buffer))
is_tag_valid = crypto.dec(
noise_buffer, tag, key_receive, nonce_receive, b""
)
if __debug__ and utils.ALLOW_DEBUG_MESSAGES:
self._log("Buffer after decryption: ", hexlify(noise_buffer))
self._log("Buffer after decryption: ", get_bytes_as_str(noise_buffer))
self.channel_cache.set_int(CHANNEL_NONCE_RECEIVE, nonce_receive + 1)
if __debug__ and utils.ALLOW_DEBUG_MESSAGES:
self._log("Is decrypted tag valid? ", str(is_tag_valid))
self._log("Received tag: ", hexlify(tag).decode())
self._log("Received tag: ", get_bytes_as_str(tag))
self._log("New nonce_receive: ", str((nonce_receive + 1)))
if not is_tag_valid: