Skip to content

Commit

Permalink
protob: add state field to Initialize and Features
Browse files Browse the repository at this point in the history
  • Loading branch information
prusnak committed Feb 9, 2018
1 parent 8652df0 commit c7dcca6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions protob/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ enum MessageType {
* @next Features
*/
message Initialize {
optional bytes state = 1; // assumed device state

This comment has been minimized.

Copy link
@saleemrashid

saleemrashid Feb 9, 2018

Contributor

Could you elaborate on what state means here?

This comment has been minimized.

Copy link
@prusnak

prusnak Feb 10, 2018

Author Member

For T1, if you send Initialize message, the device throws away the cached passphrase, triggering a new passphrase request when access to the root node is needed.

For T2 we came up with so-called device state (implemented as a hash of public key of the root node, but a client should just assume any random bytes data). If you assume that device state is X (because last time when you queried the device the returned state was X), you can set the state field to the last seen value. In case this matches the internal state, the cached passphrase is not discarded. If the field is not set or is set to a different state, the device will throw away the cached passphrase, effectively asking for a new passphrase. Afterwards, the client can check the state again if the device returned to the assumed state, for example.

Implementation for T2 can be seen here: https://github.com/trezor/trezor-core/blob/master/src/apps/common/cache.py

We plan to backport this behavior to T1 as well, but we might use different hash (sha256?).

}

/**
Expand Down Expand Up @@ -149,6 +150,7 @@ message Features {
optional uint32 fw_patch = 24; // reported firmware version if in bootloader mode
optional string fw_vendor = 25; // reported firmware vendor if in bootloader mode
optional bytes fw_vendor_keys = 26; // reported firmware vendor keys (their hash)
optional bytes state = 27; // current device state
}

/**
Expand Down

0 comments on commit c7dcca6

Please sign in to comment.