Skip to content

Trezor: add support for a new Trezor-Host Protocol #775

Open
@M1nd3r

Description

@M1nd3r

Rationale

New Trezor devices will use a new session-based Trezor-Host Protocol with encrypted channels. For HWI to support such devices, changes in trezorlib are necessary. Furthermore, to avoid a new handshake for each command, information about the connection needs to be temporarily stored (encryption and decryption keys, nonces, synchronization bits, channel id). Optionally, Trezor can issue a long-term pairing credential to avoid repeated pairing.

Brief description of the new protocol

Handshake, encryption:

  • Handshake is based on the XX handshake pattern as specified in Noise Protocol Framework. With a modification that instead of using Trezor's public static key directly, a masked key is used:
    trezor_masked_static_pubkey = X25519(SHA-256(trezor_static_pubkey || trezor_ephemeral_pubkey), trezor_static_pubkey).
  • Elliptic curve Curve25519, function X25519, and key pair generation are specified in RFC 7748.
  • Communication is encrypted using AES-GCM.

Pairing:

  • Newly, authentication of the host is mandatory. Trezor supports several pairing procedures.
  • The CodeEntry (user rewrites short code from Trezor's display to the host) is implemented in trezorlib.

Pairing credential:

  • After successful pairing/connection, the host can ask Trezor for a long-term pairing credential.
  • When the host presents with a valid pairing credential during the Handshake phase, the pairing is skipped.

cc: @matejcik

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions