mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-13 06:36:06 +00:00
chore(core): remove deprecated methods from cache_thp
[no changelog]
This commit is contained in:
parent
cb8b0e2728
commit
b8982f5bf1
@ -288,26 +288,6 @@ def get_next_channel_id() -> bytes:
|
|||||||
return cid_counter.to_bytes(_CHANNEL_ID_LENGTH, "big")
|
return cid_counter.to_bytes(_CHANNEL_ID_LENGTH, "big")
|
||||||
|
|
||||||
|
|
||||||
def _deprecated_get_next_session_id(channel: ChannelCache) -> bytes:
|
|
||||||
while True:
|
|
||||||
if channel.session_id_counter >= 255:
|
|
||||||
channel.session_id_counter = 1
|
|
||||||
else:
|
|
||||||
channel.session_id_counter += 1
|
|
||||||
if _deprecated_is_session_id_unique(channel):
|
|
||||||
break
|
|
||||||
new_sid = channel.session_id_counter
|
|
||||||
return new_sid.to_bytes(SESSION_ID_LENGTH, "big")
|
|
||||||
|
|
||||||
|
|
||||||
def _deprecated_is_session_id_unique(channel: ChannelCache) -> bool:
|
|
||||||
for session in _SESSIONS:
|
|
||||||
if session.channel_id == channel.channel_id:
|
|
||||||
if session.session_id == channel.session_id_counter:
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def _is_cid_unique() -> bool:
|
def _is_cid_unique() -> bool:
|
||||||
global cid_counter
|
global cid_counter
|
||||||
cid_counter_bytes = cid_counter.to_bytes(_CHANNEL_ID_LENGTH, "big")
|
cid_counter_bytes = cid_counter.to_bytes(_CHANNEL_ID_LENGTH, "big")
|
||||||
|
Loading…
Reference in New Issue
Block a user