chore(core): move `trezor.crypto.cosi` module to unittests
What changed, and why it matters
This commit removes an unused cryptography helper module from the actual Trezor firmware and keeps it only in the test suite. There is no security bug being fixed here; it is a routine cleanup to avoid shipping dead code.
No security action required. Treat as ordinary code hygiene; verify that no production code still imports `trezor.crypto.cosi` before release.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit drops cosi from the frozen MicroPython qstr definitions (qstrdefsport.h) so it is no longer compiled into firmware, and updates test files to import a local cosi_helpers.py instead of trezor.crypto.cosi. The functionality remains available for unit tests but is no longer reachable in production firmware.
Changed components
core/embed/upymod/qstrdefsport.hcore/tests/cosi_helpers.pycore/tests/ethereum_common.pycore/tests/test_trezor.crypto.cosi.pyInspect captured patch +4 / −5
### core/embed/upymod/qstrdefsport.h
@@ -211,7 +211,6 @@ Q(coininfo)
Q(coins)
Q(common)
Q(context)
-Q(cosi)
Q(crypto)
Q(curve)
Q(curve_benchmark)
@@ -330,7 +329,6 @@ Q(trezor.crypto.base32)
Q(trezor.crypto.base58)
Q(trezor.crypto.bech32)
Q(trezor.crypto.cashaddr)
-Q(trezor.crypto.cosi)
Q(trezor.crypto.curve)
Q(trezor.crypto.der)
Q(trezor.crypto.hashlib)
### core/tests/cosi_helpers.py
@@ -1,6 +1,6 @@
from typing import TYPE_CHECKING
-from .curve import ed25519
+from trezor.crypto.curve import ed25519
if TYPE_CHECKING:
from buffer_types import AnyBytes
### core/tests/ethereum_common.py
@@ -1,5 +1,5 @@
+import cosi_helpers as cosi
from trezor import messages, protobuf
-from trezor.crypto import cosi
from trezor.crypto.curve import ed25519
from trezor.crypto.hashlib import sha256
from trezor.enums import DefinitionType
### core/tests/test_trezor.crypto.cosi.py
@@ -1,7 +1,8 @@
# flake8: noqa: F403,F405
from common import * # isort:skip
-from trezor.crypto import cosi, random
+import cosi_helpers as cosi
+from trezor.crypto import random
from trezor.crypto.curve import ed25519
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.