Introduce TPMv2.0 support
Get series with b4
b4 am [email protected]Versions newest first
- v4 Latest32 patches 0 repliesNew
Patches in v4 No applies recorded yet
Reviews trailers per patch
All 64 patches have a Reviewed-by or Acked-by.
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
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
Kconfigoptions. 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 tpm2Available 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 AUTHTwo commands have been written but could not be tested (unsupported by the TPM chosen):
* PCR CHANGE AUTH POLICY
* PCR CHANGE AUTH VALUEWith 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_fullalways waits for the operation to finish, whilecontinue_self_testreturns a busy state if called to early.Quoted 2 lines
tpm
self_testfull
tpmself_testcontinue* Manage passwords (
force_clearalso 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>]
tpmchange_authTPM2_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>]
tpmdam_parameters0xffff1 0 [<pw>]
tpmget_capability0x00060x020e0x40000004* 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_setauthpolicy0 12345678901234567890123456789012 [<pw>] tpmpcr_read00x4000000
tpmpcr_extend00x4000000Thanks,
MiquèlChanges 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.
* Usedmap_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 intpm2_get_capability().
* Minor rephrasing.
* Explained intpm2_get_capability()the offset '19'.
* Removed useless reset of rx_buf[0] intpm_tis_spi_xfer().
* Changed the wayspi_xferreturn code is checked: error out on any value != 0 instead of just negative ones.
* Removed unused functions flagged__maybe_unusedas well as well as the__maybe_unusedflags 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>