1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-07 14:00:57 +00:00
Commit Graph

7182 Commits

Author SHA1 Message Date
matejcik
ed473e2e42 trezorlib: add licence headers where missing 2018-11-12 12:22:32 +01:00
matejcik
93d84539bd transport: fit log messages to lines 2018-11-12 12:22:32 +01:00
matejcik
85b85c67b3 trezorlib: reentrant session handling
This fixes the breakage introduced by transport reshuffles.
It's still not great and I'd love to see context manager based sessions.
But it's good enough for now.
2018-11-12 12:22:32 +01:00
matejcik
daf97afb37 bridge: refactor after merging old changes 2018-11-12 12:22:32 +01:00
matejcik
aac7726824 trezorlib: transport/protocol reshuffle
This commit breaks session handling (which matters with Bridge) and
regresses Bridge to an older code state. Both of these issues will be
rectified in subsequent commits.

Explanation of this big API reshuffle follows:

* protocols are moved to trezorlib.transport, and to a single common file.
* there is a cleaner definition of Transport and Protocol API (see below)
* fully valid mypy type hinting
* session handle counters and open handle counters mostly went away. Transports
  and Protocols are meant to be "raw" APIs; TrezorClient will implement
  context-handler-based sessions, session tracking, etc.

I'm calling this a "reshuffle" because it involved very small number of
code changes. Most of it is moving things around where they sit better.

The API changes are as follows.

Transport is now a thing that can:
* open and close sessions
* read and write protobuf messages
* enumerate and find devices

Some transports (all except bridge) are technically bytes-based and need
a separate protocol implementation (because we have two existing protocols,
although only the first one is actually used). Hence a protocol superclass.

Protocol is a thing that *also* can:
* open and close sessions
* read and write protobuf messages
For that, it requires a `handle`.

Handle is a physical layer for a protocol. It can:
* open and close some sort of device connection
  (this is distinct from session! Connection is a channel over which you can
  send data. Session is a logical arrangement on top of that; you can have
  multiple sessions on a single connection.)
* read and write 64-byte chunks of data

With that, we introduce ProtocolBasedTransport, which simply delegates
the appropriate Transport functionality to respective Protocol methods.

hid and webusb transports are ProtocolBasedTransport-s that provide separate
device handles. HidHandle and WebUsbHandle existed before, but the distinction
of functionality between a Transport and its Handle was unclear. Some methods
were moved and now the handles implement the Handle API, while the transports
provide the enumeration parts of the Transport API, as well as glue between
the respective Protocols and Handles.

udp transport is also a ProtocolBasedTransport, but it acts as its own handle.
(That might be changed. For now, I went with the pre-existing structure.)

In addition, session_begin/end is renamed to begin/end_session to keep
consistent verb_noun naming.
2018-11-12 12:22:26 +01:00
Tomas Susanka
d83ef07d57 paths: typo, style 2018-11-12 12:21:40 +01:00
Tomas Susanka
2acf0d10bd TEMPORARY: run tests against tsusanka/paths python-trezor branch 2018-11-12 12:10:32 +01:00
Tomas Susanka
8cf1ee5e62 paths: temporarily disable GetPublicKey paths checks
Until trezor/trezor.js#73 is fixed
2018-11-12 12:10:32 +01:00
Tomas Susanka
31f987e988 coins: validate derivation paths
Based on SLIP-44 ids and other checks. See docs/coins/README for info.
2018-11-12 12:10:32 +01:00
matejcik
491f1c1ad2 tools/support.py: set --ignore-tokens as default when running the checks 2018-11-12 12:08:33 +01:00
matejcik
0fd94f6bee tools/support.py: fix bug when token collides with coin 2018-11-12 12:08:33 +01:00
Vladimir Volek
ab25381646 Update build.md (#408) 2018-11-12 12:04:56 +01:00
Pavol Rusnak
4f153b5fd0
travis: put back ignore-missing 2018-11-11 13:59:48 +01:00
Pavol Rusnak
bea5e32046
add new stuff to support.json 2018-11-11 13:58:28 +01:00
Michael Ira Krufky
eb0c46542b Add Mix support (#234) 2018-11-11 13:54:48 +01:00
WillyTheCat
8757aa5cc0 Added BitCash (#232) 2018-11-11 13:53:57 +01:00
Pavol Rusnak
37a22b045f
defs: fix testnet backend uris 2018-11-09 16:08:24 +01:00
Pavol Rusnak
97655c70e7
add missing support info 2018-11-09 15:36:25 +01:00
Pavol Rusnak
19f1e3f008
defs: remove invalid backend APIs 2018-11-09 15:29:16 +01:00
Harris Brakmić
31ad279a62 Actinium integration (#221) 2018-11-09 15:14:46 +01:00
David
f5924dc694 Add Bitsend (BSD) support (#222) 2018-11-09 15:11:38 +01:00
David
cae5137bf1 Add Megacoin (MEC) support (#223) 2018-11-09 15:11:26 +01:00
David
39c95d6309 Add Bitcloud (BTDX) support (#224) 2018-11-09 15:11:07 +01:00
Jan Pochyla
ce362103ae apps: msg.address_n is always a list 2018-11-09 13:59:10 +01:00
Jan Pochyla
c7651b3c94 tezos: remove import * 2018-11-09 13:49:04 +01:00
Pavol Rusnak
0ff7034e37
embed/extmod/modtrezorconfig: refactor PIN UI wait callback (#398)
This commit accomplishes several goals:

1) it removes any upy dependencies from storage.c/storage.h
2) ui wait callback is set during config_init and storage_init,
   which allows to simplify the code dramatically
2018-11-08 15:55:47 +01:00
Pavol Rusnak
2849051b91
coins: add Electrum-GAME 2018-11-07 16:18:49 +01:00
Pavol Rusnak
b4894c3431
unix: add raspi target 2018-11-07 00:31:44 +01:00
matejcik
1a0ac27258 readme: update Python instructions (fixes #426) 2018-11-06 16:44:32 +01:00
matejcik
560a5215c5 client: do not coerce self.features.vendor to string
There is no good reason to do that and it hides situations when
the field mistakenly doesn't exist.

Added comment explains that missing "vendor" field might by caused
by trezor-common mismatch, which fixes #328
2018-11-06 14:16:53 +01:00
matejcik
ca345e9766 cardano: clean up test case 2018-11-06 13:38:13 +01:00
matejcik
81c55c1c5f device_tests: fix remaining use of btc.sign_tx 2018-11-06 13:38:09 +01:00
matejcik
99278f7d08 client: PassphraseState is not mandatory (missing on T1 in fact) 2018-11-06 13:36:25 +01:00
matejcik
1233feb358 style: fix imports 2018-11-06 13:36:25 +01:00
matejcik
2251b9c16a tools: fix encfs_aes_getpass for new UI 2018-11-06 13:36:25 +01:00
matejcik
601d3b49c3 trezorlib: add some utility features 2018-11-06 13:36:25 +01:00
matejcik
c269d67cde trezorlib: finalize BTC API changes
- drop set_tx_api method and its usage from trezorctl
- drop _prepare_sign_tx which is not used anymore
- adapt trezorctl to new signing API
- make trezorctl signing smarter, ahead of moving it elsewhere
2018-11-06 13:36:25 +01:00
matejcik
620e48e4d0 tests: adapt tests to new APIs 2018-11-06 13:36:25 +01:00
matejcik
9caea6d413 tx_api: rework API, separate caching functionality to test support 2018-11-06 13:36:25 +01:00
matejcik
3239d53bc0 debuglink: add support for arbitrary message filters
(this replaces `debug_processor` from sign_tx)
2018-11-06 13:36:25 +01:00
matejcik
5087f30a69 firmware: fix byte order for VendorTrust field, reproduce reserved field
this fixes a problem when checking signature (and therefore
reconstructing) of a vendor header that doesn't have a VendorTrust of
all zeroes, e.g., the vendor header for test builds
2018-11-06 13:36:25 +01:00
matejcik
c248946b3d protobuf: make MessageType more dict-like, drop _add_ and _extend_
so that SignTx(**tx) works

_add_x and _extend_x methods are left-overs from google protobuf
and shouldn't be used anymore
2018-11-06 13:36:25 +01:00
matejcik
e5e0759dc8 btc: refactor and cleanup sign_tx api & flow 2018-11-06 13:36:25 +01:00
matejcik
ea675f1e58 client: inline PassphraseState flow into Passphrase flow 2018-11-06 13:36:25 +01:00
Pavol Rusnak
f0eb7629bc
layout: NO BACKUP => SEEDLESS 2018-11-05 21:43:13 +01:00
Pavol Rusnak
6ce1794248
docker: add PRODUCTION env variable to build script 2018-11-05 21:41:03 +01:00
Pavol Rusnak
1bf9a8c687
defs: Lisk is supported on T1 2018-11-05 16:13:27 +01:00
Pavol Rusnak
0688fe6008
update changelog 2018-11-05 16:11:31 +01:00
Pavol Rusnak
fc0a44176f
firmware: bump to 2.0.10 2018-11-05 16:03:16 +01:00
Pavol Rusnak
675b1a81ad
nix: add Pyro4 to shell.nix 2018-11-05 16:03:15 +01:00