Commit Graph

432 Commits

Author SHA1 Message Date
Jan Pochyla 507d9bdf68 wire: add tests for v1 codec 2016-10-24 15:40:34 +02:00
Pavol Rusnak 7404a76aeb
modtrezorcrypto: add test_sign_verify_random to curve unit tests 2016-10-24 13:46:59 +02:00
Pavol Rusnak 9c921c073f
modtrezorcrypto: add generate_secret methods to curves 2016-10-24 13:23:10 +02:00
Pavol Rusnak 3c5c685b8c
add curve25519.publickey and unittest for randomized multiply 2016-10-23 22:39:11 +02:00
Pavol Rusnak 7f5fa78f35
modtrezorcrypto: add ECDH for nist256p1, secp256k1, curve25519 (multiply method) 2016-10-22 00:51:52 +02:00
Jan Pochyla 4216e6f544 tests: remove old wire_codec test example 2016-10-21 15:07:31 +02:00
Jan Pochyla d0b29d4caa wire: add tests, fix missing 0-padding 2016-10-21 15:02:20 +02:00
Pavol Rusnak e62e8dbe6f
tools: move coins-gen tool to /tools 2016-10-20 17:07:56 +02:00
Pavol Rusnak 1420ad591b
apps: add apps.common.coins (+generator) 2016-10-20 16:40:57 +02:00
Jan Pochyla 688d293b01 wire: use memoryview() asap in the parsing process 2016-10-20 15:14:40 +02:00
Jan Pochyla 67ac47f087 apps.homescreen: respond with ~correct data, handle GetFeatures 2016-10-20 15:14:40 +02:00
Jan Pochyla ad2955aaab ui: code style, make header icon optional 2016-10-20 15:14:40 +02:00
Jan Pochyla b60206d588 app.management: fix missing icon 2016-10-20 15:14:40 +02:00
Jan Pochyla 74b2170e3f ui.swipe: make constants private
Private const() can be inlined properly.
2016-10-20 15:14:40 +02:00
Jan Pochyla 4e290cc6df ui.loader: add is_active method 2016-10-20 15:14:39 +02:00
Jan Pochyla d94dd32816 ui.text: code style, add color support 2016-10-20 15:13:47 +02:00
Jan Pochyla 7a518e9fa4 seed: add passphrase UI 2016-10-20 15:13:47 +02:00
Jan Pochyla c5dfcb53d1 apps.wallet: add GetAddress 2016-10-20 15:13:47 +02:00
Pavol Rusnak 3067bfa003
modtrezorui: add yoffset parameter to display.loader 2016-10-18 16:27:13 +02:00
Jan Pochyla a44e16a9ca rework high-level storage
We don't use Storage protobuf message anymore, and instead all keys are as granular as possible.

trezor.storage provides high-level function interface.
2016-10-14 15:35:44 +02:00
Jan Pochyla 53f6347838 protobuf: optimize memory, minor api changes
In StreamReader, avoid buffering reallocs by copying right into caller-supplied buffer.

Add loads() and dumps() to all scalar types through ScalarType superclass.

TODO: The API is steall really ugly, especially the stuff about targets/sources and load() function signatures.
2016-10-14 15:29:14 +02:00
Jan Pochyla 385eab91f1 modtrezorcrypto: add bip32 tests 2016-10-14 15:12:17 +02:00
Jan Pochyla 0a5e43723f utils: export TrezorUtils.memcpy 2016-10-11 17:18:31 +02:00
Pavol Rusnak a9131f26e7
debug: fix variable name 2016-10-11 14:01:32 +02:00
Pavol Rusnak 882efbf21b
modtrezormsg: use interfaces index internally, usage_page externally 2016-10-11 13:15:13 +02:00
Pavol Rusnak a423d4602f
modtrezormsg: store assigned used pages internally, add get_interfaces method 2016-10-11 12:33:02 +02:00
Pavol Rusnak 3f44dfedb5
modtrezormsg: use usage_page to identify interfaces 2016-10-11 12:14:17 +02:00
Pavol Rusnak d9546d45b9
ui: proper size for loader 2016-10-11 11:29:31 +02:00
Pavol Rusnak ad6c274e07
modtrezorui: loader icon is now 64x64; reorganize icons 2016-10-10 14:51:52 +02:00
slush0 51de3a3d9c Setting initial brightness to ui.BACKLIGHT_NORMAL 2016-10-08 13:02:02 +02:00
slush0 ac726746b9 Changed dimming constants (tested on hw) 2016-10-08 12:06:56 +02:00
slush0 cf38b58a73 Reworked homescreen (no blinking, only diming)
Added ui.alert()
2016-10-08 11:47:28 +02:00
Pavol Rusnak 3e8b025cbd
use mp_obj_new_str_of_type where it makes sense instead of mp_obj_new_str_from_vstr 2016-10-07 13:57:21 +02:00
chren 78efd4f2e0 minor color changes in pin dialog 2016-10-06 17:59:46 +02:00
chren cb2399197f fixed wipe device header 2016-10-06 16:35:36 +02:00
chren 5a20a48745 added ui header and icons 2016-10-06 16:17:11 +02:00
Jan Pochyla abd20741f6 add seed module, GetPublicKey now works 2016-10-06 15:05:14 +02:00
Jan Pochyla d0bb7edbfa storage: change api to protobuf 2016-10-06 15:05:14 +02:00
Jan Pochyla 6b94511472 LoadDevice: validate mnemonic, import xprv 2016-10-06 15:05:14 +02:00
Jan Pochyla 492e71f147 workflow: less verbose naming 2016-10-06 15:05:14 +02:00
Jan Pochyla 6d5514ac4a make logging less verbose 2016-10-06 15:05:14 +02:00
Jan Pochyla c019741c33 wire: fix write_message, pbuf dumps is sync now 2016-10-06 15:05:14 +02:00
Jan Pochyla 4b0da8677a wire: fix read_message for v1 protocol 2016-10-06 15:05:14 +02:00
Jan Pochyla c3ee7dd709 loop: refresh display after every step 2016-10-06 15:05:14 +02:00
Jan Pochyla cc22d59eca ui: clear the screen before common layouts 2016-10-06 15:05:14 +02:00
Jan Pochyla b2299c118a protobuf: fix repeated fields 2016-10-06 15:05:14 +02:00
Jan Pochyla be069a771b protobuf: use async/await, make loads/dumps sync 2016-10-06 15:05:14 +02:00
Jan Pochyla ec412c6da3 protobuf: fix uvarint dumping
In python3, chr() is not a proper way to pack an int to bytes.
2016-10-06 15:05:14 +02:00
Pavol Rusnak 7dc53219d2
extract common bootloader stuff into bl_common.py 2016-10-05 21:09:45 +02:00
Pavol Rusnak e405a6305d
use bar_radius where needed 2016-10-05 20:36:28 +02:00
Pavol Rusnak 036a4ead33
remove playground from main.py 2016-10-05 20:16:48 +02:00
Pavol Rusnak 2e39c86b42
cleanup 2016-10-05 19:48:08 +02:00
Pavol Rusnak a536e2d6a5
loader is now smaller 2016-10-05 15:15:21 +02:00
Pavol Rusnak 27fb301b22
validate mp_buffer_info_t usage for cases where len==0 2016-10-04 19:22:48 +02:00
Pavol Rusnak 2e2534585b
call ui.display.refresh in loop.py 2016-10-04 16:33:38 +02:00
Pavol Rusnak b7f378376b
disable obsolete test_wire.py for now 2016-10-03 20:07:14 +02:00
Pavol Rusnak d995e53d28
add travis tests 2016-10-03 16:32:58 +02:00
slush0 97522be434 Added new messages 2016-10-03 15:41:38 +02:00
slush0 1840e331bb Moved unused images out of resources 2016-09-29 15:58:21 +02:00
Jan Pochyla f2b509b591 use micropython.const() in trezor.messages 2016-09-29 12:37:40 +02:00
Jan Pochyla 407169af01 import qualified const() 2016-09-29 12:29:43 +02:00
Jan Pochyla c9fbac7a0b LoadDevice now works 2016-09-28 23:30:33 +02:00
Jan Pochyla 0e799d62af move sub-workflows do apps/common 2016-09-28 23:30:10 +02:00
Jan Pochyla c93133026e autopep8 and minor cosmetics 2016-09-28 23:28:53 +02:00
Jan Pochyla 976b14a5b8 protobuf: skip None values while dumping 2016-09-28 23:17:11 +02:00
Jan Pochyla fb7b85e479 move protobuf to a single module 2016-09-28 23:17:11 +02:00
slush0 cb1dcc965d TREZOR v1 protocol codec 2016-09-28 22:59:30 +02:00
slush0 e8850e4aa5 Fixing generator startup in read_message. 2016-09-28 22:57:45 +02:00
slush0 8a160becb9 Added support for TREZOR v1 protocol (acts as session 0 internally). 2016-09-28 22:34:12 +02:00
Pavol Rusnak 281070492d
fix bootloader, extract FONT_* constants 2016-09-28 18:21:29 +02:00
Pavol Rusnak ed975398d9
move ui.clear into ui.display.clear 2016-09-28 17:00:27 +02:00
Jan Pochyla e67037bc4d fix homescreen rotation, revert the logo 2016-09-27 17:41:20 +02:00
Jan Pochyla c952500552
fix ui.rotate_coords, remove pulse_animation 2016-09-27 17:26:18 +02:00
Jan Pochyla 35d53ad7fc
simplify the Text interface 2016-09-27 17:26:18 +02:00
chren 69fa5acf8b
limit pin length 2016-09-27 17:26:17 +02:00
chren fe4e024088
changed homescreen bg 2016-09-27 17:26:17 +02:00
Jan Pochyla 3f4365eda6
add Text, move Loader to ui.loader 2016-09-27 17:26:16 +02:00
Jan Pochyla 0637987c09
change wipe_device to use long-press confirm 2016-09-27 17:26:16 +02:00
chren 4d672fee28
added some backgrounds and change color vars 2016-09-27 17:26:15 +02:00
Pavol Rusnak a3ec1c082a
add log to wire.io 2016-09-27 17:26:14 +02:00
chren dbfb06d30e
experimenting with ui in reset_device 2016-09-27 17:26:14 +02:00
Pavol Rusnak 299c616d1b
fix __import__ call 2016-09-27 17:26:14 +02:00
chren cc35a00639
removed old playground and some color changes 2016-09-27 17:26:14 +02:00
Jan Pochyla 096bfbaf2a
fix Swipe on stmhal 2016-09-27 17:26:13 +02:00
Jan Pochyla 883b392fdb
adopt wire dispatching, log removed modules 2016-09-27 17:26:13 +02:00
Jan Pochyla e9c7a67c73
make imports more local, remove trezor.workflows, minor tweaks 2016-09-27 17:26:13 +02:00
Pavol Rusnak db6673b50e
move initialization of I2C1 to msg_init() 2016-09-27 17:26:13 +02:00
Jan Pochyla 07dd27c567
get rid of layout stubs 2016-09-27 17:26:12 +02:00
Jan Pochyla 01ac17440d
wipe_device workflow, pin API work 2016-09-27 17:26:12 +02:00
Jan Pochyla dd713fe6e2
add Storage to reset_device, stub session support in config 2016-09-27 17:26:12 +02:00
Jan Pochyla 34ed2fb86a
workflow monitor, reset_device layout work
- request/response manner of usual protobuf workflows is enforced, workflows are expected to either return a valid protobuf response, or raise an exception
- added wire.FailureError exception that allows workflow to provide Failure code & message
- pin workflows simplified

TODO: all this workflow work does not really belong in trezor.wire
2016-09-27 17:26:11 +02:00
Jan Pochyla 70110187cc
overload __iter__ in loop.Wait
This will automatically exit child tasks in case of close() or throw() on the waiting task, but only if run through `await` or `yield from`
2016-09-27 17:26:11 +02:00
Jan Pochyla 02b13af526
fix session id range 2016-09-27 17:26:11 +02:00
Jan Pochyla 64746d01b4
use memoryviews in wire_codec 2016-09-27 17:26:11 +02:00
Jan Pochyla 7570977cc4
little perf tweaks in protobuf 2016-09-27 17:26:10 +02:00
Pavol Rusnak e480871db3
generate proper events from touchscreen 2016-09-27 17:26:10 +02:00
Pavol Rusnak f727cab942
rework aes module, add summary to test script 2016-09-27 17:26:09 +02:00
Pavol Rusnak dd78f83576
update docu strings in aes 2016-09-27 17:26:09 +02:00
Pavol Rusnak a15730087c
VCP is the new CDC 2016-09-27 17:26:08 +02:00
Pavol Rusnak d9495b12ac
trezor.crypto.aes finished (including unit tests) 2016-09-27 17:26:07 +02:00
Pavol Rusnak fc05f25255
trezor.crypto.aes work in progres 2016-09-27 17:26:07 +02:00
Jan Pochyla d5942d664c
add the generated wire type index 2016-09-27 17:26:07 +02:00
Jan Pochyla 6991286f8b
use __iter__ instead of wait 2016-09-27 17:26:06 +02:00
Jan Pochyla b8dd8ed90c
wire fixes 2016-09-27 17:26:06 +02:00
Jan Pochyla 97d402eba8
unify unimport_func and unimport_gen, asyncify 2016-09-27 17:26:06 +02:00
Jan Pochyla 099767d592
session/workflow overhaul
- lazy loading and importing of protobuf messages
- workflow dispatching through codec pipeline on the first message report

HACK: workflow killing
TODO: cap on concurrent sessions
TODO: ui locking/queuing
TODO: session storage
TODO: tests
2016-09-27 17:26:06 +02:00
Jan Pochyla 99485b3385
finalize the streaming pbuf codec 2016-09-27 17:26:05 +02:00
Pavol Rusnak f42b62fa40
use mock config for stmhal, setup hid in boot 2016-09-27 17:26:05 +02:00
Pavol Rusnak 7aa8593941
store config in /var/tmp 2016-09-27 17:26:05 +02:00
Pavol Rusnak 7d4fbd07ea
fix typing.NewType 2016-09-27 17:26:04 +02:00
Pavol Rusnak bfa034f2d9
add typing module
(just stubs, but should implement most of the stuff from PEP 484
and https://docs.python.org/3/library/typing.html)
2016-09-27 17:26:04 +02:00
Jan Pochyla 312859ba71
add experimental animation with `async for` 2016-09-27 17:26:03 +02:00
Jan Pochyla 3eaf001eef
add a broken PoC of wire/protobuf stream reading 2016-09-27 17:26:03 +02:00
Jan Pochyla d6592a48e6
fixes for v2 wire 2016-09-27 17:26:03 +02:00
Jan Pochyla 096f3f898f
move pagination primitives to trezor.ui.scroll 2016-09-27 17:26:03 +02:00
Jan Pochyla 455a436123
autopep8 2016-09-27 17:26:02 +02:00
Jan Pochyla a4d1b27541
test async/await support in homescreen layout 2016-09-27 17:26:02 +02:00
Jan Pochyla c8c34c875b
simplify loop.py, add loop.Future, supoort `await` 2016-09-27 17:26:02 +02:00
Jan Pochyla 3a69524c52
simplify read_wire_msg a bit 2016-09-27 17:26:02 +02:00
Jan Pochyla cb0f5e2595
switch to v2 wire protocol
- sessions
- crc32 checksum

TODO: tests
TODO: python-trezor implementation
TODO: dispatching
2016-09-27 17:26:01 +02:00
Pavol Rusnak 545e93d1b4
add layout to u2f app 2016-09-27 17:26:01 +02:00
Pavol Rusnak cd28103b75
add bitbucket/gitlab to known u2f apps 2016-09-27 17:26:01 +02:00
Pavol Rusnak d4d8729568
add mem constants to debug module 2016-09-27 17:26:01 +02:00
Pavol Rusnak fbfd9d4b61
split debug (=dangerous) things from trezor.utils to trezor.debug 2016-09-27 17:26:01 +02:00
Pavol Rusnak 6402b3d232
update slush pool logo 2016-09-27 17:26:00 +02:00
Pavol Rusnak ce734df1b0
add u2f icons, remove toig/toif from assets 2016-09-27 17:26:00 +02:00
Jan Pochyla ae4540c59b
introduce generic swipe container to reset_device
Now its possible to block multiple generators on one interface.
2016-09-27 17:26:00 +02:00
slush0 7aaba5c6ce
Added u2f hash for Slush Pool 2016-09-27 17:26:00 +02:00
chren 53a6132ed8
tests with UI and minor changes in scroll component 2016-09-27 17:25:59 +02:00
chren be01cee8d3
added loading layout playground 2016-09-27 17:25:59 +02:00
chren 16f81c3264
added dummy scroll down icon with animation 2016-09-27 17:25:59 +02:00
chren fed9309ffa
added playground of scrollicon 2016-09-27 17:25:59 +02:00
Pavol Rusnak e6b8dc3cc5
add perf option to emu.sh (-p) 2016-09-27 17:25:58 +02:00
Pavol Rusnak d3d21bdbbd
remove main_stick and company 2016-09-27 17:25:58 +02:00
chren 771372adb2
replace scrolling to componenet, added mockup for recovery device layout 2016-09-27 17:25:58 +02:00
chren 887c877567
paging "scrollbar" 2016-09-27 17:25:58 +02:00
Jan Pochyla 4bf7535903
pass kwargs through to ConfirmDialog 2016-09-27 17:25:58 +02:00
chren 3746777628
fix micro bug for pin buttons 2016-09-27 17:25:57 +02:00
chren cb2027ad86
added button to finish [tbd] 2016-09-27 17:25:57 +02:00
chren 7237321470
fix pagination of seed 2016-09-27 17:25:57 +02:00
chren cd35a592a1
fix way of scrolling 2016-09-27 17:25:57 +02:00
chren e8601232e8
fixed img url, added img to local res folder 2016-09-27 17:25:57 +02:00
chren 2482d3935d
sign message layout 2016-09-27 17:25:56 +02:00
Jan Pochyla 43e6bc2f11
raise on registering conflicting message handler 2016-09-27 17:25:56 +02:00
Jan Pochyla 788eb675a5
remove seed app initialization 2016-09-27 17:25:56 +02:00
Jan Pochyla 6553d315e6
move 'chunks' to trezor.utils 2016-09-27 17:25:56 +02:00
Jan Pochyla 6c0970df9e
remove apps/seed example 2016-09-27 17:25:55 +02:00
Jan Pochyla 9f0b27f597
add ResetDevice workflow 2016-09-27 17:25:55 +02:00
Jan Pochyla 961ae90dd2
regenerate messages with __repr__ support 2016-09-27 17:25:55 +02:00
Jan Pochyla 173c49bef8
add __repr__ to Message and MessageType 2016-09-27 17:25:55 +02:00