Commit Graph

27 Commits

Author SHA1 Message Date
Pavol Rusnak 18d8cb3c56
add project website (trezor.io) to license header 2017-11-05 17:47:23 +01:00
Pavol Rusnak 6d0d2348cf
usb: whitespace cleanup 2017-05-09 23:49:05 +02:00
Saleem Rashid bd167dcdf2 USB: Annotate USB interfaces with iInterface 2017-01-30 16:32:38 +01:00
Saleem Rashid 0c039b3e14 USB: Compile-time USB string checking
Generate `enum` for USB string indexes, this is far more robust
2017-01-30 16:32:38 +01:00
Pavol Rusnak 32f3c54cc4
fix whitespace 2017-01-04 18:52:55 +01:00
Roman Zeyde 9eb87245ba usb: exclude hid_report_descriptor_debug from non-debug build (#135) 2017-01-02 13:12:48 +01:00
Saleem Rashid b4eaf7dbaf timer: Fix non-critical integer overflow (#129)
Every 4294967295 milliseconds (2 ^ 32 - 1), system_millis will overflow.
This means that every 49.71 days, system_millis will reset to zero.
Comparisons like `system_millis < (system_millis + 1)` would fail if the
latter had overflown and the former had not.

This is non-critical because the worst case is that one second could be
skipped or the screen could lock early.

This poses no threat to the exponential backoff used for protection
against brute force.
2016-11-23 20:22:28 +01: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
Jochen Hoenicke 6d65551b82
More alignment fixes 2016-08-30 12:39:37 +02:00
Pavol Rusnak d7c0fbc379
add const where possible (for message parsing) 2016-08-29 22:36:18 +02:00
Pavol Rusnak fdbae0b0e0
fix hid_control_request for debug link 2016-06-30 14:04:11 +02:00
Pavol Rusnak 57197e1463
use macros for usb interface numbers 2016-06-12 23:11:46 +02:00
Pavol Rusnak 5e57a1ceaf
Merge branch 'u2f' 2016-06-12 22:53:28 +02:00
Pavol Rusnak 11072320a9
use ff01 usage page for debuglink 2016-05-27 15:27:41 +02:00
Jochen Hoenicke 18d549c83d Fix U2F hid interface index for debug link 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
Pavol Rusnak e119656c29
use descriptor that matches fido one (except usage_page) 2016-05-26 13:33:10 +02:00
Jochen Hoenicke 68b34af19e More standard conform behaviour
Tested with u2f-ref-code/u2f-tests.
Known incompatibility:
 - changed challenge invalidates button press.
2016-05-24 01:16:55 +02:00
Jochen Hoenicke a1ba431d94
Use more sensible HID descriptor 2016-05-23 19:20:21 +02:00
Jochen Hoenicke 2ab950555e Fixed u2f reentry 2016-05-15 10:44:57 +02:00
Jochen Hoenicke 55fe98ccd1 Fix USB HID descriptor 2016-05-15 10:44:40 +02:00
Jochen Hoenicke c1ff9e1ec7 Use more sensible hid descriptor. 2016-04-29 16:20:54 +02:00
Mark Bryars 9328cad7f1 Add U2F support 2015-11-03 16:47:12 +01:00
Pavol Rusnak 0c6b3e26e2 prepare 1.3.4 release 2015-08-03 21:59:06 +02:00
Jochen Hoenicke 218b9984bb New usbDelay that delays and handles USB requests
Added usbDelay that polls usb port (for system requests) while delaying.
This is called instead of delay in the button and pin delay functions.
Experimental evaluation gave that the cycle count should be roughly divided
by 28.5.
2015-04-29 19:10:48 +02:00
Pavol Rusnak 0d0a1ab5f2 import v1.0.0 2014-04-29 14:38:32 +02:00