Skip to content

Introduce TPMv2.0 support

Tom Rini u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v4 Latest32 patches 0 repliesNew

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/32tpm: remove redundant blank line+0 -00 replies
1/32tpm: remove redundant blank line+0 -00 replies
2/32tpm: remove extra spaces between a function and its opening bracket+0 -00 replies
2/32tpm: remove extra spaces between a function and its opening bracket+0 -00 replies
3/32tpm: substitute deprecated uint<x>_t types with their u<x> equivalent+0 -00 replies
3/32tpm: substitute deprecated uint<x>_t types with their u<x> equivalent+0 -00 replies
4/32tpm: align arguments with open parenthesis+0 -00 replies
4/32tpm: align arguments with open parenthesis+0 -00 replies
5/32tpm: use the BIT() macro where applicable+0 -00 replies
5/32tpm: use the BIT() macro where applicable+0 -00 replies
6/32tpm: fix spelling+0 -00 replies
6/32tpm: fix spelling+0 -00 replies
7/32tpm: add extra blank lines between declarations and code+0 -00 replies
7/32tpm: add extra blank lines between declarations and code+0 -00 replies
8/32tpm: add Revision ID field in the chip structure+0 -00 replies
8/32tpm: add Revision ID field in the chip structure+0 -00 replies
9/32tpm: prepare introduction of TPMv2.x support in Kconfig+0 -00 replies
9/32tpm: prepare introduction of TPMv2.x support in Kconfig+0 -01 reply
10/32tpm: disociate TPMv1.x specific and generic code+0 -00 replies
10/32tpm: disociate TPMv1.x specific and generic code+0 -00 replies
11/32tpm: add missing parameter in private data structure description+0 -00 replies
11/32tpm: add missing parameter in private data structure description+0 -00 replies
12/32tpm: prepare support for TPMv2.x commands+0 -00 replies
12/32tpm: prepare support for TPMv2.x commands+0 -00 replies
13/32tpm: add macros to enhance TPM commands readability+0 -00 replies
13/32tpm: add macros to enhance TPM commands readability+0 -00 replies
14/32tpm: add possible traces to analyze buffers returned by the TPM+0 -00 replies
14/32tpm: add possible traces to analyze buffers returned by the TPM+0 -00 replies
15/32tpm: report driver error code to upper layer+0 -00 replies
15/32tpm: report driver error code to upper layer+0 -00 replies
16/32tpm: add TPM2_Startup command support+0 -00 replies
16/32tpm: add TPM2_Startup command support+0 -00 replies
17/32tpm: add TPM2_SelfTest command support+0 -00 replies
17/32tpm: add TPM2_SelfTest command support+0 -00 replies
18/32tpm: add TPM2_Clear command support+0 -00 replies
18/32tpm: add TPM2_Clear command support+0 -00 replies
19/32tpm: add TPM2_PCR_Extend command support+0 -00 replies
19/32tpm: add TPM2_PCR_Extend command support+0 -00 replies
20/32tpm: add TPM2_PCR_Read command support+0 -00 replies
20/32tpm: add TPM2_PCR_Read command support+0 -00 replies
21/32tpm: add TPM2_GetCapability command support+0 -00 replies
21/32tpm: add TPM2_GetCapability command support+0 -00 replies
22/32tpm: add dictionary attack mitigation commands support+0 -00 replies
22/32tpm: add dictionary attack mitigation commands support+0 -00 replies
23/32tpm: add TPM2_HierarchyChangeAuth command support+0 -00 replies
23/32tpm: add TPM2_HierarchyChangeAuth command support+0 -00 replies
24/32tpm: add PCR authentication commands support+0 -00 replies
24/32tpm: add PCR authentication commands support+0 -00 replies
25/32tpm: add support for TPMv2.x SPI modules+0 -00 replies
25/32tpm: add support for TPMv2.x SPI modules+0 -00 replies
26/32tpm: add the possibility to reset the chip with a gpio+0 -00 replies
26/32tpm: add the possibility to reset the chip with a gpio+0 -00 replies
27/32doc: device-tree-bindings: add TIS TPMv2.0 SPI module info+0 -00 replies
27/32doc: device-tree-bindings: add TIS TPMv2.0 SPI module info+0 -00 replies
28/32test/py: add TPMv2.x test suite+0 -00 replies
28/32test/py: add TPMv2.x test suite+0 -00 replies
29/32tpm: add a Sandbox TPMv2.x driver+0 -00 replies
29/32tpm: add a Sandbox TPMv2.x driver+0 -00 replies
30/32doc: device-tree-bindings: add Sandbox TPMv2.0 module info+0 -00 replies
30/32doc: device-tree-bindings: add Sandbox TPMv2.0 module info+0 -00 replies
31/32sandbox: dts: add Sandbox TPMv2.x node+0 -00 replies
31/32sandbox: dts: add Sandbox TPMv2.x node+0 -00 replies
32/32configs: add TPMv2.x support in Sandbox+0 -00 replies
32/32configs: add TPMv2.x support in Sandbox+0 -00 replies

Reviews trailers per patch

All 64 patches have a Reviewed-by or Acked-by.

PatchTom Rini
1/32R-b
1/32R-b
2/32R-b
2/32R-b
3/32R-b
3/32R-b
4/32R-b
4/32R-b
5/32R-b
5/32R-b
6/32R-b
6/32R-b
7/32R-b
7/32R-b
8/32R-b
8/32R-b
9/32R-b
9/32R-b
10/32R-b
10/32R-b
11/32R-b
11/32R-b
12/32R-b
12/32R-b
13/32R-b
13/32R-b
14/32R-b
14/32R-b
15/32R-b
15/32R-b
16/32R-b
16/32R-b
17/32R-b
17/32R-b
18/32R-b
18/32R-b
19/32R-b
19/32R-b
20/32R-b
20/32R-b
21/32R-b
21/32R-b
22/32R-b
22/32R-b
23/32R-b
23/32R-b
24/32R-b
24/32R-b
25/32R-b
25/32R-b
26/32R-b
26/32R-b
27/32R-b
27/32R-b
28/32R-b
28/32R-b
29/32R-b
29/32R-b
30/32R-b
30/32R-b
31/32R-b
31/32R-b
32/32R-b
32/32R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [U-Boot] [PATCH v4 00/32] Introduce TPMv2.0 support
Quoted 111 lines · Miquel Raynal

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 the support for TPMv2.x chips.

First, some cleaning is done in TPM-related code. Then, the code is split in two categories: generic code (common for both specifications) and specific code (only used by one specification).

Then, basic functionalities are introduced one by one for the v2.x specification. TPMv1 vs TPMv2 commands/support distinction is done with Kconfig options. Drivers of only one specification can be selected at a time.

A new SPI driver following the TPM v2.x specification is introduced. It has been tested on a ST TPM but should be usable with others v2.0 compliant chips.

Finally a full Python test suite is added, as well as a Sandbox driver. Regular testing may be done through the test/py/ framework when using real hardware as well as the Sandbox driver. The following test has run more than 300 times without failing with my setup:

        test/py/test.py --bd <board> -k tpm2

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.

Quoted 1 line

tpm init

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

Quoted 1 line

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.

Quoted 2 lines

tpm self_test full
tpm self_test continue

* 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:

Quoted 2 lines

tpm 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.

Quoted 3 lines

tpm dam_reset [<pw>]
tpm dam_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).

Quoted 3 lines

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

Thanks,
Miquèl

Changes since v3:
=================
* Added Simon Glass's RB tags.
* Moved all the small fixes about lines, alignments, spellings, etc out of the big commit splitting the TPM code structure. Multiple commits have been made for these changes. Now the split is still done in one commit, but it is supposed to be only code moves and headers changes.
* Used map_sysmem() calls to let Sandbox run TPM commands instead of my hack (allocating memory on the go).
* Updated the documentation to use the new way of declaring parameters:
s/@param x: y/@x: y/.
* Added two parameters in the chip private structure to store the number of PCRs and the minimum number of bytes needed to address one in a TPM command. This should fit all the TIS TPM2 compliant modules.
* The above change removes some (wrongly) hardcoded values.
* Changed the error path as suggested in tpm2_get_capability().
* Minor rephrasing.
* Explained in tpm2_get_capability() the offset '19'.
* Removed useless reset of rx_buf[0] in tpm_tis_spi_xfer().
* Changed the way spi_xfer return code is checked: error out on any value != 0 instead of just negative ones.
* Removed unused functions flagged __maybe_unused as well as well as the __maybe_unused flags themselves when not needed.

Quoted 8 lines

* Simplified the validity check of the GPIO as suggested.
* Updated the compatible property for the SPI modules (as well as the bindings docuementation) to be simply "tis,tpm2-spi" which should work with most compliant chips. Data is linked to this generic compatible in the TPM driver, other values may be added if needed in the future to fit other chips that would use different values than the current ones (used by Infineon SLB 9670 and ST ST33TPHF20 modules, for instance).

Some of the new files have old-style SPDX tags. If there's no further changes requested, I'll fix these up when applying. Thanks again!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180515/294c0a54/attachment.sig>