1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00
Commit Graph

57 Commits

Author SHA1 Message Date
amadejpapez
85ba7c12ba style(all): use f-strings for formatting
[no changelog]
2021-10-13 11:53:17 +02:00
matejcik
b666895303 feat(core/rust): catch, handle and propagate uPy exceptions 2021-09-21 12:43:31 +02:00
matejcik
cb882df100 feat(core): in debug mode, dump contents of received protobuf messages
[no changelog]
2021-07-23 11:46:24 +02:00
Martin Milata
8da978981e perf(core): share wire buffer between wire and debuglink
[no changelog]
2021-07-22 15:12:22 +02:00
Jan Pochyla
a8623c4b59 refactor(core): fix imports and use new protobuf API in apps 2021-06-08 09:55:19 +02:00
Jan Pochyla
02aa14fc04 refactor(core): Switch to new Protobuf API 2021-06-08 09:55:19 +02:00
matejcik
86089fa5ad feat(core): avoid restarting session for select messages (fixes #1631) 2021-06-01 14:07:29 +02:00
matejcik
411a7bb802 fix(core/wire): handle codec errors better 2021-05-06 13:14:21 +02:00
matejcik
93db39ad70 fix(core/wire): drop unused reader, clarify writer usage 2021-05-06 13:14:21 +02:00
matejcik
dd655422f1 refactor(core/wire): simplify the message handling loop 2021-05-06 13:14:21 +02:00
matejcik
b1ca6ca848 refactor(core/debug): offload debug configuration from apps.debug 2021-05-06 13:14:21 +02:00
matejcik
7ca67cc4d9 feat(core): clear out memory space after every workflow
A small fixed list of modules is kept pre-loaded in the GC arena.
These must not keep references to anything else, as all other modules
are unloaded and the memory is cleared.
2021-05-06 13:14:21 +02:00
matejcik
e629a72c3a refactor(core): move app registrations to a single handler function
apps.webauthn.boot() does not need an if-condition because it's only
called from session.py when the usb interface is enabled

This means that they do not need to be stored in RAM at all. The obvious
drawback is that we need to hand-edit the if/elif sequence, but we don't
register new handlers all that often so 🤷
2021-05-06 13:14:21 +02:00
matejcik
3cdb09c294 refactor(core): modify cache to preallocate all its data
also get rid of expensive "wire" import
2021-05-06 13:14:21 +02:00
matejcik
b0116d0bdc refactor(core): modify wire to preallocate its buffers 2021-05-06 13:14:21 +02:00
Martin Milata
ac711fb8ee style(core): use more recent type annotation syntax
https://www.python.org/dev/peps/pep-0585/ - Type Hinting Generics In Standard Collections
https://www.python.org/dev/peps/pep-0604/ - Allow writing union types as X | Y
2021-04-01 11:12:30 +02:00
Martin Milata
8b3ac659a0 style(core): mypy: disable implicit Optional for function arguments
https://www.python.org/dev/peps/pep-0484/#union-types
2021-04-01 11:12:30 +02:00
Pavol Rusnak
a1dda836ec style(core/src): use new syntax for typing 2020-12-01 15:52:29 +01:00
Martin Milata
ee64b65b26 refactor(core): call super().__init__() in subclasses 2020-11-30 14:48:08 +01:00
Martin Milata
830592f2d9 feat(core): add experimental_features setting
The setting is off by default. When it is enabled protobuf messages
marked UNSTABLE are rejected after decoding.
2020-10-16 13:53:31 +02:00
matejcik
b0a2297b14 feat(core): convert protobuf decoding errors to DataErrors 2020-09-23 16:00:10 +02:00
matejcik
e0583dd5cb all: use a specific error code for "invalid session" 2020-08-28 15:37:06 +02:00
matejcik
1ff4a0d239 core: separate BufferIO into Reader (read-only) and Writer
also integrates BytearrayReader API into BufferReader
2020-07-24 14:09:31 +02:00
matejcik
3514a31bc9 core: make USB codec resilient to OOM conditions 2020-07-24 14:09:31 +02:00
matejcik
31e2170766 core: make protobuf buffer smaller, dynamically allocate bigger if necessary 2020-07-24 14:09:31 +02:00
matejcik
01d695283f core: make protobuf buffer bigger 2020-07-24 14:09:31 +02:00
matejcik
0c3bc53aee core: clean up types for field caching, fix count_message 2020-07-24 14:09:31 +02:00
matejcik
d568afa80d core: improve protobuf field caching 2020-07-24 14:09:31 +02:00
matejcik
85d74ece76 core: implement synchronous v1 codec 2020-07-24 14:09:31 +02:00
matejcik
a9d8fd3992 core: debuglink interface avoids workflow management
This will have unintended consequences if you call a wirelink function
on the debulink interface. TT allows this ... and will behave badly.
2020-06-04 16:18:46 +02:00
matejcik
2d0206c043 core: replace workflow.on_start/on_close with workflow.spawn 2020-06-04 16:18:46 +02:00
matejcik
67b723e4ca core: add a global idle timer 2020-06-04 16:18:46 +02:00
matejcik
246998910a core: refactor usage of input_signals
this prevents a certain class of UI test failure. It also localizes the
use of debuglink signals into the layout classes instead of call sites,
which is a design we were already using for confirm_signals
2020-06-04 16:18:46 +02:00
matejcik
eabfcab9b9 core: add default messages to some error codes 2020-06-04 16:18:46 +02:00
matejcik
341c5b7d10 core/wire: make handler lookup pluggable 2020-06-04 16:18:46 +02:00
matejcik
123b07e3ad core: drop support for pre-registering keychain namespaces 2020-05-15 16:30:41 +02:00
matejcik
d3b88a37be core: do not catch SystemExit in handle_session (#826) 2020-02-12 10:36:42 +01:00
matejcik
0df3c64855 core: fix unexpected messages in debug mode (fixes #809) 2020-01-27 19:41:41 +01:00
Andrew Kozlik
4381511930 common: Add ChangeWipeCode message. 2019-11-25 12:32:20 +01:00
matejcik
33bd4d3ba9 Merge branch 'master' into matejcik/storage-relocation 2019-11-07 12:51:02 +01:00
Tomas Susanka
7dba12cb6d core/log: print received message's name 2019-11-06 11:20:46 +01:00
matejcik
5c93ecd53a core: create top-level storage module
This is to avoid including app-specific functionality in storage and
avoid circular imports. The following policy is now in effect: modules
from `storage` namespace must not import from `apps` namespace.

In most files, the change only involves changing import paths.

A minor refactor was needed in case of webauthn: basic get/set/delete
functionality was left in storage.webauthn, and more advanced logic on
top of it was moved to apps.webauthn.resident_credentials.

A significant refactor was needed for sd_salt, where application (and
UI) logic was tightly coupled with the IO code. This is now separated,
and storage.sd_salt deals exclusively with the IO side, while the app/UI
logic is implemented on top of it in apps.common.sd_salt and
apps.management.sd_protect.
2019-10-31 16:21:56 +01:00
matejcik
b25537f6b0 core: nicer output for cancellations 2019-10-22 16:54:49 +02:00
matejcik
d17f879d97 mypy: use GenericContext protocol to work-around DummyContext 2019-10-22 14:36:25 +00:00
Tomas Susanka
0511cc8b8c core: add final mypy fixes! 2019-10-22 14:36:25 +00:00
Pavol Rusnak
7c74f1c54c
core: fix style 2019-09-02 13:49:46 +02:00
Jan Pochyla
355cebf8bf core: wait for the default layout after closing a workflow
Fixes #469
2019-09-02 12:52:09 +02:00
Jan Pochyla
ccb926af53 core: improve log messages in workflow and wire 2019-09-02 12:52:09 +02:00
Jan Pochyla
bb2556a22c
core: improve code documentation, simplify wire package
* docs: improve loop.py, ui.init

* docs: improve trezor.loop, rename spawn to race

* docs: wire

* core/wire: simplify and document the session handler

* core/wire: improve documentation

* core/wire: improve docs

* core/docs: document ui.grid function

* core: decouple ui and workflow, document both

* core: improve docs


Co-authored-by: Tomas Susanka <tsusanka@gmail.com>
2019-08-20 16:20:02 +02:00
matejcik
cf70f82d90 core: debug messages when reading from wire
fixes #373
2019-08-09 16:53:12 +02:00