1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-10-11 10:29:01 +00:00
Commit Graph

100 Commits

Author SHA1 Message Date
Pavol Rusnak
71e52e3520
firmware: use preimage hasher for Zcash Sapling 2018-10-16 11:36:28 +02:00
Pavol Rusnak
4f9284d572
firmware: drop version_group_id from coin definition, use externally provided one 2018-10-15 18:07:16 +02:00
Pavol Rusnak
7b4f027445
fsm: use const where applicable, document where it isn't and why 2018-09-14 14:40:29 +02:00
matejcik
c17cec93f7
firmware: use flattened protobuf symbols 2018-09-06 18:47:36 +02:00
Pavol Rusnak
3de28570e4
firmware: don't use hardcoded version_group_id, but use the one from coin definition 2018-08-06 16:21:05 +02:00
Pavol Rusnak
0febd07dfc
firmware: update code to use new nested messages in trezor-common 2018-07-10 17:21:11 +02:00
Pavol Rusnak
b73e18e573
firmware: implement zip143 overwinter 2018-06-12 19:12:00 +02:00
Pavol Rusnak
32a7db423c
signing: rename hashers to separate their use and reduce confusion 2018-06-12 15:42:33 +02:00
Pavol Rusnak
747f2aa772
firmware: refactor expiry into tx_init 2018-06-07 13:17:51 +02:00
Pavol Rusnak
49d9fe4d13
firmware: rename decred_expiry to expiry 2018-06-05 14:09:38 +02:00
Pavol Rusnak
e2275a8b83
firmware: use new coin definitions from trezor-common 2018-05-29 17:17:29 +02:00
Jochen Hoenicke
e1ad1512d0 Avoid division by zero.
Check that there is no overflow in `inputs_count + outputs_count`.
Check that previous transaction contains at least the spent output.
2018-04-05 09:23:23 +02:00
Saleem Rashid
95e5f15bde vendor: Update trezor-crypto 2018-04-03 18:40:41 +02:00
Saleem Rashid
0df9404054 signing: Check decred_script_version for txinput 2018-04-03 18:40:41 +02:00
Saleem Rashid
e7703a16fe crypto: Remove hardcoded instances of secp256k1 2018-04-03 18:40:41 +02:00
Saleem Rashid
77e76542bc signing: Compute tx_weight for Decred 2018-04-03 18:40:41 +02:00
Saleem Rashid
d63e294c0b signing: Document Decred signing 2018-04-03 18:40:41 +02:00
Saleem Rashid
057ec1227d signing: Add Decred support 2018-04-03 18:40:41 +02:00
Saleem Rashid
3f51bc3628 signing: Use SignTx in signing_init 2018-04-03 18:40:41 +02:00
Jochen Hoenicke
1bc1bb1e77 Less paranoid change outputs.
- Allow change to be on the main chain (see spesmilo/electrum#3920).
- Allow more than one output to the Trezor, but don't treat it as change.
2018-02-20 16:39:16 +01:00
Saleem Rashid
ba5b44d0c5 emulator: Initial commit 2017-12-18 20:09:59 +01:00
Saleem Rashid
6e25e0b363 coins: Use curve_info instead of HasherType 2017-12-10 20:53:44 +01:00
Saleem Rashid
268e7de109 Update trezor-crypto 2017-12-10 20:53:44 +01:00
Saleem Rashid
a1e911aa4c transaction: Do not hardcode HASHER_SHA2 2017-12-10 20:53:44 +01:00
Saleem Rashid
54b0869535 signing: Use Hasher instead of SHA256_CTX 2017-12-09 16:28:40 +01:00
Tomas Susanka
cfe8a98c68 signing segwit change output typo 2017-11-25 01:06:46 +01:00
Jochen Hoenicke
e1fa7af1da Byte-precise size estimate for fees
Fixes issue #232.

It assumes largest possible signature size for all inputs.  For segwit
multisig it can be .25 bytes off due to difference between segwit
encoding (varint) vs. non-segwit encoding (op_push) of the multisig script.
2017-11-14 13:39:17 +01:00
Jochen Hoenicke
b8bca1c444 Fix segwit forkid signatures 2017-11-13 22:20:08 +01:00
Jochen Hoenicke
a8bc3cb6bd Remove add_hash_type fields.
The 4 byte hash_type/forkid is part of the signed message, but not
part of the transaction.  Instead of hacking it into the transaction,
add it after the transaction when computing the signature.
2017-11-13 22:20:08 +01:00
Saleem Rashid
d39e4be1c8 signing: Use force_bip143 instead of has_forkid 2017-11-13 22:20:08 +01:00
Saleem Rashid
b6f11c9f93 signing: Add signing_hash_type function
This also enables SIGHASH_FORKID for SegWit
2017-11-13 22:20:08 +01:00
Jochen Hoenicke
97581928de
Enable Segwit Bech32 addresses
Increase the size of the addresses in protobuf.
Fix layout2.c to handle longer addresses.
Add a field bech32_prefix to coins.h
Adapted the coins-gen script.
Added bech32 support in signing.c and transaction.c
2017-11-05 19:28:07 +01:00
Jochen Hoenicke
b5fa8a266a New CoinInfo separated from protobuf structures
Having CoinType using the protobuf structures has several disadvantages.
- We always need to change trezor-common if we need a new field (like
  bech32 prefix)
- Every time Trezor initializes it sends all this information out and
  nobody cares.
- The protobuf structures add storage overhead due to their fixed size.

I also removed most of the `has_` fields except for forkid:
- `has_segwit` was merged with segwit
- `has_coin_shortcut` can be replaced by test for NULL if necessary.

The fields were reordered for better padding.
2017-11-05 19:23:34 +01:00
Pavol Rusnak
18d8cb3c56
add project website (trezor.io) to license header 2017-11-05 17:47:23 +01:00
Jochen Hoenicke
a24e8a0484 Remove magic constants
Use defines for wallet depth and change chain.  Updated some comments
to clarify what is checked.
2017-11-03 19:12:41 +01:00
Jochen Hoenicke
4805f27e8c Fix checking change address
There was a signed/unsigned problem: size_t is unsigned, but we use
-1 to indicate mismatch.  The problem was that when checking the input
address path, it still did this unintentionally when a mismatch was
detected, forbidding to sign with mismatched inputs, even when there
is no change address.

We now use 1 for mismatch.  Also we don't allow change address anymore
if the inputs have a path of length 1.  This simplifies the code a bit.
2017-11-03 19:12:41 +01:00
Jochen Hoenicke
98e617d874
startup: use custom reset_handler
+ group confidential data in one place
+ zero all SRAM where needed
2017-08-16 13:52:01 +02:00
Jochen Hoenicke
3440ead4c9
Fix multisig for BCC 2017-07-30 22:58:26 +02:00
Jochen Hoenicke
5f6948e66b
Remove progress update 2017-07-30 22:57:44 +02:00
Jochen Hoenicke
3c75d28c78 Check input bip32 path again on second pass. 2017-07-30 22:51:18 +02:00
Jochen Hoenicke
6b615ce405 No quadratic hashing for hardfork
Don't hash the whole transaction if forkid is set.  Instead use the
same codepath as for segwit.

Rename segwit_to_spend to authorized_amount and use it for forkid
amount and segwit amount validity checks.

Removed some duplicated code.
2017-07-30 22:51:18 +02:00
Saleem Rashid
979a6ef266 signing: Skip TX_META with SIGHASH_FORKID 2017-07-30 22:51:18 +02:00
Saleem Rashid
a34554b091 signing: Add SIGHASH_FORKID support 2017-07-30 22:51:18 +02:00
Pavol Rusnak
3d7d0f0734
use C99 for loop where possible 2017-07-23 22:20:51 +02:00
Pavol Rusnak
c6fd70b471
gettext: mark localizable strings as proof-of-concept 2017-06-18 22:47:32 +02:00
Pavol Rusnak
00f6312a81
rename failures, unify strings where possible 2017-06-18 21:19:21 +02:00
Pavol Rusnak
317363f84c
enable mixing of segwit and non-segwit inputs 2017-05-19 17:40:57 +02:00
Pavol Rusnak
391e3940e5
refactor fee computation, but keep ceil logic 2017-05-15 12:08:54 +02:00
Pavol Rusnak
24ac52079f
disable native segwit for now 2017-05-13 01:05:10 +02:00
Pavol Rusnak
49f44d296c
refactor signing_check_output 2017-05-13 00:45:11 +02:00