public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/18] Introduce SPI TPM v2.0 support
@ 2018-03-08 15:40 Miquel Raynal
  2018-03-08 15:40 ` [U-Boot] [PATCH 01/18] tpm: add Revision ID field in the chip structure Miquel Raynal
                   ` (18 more replies)
  0 siblings, 19 replies; 29+ messages in thread
From: Miquel Raynal @ 2018-03-08 15:40 UTC (permalink / raw)
  To: u-boot

Current U-Boot supports TPM v1.2 specification. The new specification
(v2.0) is not backward compatible and renames/introduces several
functions.

This series introduces a new SPI driver following the TPM v2.0
specification. It has been tested on a ST TPM but should be usable with
others v2.0 compliant chips.

Then, basic functionalities are introduced one by one for the v2.0
specification. The INIT command now can receive a parameter to
distinguish further TPMv1/TPMv2 commands. After that, the library itself
will know which one is pertinent and will return a special error if the
desired command is not supported for the selected specification.

Available commands for v2.0 TPMs are:
* STARTUP
* SELF TEST
* CLEAR
* PCR EXTEND
* PCR READ
* GET CAPABILITY
* DICTIONARY ATTACK LOCK RESET
* DICTIONARY ATTACK CHANGE PARAMETERS
* HIERARCHY CHANGE AUTH

Two commands have been written but could not be tested (unsupported by
the TPM chosen):
* PCR CHANGE AUTH POLICY
* PCR CHANGE AUTH VALUE

With this set of function, minimal TPMv2.0 handling is possible with the
following sequence.

* First, initialize the TPM stack in U-Boot: "TPM2" is a new parameter
  to discern the format of the commands:

> tpm init TPM2

* Then send the STARTUP command to the TPM. The flag is slightly
  different between the revisions.

> tpm startup TPM2_SU_CLEAR

* To enable full TPM capabilities, continue the tests (or do them all
  again). It seems like self_test_full always waits for the operation to
  finish, while continue_self_test returns a busy state if called to
  early.

> tpm continue_self_test
> tpm self_test_full

* Manage passwords (force_clear also resets a lot of internal stuff).
  Olderly, TAKE OWNERSHIP == CLEAR + CHANGE AUTH. LOCKOUT is an example,
  ENDORSEMENT and PLATFORM hierarchies are available too:

> tpm force_clear TPM2_RH_LOCKOUT [<pw>]
> tpm change_auth TPM2_RH_LOCKOUT <new_pw> [<old_pw>]

* Dictionary Attack Mitigation (DAM) parameters can be changed. It is
  possible to reset the failure counter and disable the lockout (values
  erased after a CLEAR). It is then possible to check the parameters
  have been correctly applied.

> tpm dam_reset_counter [<pw>]
> tpm dam_set_parameters 0xffff 1 0 [<pw>]
> tpm get_capability 0x0006 0x020e 0x4000000 4

* PCR policy may be changed (untested).
  PCR can be extended (no protection against packet replay yet).
  PCR can be read (the counter with the number of "extensions" is also
  given).

> tpm pcr_setauthpolicy 0 12345678901234567890123456789012 [<pw>]
> tpm pcr_read 0 0x4000000
> tpm pcr_extend 0 0x4000000


Miquel Raynal (18):
  tpm: add Revision ID field in the chip structure
  tpm: rename tpm_tis_infineon in tpm_tis_infineon_i2c
  tpm: add support for TPMv2 SPI modules
  tpm: fix indentation in command list before adding more
  tpm: prepare support for TPMv2 commands
  tpm: add macros for TPMv2 commands
  tpm: add possible traces to analyze buffers returned by the TPM
  tpm: handle different buffer sizes
  tpm: add TPM2_Startup command support
  tpm: add TPM2_SelfTest command support
  tpm: add TPM2_Clear command support
  tpm: rename the _extend() function to be _pcr_event()
  tpm: add TPM2_PCR_Extend command support
  tpm: add TPM2_PCR_Read command support
  tpm: add TPM2_GetCapability command support
  tpm: add dictionary attack mitigation commands support
  tpm: add TPM2_HierarchyChangeAuth command support
  tpm: add PCR authentication commands support

 cmd/tpm.c                                          | 360 +++++++++--
 cmd/tpm_test.c                                     |  10 +-
 drivers/tpm/Kconfig                                |  13 +-
 drivers/tpm/Makefile                               |   3 +-
 drivers/tpm/tpm_tis.h                              |   4 +
 .../{tpm_tis_infineon.c => tpm_tis_infineon_i2c.c} |   2 +-
 drivers/tpm/tpm_tis_spi.c                          | 656 +++++++++++++++++++++
 include/tpm.h                                      | 183 +++++-
 lib/tpm.c                                          | 654 ++++++++++++++++++--
 9 files changed, 1739 insertions(+), 146 deletions(-)
 rename drivers/tpm/{tpm_tis_infineon.c => tpm_tis_infineon_i2c.c} (99%)
 create mode 100644 drivers/tpm/tpm_tis_spi.c

-- 
2.14.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2018-03-29 22:41 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-08 15:40 [U-Boot] [PATCH 00/18] Introduce SPI TPM v2.0 support Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 01/18] tpm: add Revision ID field in the chip structure Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 02/18] tpm: rename tpm_tis_infineon in tpm_tis_infineon_i2c Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 03/18] tpm: add support for TPMv2 SPI modules Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 04/18] tpm: fix indentation in command list before adding more Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 05/18] tpm: prepare support for TPMv2 commands Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 06/18] tpm: add macros " Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 07/18] tpm: add possible traces to analyze buffers returned by the TPM Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 08/18] tpm: handle different buffer sizes Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 09/18] tpm: add TPM2_Startup command support Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 10/18] tpm: add TPM2_SelfTest " Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 11/18] tpm: add TPM2_Clear " Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 12/18] tpm: rename the _extend() function to be _pcr_event() Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 13/18] tpm: add TPM2_PCR_Extend command support Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 14/18] tpm: add TPM2_PCR_Read " Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 15/18] tpm: add TPM2_GetCapability " Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 16/18] tpm: add dictionary attack mitigation commands support Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 17/18] tpm: add TPM2_HierarchyChangeAuth command support Miquel Raynal
2018-03-08 15:40 ` [U-Boot] [PATCH 18/18] tpm: add PCR authentication commands support Miquel Raynal
2018-03-08 17:20 ` [U-Boot] [PATCH 00/18] Introduce SPI TPM v2.0 support Tom Rini
2018-03-09  7:53   ` Miquel Raynal
2018-03-09 12:18     ` Tom Rini
2018-03-20 13:36       ` Miquel Raynal
2018-03-20 14:04         ` Tom Rini
2018-03-20 14:51           ` Miquel Raynal
2018-03-21 13:49             ` Tom Rini
2018-03-23 14:42               ` Simon Glass
2018-03-29  7:39                 ` Miquel Raynal
2018-03-29 22:41                   ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox