Commit Graph

55 Commits

Author SHA1 Message Date
Saleem Rashid 58d2079b56 transaction: Fix uninitialized read in compile_output 2017-12-20 15:04:43 +01:00
Saleem Rashid bab8db9191 vendor: Update Nanopb to 0.3.9 2017-12-19 14:11:51 +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
Pavol Rusnak 54659d49d8
layout: op_return now requires confirmation by user 2017-11-15 15:42:56 +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 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
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 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
Saleem Rashid a34554b091 signing: Add SIGHASH_FORKID support 2017-07-30 22:51:18 +02:00
Pavol Rusnak b5f9a5738f
segwit support for SignMessage, VerifyMessage 2017-07-25 19:32:20 +02:00
Pavol Rusnak 3d7d0f0734
use C99 for loop where possible 2017-07-23 22:20:51 +02:00
Jochen Hoenicke 9efc5bc93c Fixed array sizes again. (#194)
This is the correct fix for 09917920ba
(how the code was meant to be written).
2017-07-18 13:08:27 +02:00
Saleem Rashid 09917920ba transaction: Fix buffer overflow 2017-06-13 15:17:23 +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 b1995bb8d1
remove segwit warning, don't enable segwit on coins that don't have segwit=true in definition 2017-05-04 18:54:54 +02:00
Pavol Rusnak 38970cbd68
transaction: fix compile_output for OP_RETURN 2017-05-03 18:57:47 +02:00
Jochen Hoenicke 7b1381766f
Change address support for segwit.
Rewrote change address support for segwit.
Also checks the bip32 path of change address.
2017-03-29 20:59:01 +02:00
Jochen Hoenicke 8e84a6716c Merge master into segwit 2017-01-06 16:55:12 +01:00
Jochen Hoenicke e67f13ef4b
Multi-byte address prefixes for segwit 2017-01-04 18:55:42 +01:00
Pavol Rusnak 1763a5b647
use new hdnode_private_ckd_cached API 2016-12-12 12:17:48 +01:00
Jochen Hoenicke b7b9891cb4
Signing for Segnet Transaction works
see segnet4 txid:
aa434a6ef4fcf350e319bacbd725fa7446f797cb3ed0cd0582826a49d3351ffa
2016-11-05 22:47:21 +01:00
Jochen Hoenicke e5000fb196
segwit sign (completely untested) 2016-11-05 22:47:18 +01:00
Jochen Hoenicke 5c60be9854
hashes for segwit signature 2016-11-05 22:37:01 +01:00
Jochen Hoenicke 1bd4b99f95
Allow SegWit addresses
New output scripts for segwit addresses in accordance to BIP-142 and BIP-141.
This allows Trezor to pay to segwit users, but it doesn't enable segwit for
Trezor itself.
2016-11-05 22:35:32 +01:00
Pavol Rusnak c288a0e328
implement TXEXTRADATA transaction RequestType 2016-10-20 13:25:40 +02:00
Pavol Rusnak c0181b1aec
extract address related stuff into trezor-crypto 2016-10-10 11:26:52 +02:00
Daira Hopwood 69d99d202d
Add support for multi-byte address prefixes. 2016-10-10 00:05:45 +02:00
Jochen Hoenicke ae4dff6e5f Only compute pubkey on demand.
Changed all hdnode callers to call hdnode_fill_public_key if
they need the public key.
2016-06-27 10:13:18 +02:00
Pavol Rusnak 5e5138066a
adapt the reorder of hash_final functions 2016-04-26 11:53:58 +02:00
Pavol Rusnak d35b741f08 enable OP_RETURN 2015-02-04 20:04:59 +01:00
Pavol Rusnak 5f8a4f6da1 use hdnode_private_ckd_cached where appropriate 2015-01-26 20:24:07 +01:00
Pavol Rusnak 48cc36b1b9 adapt to new base58 api, use CoinType.address_type_p2sh field 2014-12-23 03:18:29 +01:00
Pavol Rusnak 30a55829e5 rework hashing of transactions 2014-12-21 20:34:14 +01:00
Pavol Rusnak 2a2eba7de5 rework layoutProgress functions 2014-12-21 18:58:56 +01:00
Pavol Rusnak 7000451f71 implement OutputScriptType_PAYTOMULTISIG, reorganize compile_output code 2014-12-20 20:34:19 +01:00
Pavol Rusnak 0d427f2cd2 fix confirm layouts in multisig operation 2014-12-20 02:38:53 +01:00
Pavol Rusnak 4122b56e1c check return value of cryptoHDNodePathToPubkey 2014-12-16 18:49:49 +01:00
Pavol Rusnak 0e92d4c588 error checking of hdnode functions return values 2014-12-16 18:28:46 +01:00
Pavol Rusnak 1385de1154 use const where appropriate 2014-12-16 16:50:12 +01:00
Pavol Rusnak 567537cd03 update to new multisig api 2014-12-16 14:28:47 +01:00
Pavol Rusnak 7e27275ec8 allow 15/15 multisig 2014-12-10 20:20:03 +01:00
Pavol Rusnak 92cfcd1565 implement GetAddress.multisig field 2014-12-10 18:04:51 +01:00
Pavol Rusnak 91451f88b5 multisig 2014-12-06 19:12:55 +01:00
Pavol Rusnak f75515544f move Sign/Verify to crypto.c/h, implement Encrypt/Decrypt 2014-11-25 19:32:04 +01:00