trunks: ftdi: add TPM interface initialization code

This patch initializes the FTDI interface and then tries establishing
connection with the TPM2 device.

For the purposes of this installation the C232HM USB to FTDI to SPI
cable is connected to the TPM2 device as follows:

      3.3V => Red
       CLK => Orange
        CS => Brown
       GND => Black
      MISO => Green
      MOSI => Yellow
    RESSET => Grey

The use of SPI interface for controlling TPM2 is described in the
following TCG publication:

TCG PC Client Platform TPM Profile (PTP) Specification
Family "2.0"
Level 00 Revision 00.43
January 26, 2015

The device is first reset, then its Vendor ID is read, which allows to
confirm that the actual TPM2 device is present, then the Locality 0 is
claimed.

BUG=chromium:498861
TEST=connect the device and execute the following command inside chroot:

  $ sudo trunks_client --ftdi --startup
  Connected to device vid:did:rid of 15d1:001b:10
  [ERROR:tpm_utility_impl.cc(113)] Error shutting down: TPM_RC_INSUFFICIENT

The error is expected, as the actual TPM command is not yet passed on
to the device.

Change-Id: I8adf0aac53524c811cadf596f22fa80ba4423cdc
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/277165
Reviewed-by: Utkarsh Sanghi <usanghi@chromium.org>
3 files changed
tree: 63482c7b96823e179899d6a656d966e00a09b18f
  1. ftdi/
  2. generator/
  3. authorization_delegate.h
  4. background_command_transceiver.cc
  5. background_command_transceiver.h
  6. background_command_transceiver_test.cc
  7. command_transceiver.h
  8. CPPLINT.cfg
  9. dbus_interface.h
  10. dbus_interface.proto
  11. error_codes.cc
  12. error_codes.h
  13. hmac_authorization_delegate.cc
  14. hmac_authorization_delegate.h
  15. hmac_authorization_delegate_unittest.cc
  16. hmac_session.h
  17. hmac_session_impl.cc
  18. hmac_session_impl.h
  19. hmac_session_test.cc
  20. Makefile
  21. mock_authorization_delegate.cc
  22. mock_authorization_delegate.h
  23. mock_command_transceiver.cc
  24. mock_command_transceiver.h
  25. mock_hmac_session.cc
  26. mock_hmac_session.h
  27. mock_policy_session.cc
  28. mock_policy_session.h
  29. mock_session_manager.cc
  30. mock_session_manager.h
  31. mock_tpm.cc
  32. mock_tpm.h
  33. mock_tpm_state.cc
  34. mock_tpm_state.h
  35. mock_tpm_utility.cc
  36. mock_tpm_utility.h
  37. org.chromium.Trunks.conf
  38. OWNERS
  39. password_authorization_delegate.cc
  40. password_authorization_delegate.h
  41. password_authorization_delegate_unittest.cc
  42. policy_session.h
  43. policy_session_impl.cc
  44. policy_session_impl.h
  45. policy_session_test.cc
  46. README
  47. resource_manager.cc
  48. resource_manager.h
  49. resource_manager_test.cc
  50. scoped_key_handle.cc
  51. scoped_key_handle.h
  52. scoped_key_handle_test.cc
  53. session_manager.h
  54. session_manager_impl.cc
  55. session_manager_impl.h
  56. session_manager_test.cc
  57. tpm_constants.h
  58. tpm_generated.cc
  59. tpm_generated.h
  60. tpm_generated_test.cc
  61. tpm_handle.cc
  62. tpm_handle.h
  63. tpm_state.h
  64. tpm_state_impl.cc
  65. tpm_state_impl.h
  66. tpm_state_test.cc
  67. tpm_utility.h
  68. tpm_utility_impl.cc
  69. tpm_utility_impl.h
  70. tpm_utility_test.cc
  71. trunks.gyp
  72. trunks_client.cc
  73. trunks_client_test.cc
  74. trunks_client_test.h
  75. trunks_export.h
  76. trunks_factory.h
  77. trunks_factory_for_test.cc
  78. trunks_factory_for_test.h
  79. trunks_factory_impl.cc
  80. trunks_factory_impl.h
  81. trunks_ftdi_spi.cc
  82. trunks_ftdi_spi.h
  83. trunks_proxy.cc
  84. trunks_proxy.h
  85. trunks_service.cc
  86. trunks_service.h
  87. trunks_testrunner.cc
  88. trunksd-seccomp-amd64.policy
  89. trunksd-seccomp-arm.policy
  90. trunksd-seccomp-x86.policy
  91. trunksd.cc
  92. trunksd.conf