Commit Graph

438 Commits

Author SHA1 Message Date
Martin Pastyřík
589fd84b4b chore(core): remove double check when changing pin
[no changelog]
2026-02-06 16:17:37 +01:00
M1nd3r
07676315a9 chore(core): clean python der implementation
[no changelog]
2026-01-30 16:10:09 +01:00
M1nd3r
7b9a96e176 chore(core/test): improve python unit test class-level skipping
[no changelog]

Co-authored-by: romanz <9900+romanz@users.noreply.github.com>
2026-01-30 11:32:29 +01:00
M1nd3r
a9a1b9fd04 fix(core/tests): use decorator for unit tests skipping
[no changelog]
2026-01-30 11:32:29 +01:00
M1nd3r
5682a253f9 chore(core): slip21 keychain and path improvements
[no changelog]
2026-01-29 17:59:22 +01:00
Martin Pastyřík
9b1c06205c fix(crypto): Fix side-channel vulnerability in BIP-39 mnemonic processing
Fix function `mnemonic_to_bits` to be constant time. Replace binary search over the wordlist with a linear search to ensure the same number of comparisons.
Introduce function `constant_time_memeq` that comapres two parts of memory in costant time.
Remove integrity check in legacy to reduce the number of computations over seed.

(cherry picked from commit 4e6f0dee81)
2026-01-26 14:50:50 +01:00
Roman Zeyde
258a828676 test(core): avoid manipulating sys.path
[no changelog]
2026-01-15 10:58:43 +01:00
M1nd3r
2ea5146f8d test(core): change key_index used in crypto.tropic::test_sign unittest 2026-01-02 19:10:13 +01:00
M1nd3r
66822c34cb tests(core): fix imports in python unit tests
- remove redundant imports (utils, unittest)
- unify import `from common import`
2026-01-02 19:10:13 +01:00
Ioan Bizău
0bd5e776f7 fix: raise exceptions
[no changelog]
2025-11-19 18:31:26 +02:00
Roman Zeyde
672622c93e fix(core): make sure to increment THP seq_bit
Make it compatible with Suite behaviour in case the last THP ACK is lost.
2025-11-18 08:50:16 +01:00
Jun Luo
590d3e98b2 feat(common,core,python,tests): add tron.get_address support.
[no changelog]
2025-11-12 10:07:50 +01:00
Martin Pastyřík
d2516f1d07 feat(core): functions for Evolu spam protection
[no changelog]
2025-11-05 10:22:37 +01:00
Ioan Bizău
c1559ce851 fix(ui): break on unit
[no changelog]
2025-11-05 07:55:31 +02:00
Martin Pastyřík
59aeeb2e32 chore(test): update Cardano unit tests to use saved binary mnemonic
[no changelog]
2025-10-27 17:30:20 +01:00
M1nd3r
c13df22a6e test(core): add unit tests for PaymentRequestVerifier
[no changelog]
2025-10-27 17:15:32 +01:00
Martin Milata
675d107e9a refactor(core): rename pairing_cache to pairing_names
In the context of storage what we call cache does not persists across
reboots but this structure does.

[no changelog]
2025-10-20 17:29:15 +02:00
Roman Zeyde
456ea7d5d6 feat(core+python): support device unlocking during THP handshake
Add a flag to the first THP handshake message, so the device can:

- fail the handshake if the device is locked (current behavior)
- prompt the user to enter the PIN (similar to other non-pairing flows)

NOTE: This is a backward-incompatible change, so Suite THP implementation MUST be adapted as well.

Co-authored-by: M1nd3r <petrsedlacek.km@seznam.cz>
2025-10-06 11:20:33 +02:00
Roman Zeyde
5bab202950 chore(core): make host_name & app_name required also in ThpCredentialMetadata
[no changelog]
2025-09-25 18:27:11 +03:00
Roman Zeyde
b9411a6bc1 chore(core): move paired_cache to trezor.wire.thp
Also, log `ThpPairedCache`-related events.

[no changelog]
2025-09-25 18:27:11 +03:00
Lukas Bielesch
a80a1d0045 feat(core/eckhart): cache THP app/host name along with MAC
[no changelog]

Co-authored-by: Martin Milata <martin@martinmilata.cz>
2025-09-21 21:55:50 +02:00
Andrew Kozlik
41cd4bbfcf feat(core): Use correct pairing keys in Tropic handshake. 2025-09-18 18:37:58 +02:00
Andrew Kozlik
37b0c3684f refactor(core): Move Tropic constants to tropic.h.
[no changelog]
2025-09-18 18:37:58 +02:00
Roman Zeyde
2260cf4e2f feat(core): allow caching recent THP paired hostnames and MAC addresses
Only entries with bonded MAC addresses will be stored.

[no changelog]
2025-09-11 15:07:36 +03:00
Roman Zeyde
49f4537355 feat(core): trim strings to specific bytes' limit
[no changelog]
2025-09-10 18:17:06 +03:00
M1nd3r
60cc5c0640 refactor(core): replace all Union usage by | syntax in core except core/vendor
[no changelog]
2025-09-09 12:09:47 +02:00
matejcik
87f5f12d64 style: update to black 25 style, silence new flake8 warnings
[no changelog]
2025-09-08 16:27:44 +02:00
Roman Zeyde
50b57d6ce3 feat(core): allow preempting stale THP channels on all interfaces
Instead of running 2 separate THP session handling tasks
(on USB & BLE interfaces), this PR uses a single task, which
will handle both - in order to allow preempting the event loop
in case there is an unresponsive channel.

`ThpContext` is split into interface-specific class (`InterfaceContext`)
and a "global" THP receiver (`ThpContext`).

Also, removing `core/tests/test_trezor.wire.thp.py` - to be reimplemented in a following PR.

[no changelog]
2025-08-29 21:02:59 +03:00
Roman Zeyde
c320020822 feat(core): reimplement THP event loop restarts
[no changelog]
2025-08-21 14:46:02 +03:00
Ondřej Vejpustek
b7f2e6f5f4 feat(core): remove tropic.get_certificate()
[no changelog]
2025-08-18 15:06:47 +02:00
Roman Zeyde
e1b56022da refactor(core): simplify THP write-related code
- move fragmentation code into `PacketHeader.fragment_payload()`
- use `ThpContext.write_payload()` to send responses to the host
- precompute `INIT_HEADER_LENGTH` and `CONT_HEADER_LENGTH`
- remove most of `trezor.write.thp.writer` code

[no changelog]
2025-08-12 11:49:25 +03:00
Roman Zeyde
697c3a54c6 chore(core): export memzero() via trezor.utils
[no changelog]
2025-08-12 11:49:25 +03:00
Roman Zeyde
18db6c9478 refactor(core): introduce ThpContext
This PR moves `thp_main` code to a "context"-like class, similar to
`CodecContext` for Protocol v1.

It encapsulates payload reassembly, as well as handling and responding
to low-level single packet THP messages.

Also, channel cache is now using interface number for `CHANNEL_IFACE`,
in order to simplify channel interface serialization.

[no changelog]
2025-08-12 08:12:47 +03:00
Roman Zeyde
8b06fdacad chore(core): fix a small typo in thp_common.py
Also, use `log._min_level` to suppress debug logging.

[no changelog]
2025-08-12 08:12:47 +03:00
Roman Zeyde
f1c08bcfe3 chore(core): reduce default value in MockHID c-tor
It would allow to use it as `CHANNEL_IFACE` (in a following commit).

[no changelog]
2025-08-12 08:12:47 +03:00
tychovrahe
74c3deaf27 refactor(core): rewrite debug overlay in rust
[no changelog]
2025-08-11 16:41:35 +02:00
Lukas Bielesch
6e2d44d765 chore(core): use non-breakable space between value and unit 2025-08-06 14:19:34 +02:00
M1nd3r
07f92d796e test(core): add THP unit tests 2025-07-31 20:29:05 +02:00
M1nd3r
3ce1939c64 test(core): adjust existing unit tests to THP 2025-07-31 20:29:05 +02:00
cepetr
ba908a5eb6 feat(core): update t3w1 memory layout
[no changelog]
2025-07-29 11:37:47 +02:00
M1nd3r
0b2fdf3667 chore(common/core): use public_key instead of pubkey in THP messages
[no changelog]
2025-07-21 13:05:51 +02:00
M1nd3r
be287648d0 chore(core, tests): add MockAsync and await_result_patched
[no changelog]
2025-07-11 15:36:51 +02:00
Andrew Kozlik
cd1b194be8 feat(core): Include address_n in address MAC. 2025-07-10 10:10:14 +02:00
M1nd3r
df28c84e0b chore(storage): rename DEVICE_SECRET and CRED_AUTH_KEY_COUNTER
[no changelog]
2025-05-19 13:33:17 +02:00
Roman Zeyde
3a7850f6a0 chore: remove BNB Beacon Chain support 2025-05-13 09:04:48 +03:00
matejcik
ff1c9b9f9a tests(core): run make test headless
don't spam the emulator window ^_^
2025-04-29 14:54:41 +02:00
matejcik
f10588b2b6 tests(core): split up definition unit tests and add Solana cross-parseability check 2025-04-29 14:54:41 +02:00
matejcik
e4e6d60e64 refactor(core/solana): restructure programs.json and related code 2025-04-29 14:54:41 +02:00
Eugene Rossokha
ffbdea202a feat(core): add loadable solana tokens 2025-04-29 14:54:41 +02:00
Roman Zeyde
ad73e41080 feat(core): support USB/BLE sessions
All interfaces are sharing a single 8kB buffer.
It is reallocated once per session and is acquired by the first active session.
Other concurrent sessions will respond with an "Another session in progress" error.

[no changelog]
2025-03-31 13:20:53 +03:00