1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00
Commit Graph

288 Commits

Author SHA1 Message Date
Martin Milata
ee64b65b26 refactor(core): call super().__init__() in subclasses 2020-11-30 14:48:08 +01:00
matejcik
4628c774aa feat(core): re-allow unknown Ethereum networks, using Ethereum or Testnet paths (fixes #1335) 2020-11-20 18:55:35 +01:00
matejcik
e6a1bf840f fix(core): do not subclass range
micropython on real hw dislikes it for some reason

also it's completely unnecessary
2020-11-13 16:01:35 +01:00
Pavol Rusnak
50fdd183c2
ci: enable editorconfig checks, fix whitespace issues 2020-11-11 14:43:50 +01:00
matejcik
eadf8ab25f chore(core/tests): update unit tests for new APIs, drop unnecessary ones 2020-11-05 14:30:11 +01:00
matejcik
7fe5c804ff feat(core): implement BIP-32 path schemas 2020-11-05 14:30:11 +01:00
Andrew Kozlik
4a0c5c371a feat(core): In apps.bitcoin implement replacement transaction flow. 2020-10-23 15:07:15 +02:00
Andrew Kozlik
bd3fe1d789 chore(core): In apps.bitcoin create a separate class for transaction information. 2020-10-23 15:07:15 +02:00
Andrew Kozlik
5fc491c597 chore(core): In apps.bitcoin move BIP143 hashing back to a separate class. 2020-10-23 15:07:15 +02:00
Martin Milata
9ed25a718a ci: handle full dependencies in shell.nix
Handling of full dependencies (multiple python versions, Monero tests)
was moved from Dockerfile to shell.nix.

The Python packages are installed from the pinned nixpkgs revision and
do not depend on channel state at the time of docker build anymore.

The Monero test binary is now downloaded using fetchurl which fails the
build if checksum doesn't match.
2020-10-15 15:59:20 +02:00
Pavol Rusnak
d8534b5ee6
perf(core/extmod): replace HMAC Python implementation with C
We keep Python implementation of HMAC for Monero in
core/src/apps/monero/xmr/crypto/__init__.py
2020-10-12 16:33:13 +02:00
matejcik
0eed360037 chore: make tx type names shorter
as suggested by @andrewkozlik:
TxAckInputType -> TxInput
TxAckOutputType -> TxOutput
TxAckPrevTxType -> PrevTx
TxAckPrevInputType -> PrevInput
TxAckPrevOutputType -> PrevOutput
2020-09-23 16:00:10 +02:00
matejcik
8b2e46eb2d chore(core): update unit tests to kwargs usage and new TxAck subtypes 2020-09-23 16:00:10 +02:00
matejcik
90ee5f3d38 feat!: implement protobuf required fields and default values
BREAKING CHANGE: this makes arguments to protobuf constructors
keyword-only, and arguments corresponding to required fields are now
mandatory
2020-09-23 16:00:10 +02:00
Martin Milata
cff4955f93 core: implement SafetyChecks.PromptTemporarily
Also reword safety checks confirmation dialogs.
2020-09-18 09:02:40 +02:00
Andrew Kozlik
9774c99e90 core/tests: Fix unit tests for streamimg prev_tx after confirmation. 2020-09-04 14:36:39 +02:00
Tomas Susanka
b99b8b3df3 Merge remote-tracking branch 'origin/release/2020-09' 2020-09-03 13:17:23 +02:00
matejcik
e0583dd5cb all: use a specific error code for "invalid session" 2020-08-28 15:37:06 +02:00
matejcik
4909821f35 core: implement EndSession 2020-08-28 15:37:06 +02:00
Andrew Kozlik
02da5b7593 core/bitcoin: Show warning if nLockTime is set but ineffective due to all nSequence values being 0xffffffff. 2020-08-21 21:30:15 +02:00
Pavol Rusnak
0620911e46 core: allow spending coins from Bitcoin paths if the coin ...
has implemented strong replay protection via SIGHASH_FORKID
2020-08-21 11:49:03 +02:00
Andrew Kozlik
791a74aeb2 core/tests: Add unit tests for CoinJoinApprover and CoinJoinAuthorization. 2020-08-04 17:32:44 +02:00
Andrew Kozlik
472e853f0a core/tests: Fix unit tests to work with BasicApprover in sign_tx. 2020-08-04 17:32:44 +02:00
matejcik
c3afb93837 core/tests: improve test harness (fixes #1157) 2020-08-04 10:27:44 +02:00
Pavol Rusnak
063aba910d core: rename emulator to trezor-emu-core 2020-07-30 15:27:34 +02:00
Martin Milata
d955e3f1e5 core: rename class Overwintered to Zcashlike 2020-07-30 15:14:18 +02:00
Martin Milata
10387e1869 core: drop zcash v3 tx signing support 2020-07-30 15:14:18 +02:00
Gabriel Kerekeš
d2c1624602 Cardano shelley update 2/3 (#1112) 2020-07-27 13:11:23 +02:00
gabrielkerekes
e1615e60ec Update Cardano to support Shelley era 1/3
Update protobuf

- Previous transactions don't need to be sent anymore, because fee is
  included in the transaction now. Thus transactions_count can be
  removed from CardanoSignTx message and the CardanoTxAck and
  CardanoTxRequest messages can be removed altogether.
- CardanoTxInputType.type is unused so remove it

Add NULL (None type) serialisation to CBOR

- Transaction metada must either have a valid structure or CBOR NULL
  must be used (if metadata is empty) - it can't be simply left out.

Add protocol_magics file

- Just to have a nicer way of representing protocol magics

Update transaction signing

- Previous transactions no longer need to be requested
- Output building is simplified, since fee doesn't need to be calculated
- Remove transaction class since it is no longer needed (only functions
  remained)
- Reorder functions so it reads top to bottom

Add protocol magic to byron address on testnet

- This has always been a part of the spec, but it hasn't been
  implemented before, because it wasn't really needed.

Update trezorlib

Update tests

- Transaction messages are no longer required
- Expected values are different since tx format changed
- Common values in test cases have been extracted

Remove unused file

- Progress was used when receiving previous transactions

Add CRC check to output address validation
2020-07-27 13:04:49 +02:00
matejcik
b741560997 core/bitcoin: drop unused validate_path_for_bitcoin_public_key 2020-07-24 16:37:58 +02:00
matejcik
58f460627f core/tests: add unit tests for new functionality 2020-07-24 16:37:58 +02:00
matejcik
a461853cf6 core/tests: fix bitcoin unit tests 2020-07-24 16:37:58 +02:00
matejcik
7befdd07e4 core/tests: update unit tests 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
0a758b8181 core/tests: add synchronous protobuf tests 2020-07-24 14:09:31 +02:00
Martin Milata
fd117a0c9f core: raise error on auto-lock value out of range 2020-07-22 21:38:42 +02:00
Pavol Rusnak
57ae902aed
core/monero: don't download test binary even if hash is different 2020-07-03 15:18:38 +02:00
Pavol Rusnak
5d666376f0
core/monero: update tests binary 2020-07-03 15:18:38 +02:00
Andrew Kozlik
791ff3fe06 core/tests: Add unit tests for SLIP-0019 proofs of ownership. 2020-07-03 11:17:19 +02:00
Andrew Kozlik
d48a372ca7 core/sign_tx: Implement support for signed external inputs. 2020-07-03 11:17:19 +02:00
Andrew Kozlik
3b6c1e5e6b core/crypto: Add functions for verifying DER encoded signatures. 2020-07-03 11:17:19 +02:00
Andrew Kozlik
99f01cd316 core/sign_tx: Check script_pubkeys of inputs. 2020-07-03 11:17:19 +02:00
Tomas Susanka
a6acefbdf5 core: wipe before reset and recovery; introduce 'intialized' field 2020-06-16 11:31:29 +02:00
Tomas Susanka
56fe5adcfc Merge branch 'release/2020-06' 2020-06-10 06:51:18 +00:00
matejcik
d5e45c02bb core: move base functions from "homescreen" app to "base" 2020-06-04 16:18:46 +02:00
Andrew Kozlik
cb32ae2e4b core/tests: add request_meta queries to unit tests (needed for transaction streaming) 2020-05-24 14:36:38 +00:00
Andrew Kozlik
42eddf8e04 core/sign_tx: validate prevout amount in all cases 2020-05-24 14:36:38 +00:00
Tomas Susanka
445f56d387 core/bitcoin: finalize bitcoin refactor
- core/bitcoin: move common files to the app's root
- core/bitcoin: use require_confirm instead of confirm
- core: move bitcoin unrelated functions from 'bitcoin' to a new 'misc' app
- core/bitcoin: use relative imports inside the app
- core: rename wallet app to bitcoin
- core/wallet: replace SigningErrors and the other exception classes with wire.Errors
2020-05-18 14:31:51 +02:00
matejcik
aa52fc3903 core/extmod: drop unused rfc6979 module 2020-05-18 14:31:00 +02:00
matejcik
3e06f4779a core/tests: add new keychain tests 2020-05-15 14:08:29 +02:00
matejcik
de9e73dcbc core/tests: update unit tests for new keychain API 2020-05-15 14:08:29 +02:00
matejcik
fd9e945308 core/cardano: use caching decorators and new Keychain API for Cardano as well 2020-05-15 14:08:29 +02:00
matejcik
8c4cb58098 core: introduce caching decorators 2020-05-15 14:08:29 +02:00
Dusan Klinec
6b8fc9c894
xmr: major protocol upgrade, CLSAG support added
- CLSAG signature scheme added
  - type hints added

xmr: optimize protocol, send only required data
  - real_out_additional_tx_keys contains only one element as nothing more is needed during signature
  - only src_entr.outputs[index] is HMACed and always present. Other outputs are present only if needed which reduces comm and CPU overhead.
  - getting rid of subaddresses dictionary (memory requirements), now subaddr indices are present per source entry so keys are computed when needed

xmr: prepare for permutation sending removal, specify index
  - specify source entry ordering index prior sorting by key images as original HMAC keys are generated based on these.
  - permutation checked just by valid HMACs, size of the set, key image sort order
  - sending permutation is now deprecated, will be removed in the following protocol versions
  - more strict state transition checks, guard strict check with respect to steps ordering
2020-05-13 11:13:19 +02:00
Andrew Kozlik
7370077d0c core/sign_tx: Get rid of internal TxOutputBinType messages. 2020-05-06 13:18:32 +02:00
Andrew Kozlik
9f9618944a core/sign_tx: Explicitly pass script to write_tx_input() instead of setting it in txi. 2020-05-06 13:18:32 +02:00
Andrew Kozlik
8b89a30955 core/sign_tx: Remove get_prevouts_hash(), get_sequence_hash(), get_outputs_hash() methods from signer classes, because they are only used internally. 2020-05-06 13:18:32 +02:00
Andrew Kozlik
22933587be core/sign_tx: Merge bip143 classes into signer classes. 2020-05-06 13:18:32 +02:00
Andrew Kozlik
c1effcc374 core/sign_tx: Updates based on code review. 2020-05-06 13:18:32 +02:00
Andrew Kozlik
c2a0f83558 core/sign_tx: Move script derivation to scripts module. 2020-05-06 13:18:32 +02:00
Andrew Kozlik
d0b80bddc8 core/tests: Fix unit tests after sign_tx refactor. 2020-05-06 13:18:32 +02:00
matejcik
5885978c83 Merge branch 'release/2020-04' 2020-04-15 15:00:23 +02:00
Pavol Rusnak
a7806d08d7
core/crypto: remove unused bip32.deserialize function 2020-04-06 18:04:24 +02:00
Pavol Rusnak
1695228d80
core/crypto: remove unused serialize_private function 2020-04-06 15:49:36 +00:00
matejcik
bd9e15bb8c core/tests: add unit tests for prevhash writers 2020-03-20 14:19:31 +00:00
matejcik
a9faa4d4ab core/tests: fix inline variant of assertRaises
otherwise code like the following would fail:

>>> self.assertRaises(AssertionError, ensure, False)

because the AssertionError raised internally by `ensure` would be
conflated with the AssertionError raised by the tested function
2020-03-20 14:19:31 +00:00
matejcik
27f6306e1d core: introduce safer write_bytes functions 2020-03-20 14:19:30 +00:00
matejcik
e2035b4972 all: drop Horizen and BIP-115 support [NO BACKPORT] 2020-03-20 14:19:07 +00:00
matejcik
27803ee8c1 all: drop overwintered field from transaction 2020-03-20 14:18:27 +00:00
Andrew Kozlik
e5008eb332 core/webauthn: Remove indistinguishable credentials from the allow list. 2020-03-20 15:07:06 +01:00
Andrew Kozlik
0af0e06d5b core/webauthn: Truncate names in credential data to at most 100 bytes. 2020-03-20 15:07:06 +01:00
matejcik
3789a3372b core/sdcard: modify exception handling in fatfs
expose ff.c constants, raise them as arguments to FatFSError

introduce NotMounted and NoFilesystem as subclasses of FatFSError with
the appropriate error code set
2020-03-20 14:03:28 +01:00
Andrew Kozlik
e378820f7f core/webauthn: Implement support for Ed25519 signatures in FIDO2. 2020-03-12 15:45:26 +01:00
Dusan Klinec
2658e253fa xmr/bp: memory optimizations and improvements
- different approach to vector manipulation - more on the fly operations. Prepared for fully offloaded operations, BP on Trezor with constant memory.
- memory requirements reduced from (4MN + const) to (2MN + const)
- more raw methods to avoid unnecessary encoding/decoding
- chunking improved, chunk size set as a constant, changed from 64 to 32, missing pieces implemented to cover also BP 16
- proof_v8 support discontinued, old hardfork, not needed anymore
- get_exponent register clash fixed (for large vectors)
- reduced heap fragmentation by removing some temporary allocations
- hashing with len and offset to reduce heap fragmentation by creating a sliced arrays
- use to() wherever possible to avoid allocations and return of mutable private object
- global functions start with _ prefix, reduce import footprint
- use __slots__ in classes to minimize footprint
2020-03-02 12:17:03 +01:00
Tomas Susanka
86b010a18b
Merge pull request #878 from trezor/matejcik/fatfs-corruption
FatFS API rework
2020-02-27 15:58:38 +01:00
Tomas Susanka
495a59c282 core: use wire errors instead of ValueErrors where applicable 2020-02-27 10:46:01 +00:00
matejcik
18ac4fc9ca core: update Python facing APIs 2020-02-27 10:56:23 +01:00
matejcik
9ab84d2455 core/tests: thoroughly test modified APIs 2020-02-27 10:56:23 +01:00
matejcik
e9c275c24f core/sdcard: fix invalid state when filesystem mounting fails 2020-02-24 13:28:44 +01:00
Tomas Susanka
6c47bf8230 core: store multiple sessions/caches at the same time 2020-02-21 14:40:42 +01:00
matejcik
918603ad5c core: add unit test for sdcard wrapper 2020-02-20 12:51:48 +01:00
matejcik
7983fd34d6 core: fix unit tests 2020-02-20 12:51:48 +01:00
Pavol Rusnak
07cd73ce57
core: show webusb popup only in bootloader and only if firmware is not installed 2020-02-12 20:47:05 +00:00
Tomas Susanka
2c0504ad1c
Merge pull request #803 from trezor/passphrase
Passphrase Redesign
2020-02-11 16:01:59 +01:00
matejcik
741c0c8888 core: improve stability of Monero test runner 2020-02-11 11:16:28 +01:00
Tomas Susanka
15ed5cd19e
core: do not clear cache on ClearSession 2020-02-07 11:41:03 +00:00
matejcik
3fa99c0c6a
core/tests: add storage.cache tests 2020-02-07 11:41:02 +00:00
matejcik
d4171aaedc
core/tests: extract common await_result() method 2020-02-07 11:41:02 +00:00
Tomas Susanka
bf1514d1ac core/test/strings: add test for words ending with 'hsxz' 2020-01-27 09:11:11 +00:00
Tomas Susanka
0053511c66 utils: introduce format_plural and move format functions to strings.py 2020-01-24 16:25:14 +01:00
matejcik
0496e49507 core/tests: fix monero runner script 2020-01-23 18:43:20 +01:00
matejcik
6cf48bf485 ci: use explicit trezor.log location 2020-01-23 18:43:20 +01:00
matejcik
22c8b2569b core: simplify monero test use of emulator 2020-01-23 18:43:20 +01:00
matejcik
ec192e9406 core: use better emulator test wrappers (fixes #468) 2020-01-23 18:43:20 +01:00
Tomas Susanka
7c41b40dff
tests: introduce UI tests for core with diffs (#784)
tests: introduce UI tests for core with diffs
2020-01-10 20:39:31 +01:00
matejcik
d4eed4b8ff core/tests: update tests for modified slip39 API 2020-01-09 16:00:33 +01:00
Tomas Susanka
51ef963738 tests: introduce UI tests for core 2020-01-03 14:28:27 +00:00
Tomas Susanka
a28f29708f ci: add junit for a nice tests overview 2020-01-03 12:44:12 +00:00
Tomas Susanka
ffea791658
Merge pull request #774 from trezor/tsusanka/shamir-word-checks
Recovery: refactor word checks and add a test
2019-12-30 13:26:07 +01:00
Tomas Susanka
d8e956fc6d core/recovery: change exceptions types; modifications in tests 2019-12-30 11:35:56 +00:00
Tomas Susanka
7f730cb6f9 core/recovery: refactor to exceptions 2019-12-27 19:02:30 +00:00
Tomas Susanka
f4e11a9176 core/recovery: rework arguments 2019-12-27 18:46:22 +00:00
Tomas Susanka
20bcc68926 core/tests: remove utest.py 2019-12-27 13:28:15 +01:00
Tomas Susanka
faa9078c2b core/recovery: refactor word checks and add a test 2019-12-23 13:40:45 +01:00
Tomas Susanka
a316347bf1 core/tests: test debug is on 2019-12-23 12:01:00 +00:00
Tomas Susanka
5677c254b1 core/tests: remove PYOPT settings 2019-12-23 11:51:29 +00:00
Andrew Kozlik
5bdd523b91 vendor: Update fido2-tests submodule to fix issues with random ordering. 2019-11-26 15:18:14 +01:00
Pavol Rusnak
0a0cd797e3
ci/tests: use new Monero tests binary 2019-11-13 16:29:06 +01:00
Pavol Rusnak
cde944b565
Merge branch 'reorder-usb' 2019-11-13 16:23:07 +01:00
Tomas Susanka
20a30ae521 tests/monero: print hash of the monero binary 2019-11-13 14:44:40 +00:00
Pavol Rusnak
2652936c16
core/tests: adapt device_emu_fido2/u2f to reordered usb endpoints 2019-11-13 13:21:39 +01:00
Dusan Klinec
d81f43f7a4 tests: use new monero testing binary v0.15.0.0 2019-11-12 22:53:47 +01:00
matejcik
1397bbfeb5 core/tests: fix test suite after storage move 2019-10-31 16:34:16 +01:00
Tomas Susanka
c1f7239c2d ci: add click and persistence tests 2019-10-25 12:04:14 +00:00
Adrian Nagy
384275ac73
core/tezos: support the new protocol update (005-BABYLON) 2019-10-23 17:53:10 +02:00
Tomas Susanka
b530e7c105 ci: add fido2 tests to ci 2019-10-18 16:54:00 +02:00
Tomas Susanka
1068acae40 core/tests: assert secret in process_slip39 test 2019-10-04 13:47:52 +00:00
Tomas Susanka
75dfcacc21 core/tests: add unit test for process_slip39 function
updates #542
2019-10-03 16:54:35 +02:00
matejcik
861e999425 core: draft unit test for process_slip39 2019-10-03 16:01:01 +02:00
Pavol Rusnak
69142e56e7
core/tests: don't use curl, use wget 2019-09-30 12:46:00 +00:00
Pavol Rusnak
68513a0b39
Merge pull request #538 from trezor/andrewkozlik/fido2-signcount
Disable FIDO2 signature counter for some relying parties
2019-09-19 17:00:51 +02:00
Tomas Susanka
cefb1cf4fd core: refactor slip39 2019-09-19 16:38:29 +02:00
Andrew Kozlik
315a30b42b core/webauthn: Disable FIDO2 signature counter for some relying parties 2019-09-19 16:16:58 +02:00
Pavol Rusnak
649d14898f
core/tests: remove also sdcard files in test runner 2019-09-18 19:14:35 +02:00
Andrew Kozlik
a5f5a1709f core/tests: Increase sleep to 30 after emulator launch to allow for FatFS.mkfs. 2019-09-18 18:55:58 +02:00
Andrew Kozlik
6350b1c61c core: Implement SD card protection. 2019-09-18 18:55:58 +02:00
Pavol Rusnak
69d936a390
core: remove unused script 2019-09-18 17:23:27 +02:00
Pavol Rusnak
650db2a5c0
ci: add u2f tests to CI 2019-09-14 14:47:45 +02:00
Pavol Rusnak
9414a2b2f5
tests: fix file permissions 2019-09-14 14:41:12 +02:00
Tomas Susanka
e4c8cb1315
core: move public_key_to_wif to helpers 2019-09-13 12:55:04 +02:00
Tomas Susanka
adedb7df97
core: remove underscores in symbols used externally
closes #504
2019-09-13 12:55:04 +02:00
Pavol Rusnak
2711ce2a3d
Merge pull request #394 from trezor/andrewkozlik/fido2-squashed
Add FIDO2 support
2019-09-13 11:20:48 +02:00
Tomas Susanka
75c539ec55
all: replace /bin/bash with /usr/bin/env bash 2019-09-12 17:35:55 +02:00
Andrew Kozlik
5020ae9757 core/tests: Test SLIP-0022 FIDO2 credential decode. 2019-09-12 12:04:01 +02:00
Milan Rossa
f962a18785
core: enhance testing runners 2019-09-07 11:29:55 +02:00
Pavol Rusnak
d40b7c0385
core/modtrezorio: enable LFN+Unicode in FatFS 2019-09-03 15:14:25 +02:00
Pavol Rusnak
aa8d14c0ea
core/modtrezorio: add FatFS support 2019-09-03 15:14:24 +02:00
Pavol Rusnak
ecceed018e
core/tests: make binance sign_tx test vector more readable 2019-09-03 15:09:12 +02:00
Luke Plaster
3eff86d17b core: fix the "coin" blueprint (#488) 2019-09-03 14:47:29 +02:00
Roman Zeyde
680e18a4ba core/seed: add SLIP-0077 derivation to Keychain (#398)
Following #66 and #317, it would allow deriving confidential addresses and
unblinding confidential transactions' outputs.
2019-08-31 19:04:00 +02:00
Pavol Rusnak
32edf7b6b9
core: fix unit tests for Bitcoin only firmware 2019-08-27 12:38:29 +02:00
Tomas Susanka
077735f57b ci: introduce upgrade tests
closes #126
2019-08-26 16:02:06 +02:00
matejcik
2022c39ef9 core/ethereum: add support for wanchain slip44 id (#440) 2019-08-25 16:36:14 +02:00
Pavol Rusnak
e1f0c238cf
core: fix utils.format_amount for negative amounts 2019-08-23 12:24:17 +02:00
Pavol Rusnak
876ba5f590
tests: make path to tested binary configurable 2019-08-22 17:47:36 +02:00
Roman Zeyde
5b3427a21d core: ensure multisig (m,n) parameters are valid (#423) 2019-08-20 19:18:34 +02:00
Marius Kjærstad
1d6ea33ec6 docs: switch http to https in links (#419) 2019-08-16 17:28:15 +02:00
Tomas Susanka
1b666804c0 core/shamir: fix EMS vs MS
(cherry picked from commit cb94454618)
2019-08-13 17:25:47 +02:00
matejcik
eaf1e940a8 build: update test runners for new paths 2019-08-12 12:57:25 +02:00
Andrew Kozlik
0a594ea1e9
Merge pull request #280 from trezor/andrewkozlik/slip-0021
Add SLIP-0021 implementation and tests.
2019-08-06 14:26:34 +02:00