tree: b9b364bd0a3083b8891f59073a20da9cd918aad6 [path history] [tgz]
  1. g2f_tools/
  2. init/
  3. BUILD.gn
  4. hid_interface.h
  5. main.cc
  6. org.chromium.U2F.conf
  7. OWNERS
  8. README.md
  9. tpm_vendor_cmd.cc
  10. tpm_vendor_cmd.h
  11. u2f_adpu.cc
  12. u2f_adpu.h
  13. u2fhid.cc
  14. u2fhid.h
  15. uhid_device.cc
  16. uhid_device.h
  17. user_state.cc
  18. user_state.h
  19. user_state.proto
  20. util.cc
  21. util.h
  22. x509_tmpl.txt
u2fd/README.md

U2Fd : U2FHID Emulation Daemon

About

U2Fd (Universal Second Factor Daemon) is a daemon emulating a U2FHID interface as defined by the FIDO Alliance FIDO U2F HID Protocol Specification and forwarding the raw U2F APDU it has extracted (as defined by FIDO U2F Raw Message Formats) to the actual U2F implementation.

It is used as part of the Integrated Second Factor Authentication in the Chromebook where the U2F implementation is provided by the on-board security chip firmware.

Data flow

The U2Fd daemon creates a new HID device from userspace using the UHID kernel interface and gets the U2F HID reports from there (as implemented by the UHidDevice class).

The daemon parses the HID reports and re-constructs the U2FHID messages from the succession of frames: one INIT and CONT (as implemented by the U2fHid class). It answers the INIT and LOCK messages as expected by the protocol specification, and when it gets a MSG message containing a U2F APDU as payload, it simply forwards it to the provided TransmitApduCallback function.

In this implementation, the U2F APDUs are sent to the cr50 firmware in the TPM security chip which has an extension to process U2F APDUs sent through a vendor defined command. The TpmVendorCommandProxy class encapsulates an APDU in the VENDOR_CC_U2F_APDU vendor command and sends it to the trunks daemon using a D-Bus connection. The latter communicates itself with the physical TPM through the kernel driver exposing /dev/tpm0.

The HID interface created by the U2Fd daemon is used by the usual un-modified security key clients (e.g. the Chrome browser through the permission broker).

Physical Presence

The U2F firmware is using the laptop power button as the user physical presence sensing. In order to avoid spurious UI actions when the user touches the power button to acknowledge their presence, the daemon scans the U2F requests and when it sees a physical presence test, it temporarily de-activates the next power button press forwarding to the UI (by sending a D-Bus message to powerd).

Interfaces

The daemon has 3 interfaces to the outside world:

  • the /dev/uhid kernel node to create/communicate with the HID device.
  • a D-Bus proxy to the trunksd daemon to send TPM messages.
  • a D-Bus proxy to the powerd daemon to send power button overrides.

Testing

The implementation can be tested on the laptop by using the HIDTest and U2FTest reference test programs.

HIDTest will also be converted to a unit-test for the U2fHid class.

Specifications

The FIDO Alliance specifications: