chore(core): reserve channel IDs 0xFFF0 - 0xFFFE for future use [no changelog]
What changed, and why it matters
This commit is a routine housekeeping change in Trezor firmware. It reserves a specific range of channel ID numbers (0xFFF0 to 0xFFFE, plus 0x0000) for future use and adjusts the random channel ID generator so it no longer picks values from that reserved range. There is no indication of a security bug being fixed.
No security action needed. This is a forward-looking reservation of identifier space, not a vulnerability fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change updates core/src/storage/cache_thp.py. It introduces _MAX_CHANNEL_ID = 0xFFEF and comments that 0xFFF0-0xFFFE and 0x0000 are reserved. It changes the random.uniform() upper bound from 0xFFFE to _MAX_CHANNEL_ID, and changes the wrap-around check from >= BROADCAST_CHANNEL_ID to > _MAX_CHANNEL_ID. This prevents future channel IDs from being allocated in the reserved range. The commit is labeled ‘chore’ and ‘[no changelog]’, indicating it is not a security fix.
Changed components
core/src/storage/cache_thp.pyInspect captured patch +7 / −4
diff --git a/core/src/storage/cache_thp.py b/core/src/storage/cache_thp.py
index 9231164d9..4cffddc72 100644
--- a/core/src/storage/cache_thp.py
+++ b/core/src/storage/cache_thp.py
@@ -16,16 +16,19 @@ from storage.cache_common import (
_MAX_CHANNELS_COUNT = const(10)
_MAX_SESSIONS_COUNT = const(20)
-
_CHANNEL_ID_LENGTH = const(2)
SESSION_ID_LENGTH = const(1)
-BROADCAST_CHANNEL_ID = const(0xFFFF)
KEY_LENGTH = const(32)
TAG_LENGTH = const(16)
+
_UNALLOCATED_STATE = const(0)
_ALLOCATED_STATE = const(1)
_SEEDLESS_STATE = const(2)
+_MAX_CHANNEL_ID = const(0xFFEF)
+# Channel IDs from 0xFFF0 to 0xFFFE, and 0x0000, are reserved for future use
+BROADCAST_CHANNEL_ID = const(0xFFFF)
+
class ThpDataCache(DataCache):
@@ -136,7 +139,7 @@ def initialize() -> None:
from trezorcrypto import random
- cid_counter = random.uniform(0xFFFE)
+ cid_counter = random.uniform(_MAX_CHANNEL_ID)
def get_new_channel() -> ChannelCache:
@@ -328,7 +331,7 @@ def get_next_channel_id() -> bytes:
global cid_counter
while True:
cid_counter += 1
- if cid_counter >= BROADCAST_CHANNEL_ID:
+ if cid_counter > _MAX_CHANNEL_ID:
cid_counter = 1
if _is_cid_unique():
break
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.