Commit Graph

57 Commits

Author SHA1 Message Date
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
Pavol Rusnak a01ba51a2a
storage: copy only required bytes from old storage, bump storage version
+ backup_device: ask for pin, always use correct number of words
2017-08-16 13:11:31 +02:00
Pavol Rusnak f0d2e7a371
storage: bump version 2017-07-31 22:43:28 +02:00
Pavol Rusnak c778d7b9c3
storage: wipe storage after 15 wrong pins 2017-07-31 02:26:28 +02:00
Pavol Rusnak 3d7d0f0734
use C99 for loop where possible 2017-07-23 22:20:51 +02:00
Pavol Rusnak cf04279774
implement Storage.flags and related stuff 2017-07-17 18:36:09 +02:00
Pavol Rusnak ccb0cd82b6
firmware: add changelog, bump version to 1.5.1 2017-07-12 14:19:05 +02:00
Pavol Rusnak 97fa33de46
reset: show needs backup signed when storage is not backed up 2017-06-29 14:14:20 +02:00
Pavol Rusnak 73708aa47e
refactor recovery.is_same_mnemonic function to storage_containsMnemonic 2017-06-26 15:44:01 +02:00
Pavol Rusnak c6fd70b471
gettext: mark localizable strings as proof-of-concept 2017-06-18 22:47:32 +02:00
Saleem Rashid 25b9bfd97b timer: Use Cortex-M3 SysTick timers
Removed `usbDelay(uint32_t cycles)`, added `usbSleep(uint32_t millis)`

The same method signature could cause silent code breakage at runtime,
as opposed to noisy code breakage at compile time which is the better
kind.
2016-11-17 02:07:46 +01:00
Jochen Hoenicke 9287dd7e04
Poll USB during BIP39 derivation.
This patch adds calls to usbPoll in the progress callback.  This
should address #98.

We call usbDelay instead of Poll, to call usbd_poll several times.
Otherwise it would only handle one event instead of handling all
events that were pending so far.  The ugly magic number 5 is a guess.

Note that we also need to set usbTiny, so that we don't recursively
process messages.  Since we don't know whether usbTiny is set, we
need to store the old value (especially true for u2f).

This fix also relies on another fix in libopencm3.
2016-11-09 16:17:50 +01:00
Pavol Rusnak 4ce4cc5605
halt the device when encountered an invalid mnemonic (skip if device loaded or recovered without enforced wordlist) 2016-11-09 16:06:50 +01:00
Pavol Rusnak 71890e4edf
implement u2f_counter in LoadDevice, Recoverydevice and ResetDevice messages 2016-10-31 16:20:15 +01:00
Jochen Hoenicke 6d65551b82
More alignment fixes 2016-08-30 12:39:37 +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
Jochen Hoenicke 120cfc148f
new message SetU2FCounter 2016-06-12 23:44:36 +02:00
Pavol Rusnak b1e3c52b08
remove DialogIcon enum, use bitmap structure directly 2016-06-08 19:20:07 +02:00
Jochen Hoenicke c4e8bd0d0e More robust storage recycle sector
Clear storage marker first before clearing the second sector to prevent
leaving a state where only PIN failures have been cleared but storage is
still present.
2016-05-27 14:03:20 +02:00
Jochen Hoenicke e093371129 Added storage area for u2f counter.
To prevent flashing for every u2f operation just clear one bit in
the u2f area to indicate an increased counter.
2016-05-26 20:59:16 +02:00
Jochen Hoenicke 8e7896456a Merge branch 'origin/master' into u2f 2016-05-26 20:58:52 +02:00
Jochen Hoenicke 87bfd5a829 Bugfix: restore storage.
Storage restore was broken due to my previous patch.
2016-05-25 01:14:32 +02:00
Jochen Hoenicke bc92fb95a5
Clear pinarea on storage_init if upgrade fails
This also cleans up the code a bit and resets storage_uuid if upgrade fails.
2016-05-20 20:13:43 +02:00
Pavol Rusnak 46119bd007
clear pin failures on wipe and when in debug mode 2016-05-20 17:00:10 +02:00
Jochen Hoenicke 96f30a0ba7 Don't ask for passphrase with u2f. 2016-05-20 01:49:20 +02:00
Pavol Rusnak c123db71b9
Merge branch 'master' into u2f 2016-05-16 18:19:31 +02:00
Pavol Rusnak def4a9a02c
fix pbkdf2 usage in storage.c 2016-05-12 21:05:17 +02:00
Jochen Hoenicke cf38291ca4 Updated branch u2f 2016-04-29 16:19:54 +02:00
Jochen Hoenicke 630e26dd20 use less stack memory in storage_commit 2016-04-27 19:23:02 +02:00
Jochen Hoenicke da98a3a6fd Don't reflash storage after each PIN entry
Instead of reflashing the whole storage, we use a designated area
in the second storage block, where we mark each PIN failure by a
single zero bit. This is because one can set bits in flash to zero but
not to one.  If the PIN was entered successfully the whole word is
set to zero and the next word stores the new PIN failure counter.
2016-04-27 18:39:04 +02:00
Jochen Hoenicke 51f02ff763
ed25519 support 2016-04-22 18:22:45 +02:00
Jochen Hoenicke 03c501d9e3 Do not use hardcoded string for secp256k1. 2016-04-20 15:39:15 +02:00
Jochen Hoenicke 56238e63fc Added curve type to HD node.
Create a different root node for every curve type to separate the key
space.
2016-04-19 18:23:12 +02:00
Pavol Rusnak 1d3c7ee3f2
cleanup Waking up screen usage 2016-01-19 15:36:43 +01:00
Pavol Rusnak ed76d030ef
check for sessionPassphraseCached 2015-12-14 22:53:14 +01:00
Mark Bryars 9328cad7f1 Add U2F support 2015-11-03 16:47:12 +01:00
Roman Zeyde c08ff09f0f storage: add compile-time assert for sizeof(Storage) validation 2015-09-06 21:14:23 +03:00
Darin Stanchfield e99aafd949 fixed salt passing to pbkdf2_hmac_sha512 2015-05-05 12:01:34 -07:00
Pavol Rusnak 00ccf6a8ce bump storage version 2015-04-01 19:43:36 +02:00
Pavol Rusnak 4cbf29505d don't clear PIN on Initialize 2015-03-31 16:31:29 +02:00
Pavol Rusnak 40e174ac87 bump storage version 2015-03-18 13:34:09 +01:00
Jochen Hoenicke 286ee0525c PIN handling - constant time.
This diff contains three changes.
1. Make timing isPinCorrect independent of storage.pin, to avoid timing attacks
2. Only update failed PIN counter if the user entered a PIN.
   Of course, the fail counter is still incremented, before the PIN is checked.
3. Don't cache the PIN, but just the fact that the PIN was entered.  The
   cache should be in sync with storage.pin in any case.
2015-02-22 15:42:31 +01:00
Pavol Rusnak f2f50aa188 bump version to 1.3.1 2015-02-16 15:23:30 +01:00
Pavol Rusnak b5221ce2e9 introduce homescreen 2015-02-04 21:27:07 +01:00
Pavol Rusnak 40efefc571 rework pin handling 2015-01-27 13:00:25 +01:00
Pavol Rusnak 7dacfd69ee check for flash operation failure 2015-01-26 21:10:51 +01:00
Pavol Rusnak 2a2eba7de5 rework layoutProgress functions 2014-12-21 18:58:56 +01:00
Pavol Rusnak 0e92d4c588 error checking of hdnode functions return values 2014-12-16 18:28:46 +01:00
Pavol Rusnak 961566c9b7 implement ApplySetttings.use_passphrase 2014-12-13 19:29:27 +01:00
Pavol Rusnak c051dfde9d update trezor-crypto 2014-10-30 01:38:40 +01:00