All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 00/32] Introduce TPMv2.0 support
Date: Tue, 15 May 2018 12:01:10 -0400	[thread overview]
Message-ID: <20180515160110.GS3424@bill-the-cat.ec.rr.com> (raw)
In-Reply-To: <20180515095728.16572-1-miquel.raynal@bootlin.com>

On Tue, May 15, 2018 at 11:56:56AM +0200, Miquel Raynal wrote:

> 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.
> 
> > tpm init
> 
> * 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 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:
> 
> > 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.
> 
> > 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).
> 
> > 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.
> * 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!

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

      parent reply	other threads:[~2018-05-15 16:01 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15  9:56 [U-Boot] [PATCH v4 00/32] Introduce TPMv2.0 support Miquel Raynal
2018-05-15  9:56 ` [U-Boot] [PATCH v4 01/32] tpm: remove redundant blank line Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-15 16:02   ` Simon Glass
2018-05-26 15:53   ` [U-Boot] [U-Boot,v4,01/32] " Tom Rini
2018-05-15  9:56 ` [U-Boot] [PATCH v4 02/32] tpm: remove extra spaces between a function and its opening bracket Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-15 16:02   ` Simon Glass
2018-05-26 15:53   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:56 ` [U-Boot] [PATCH v4 03/32] tpm: substitute deprecated uint<x>_t types with their u<x> equivalent Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-15 16:04   ` Simon Glass
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 04/32] tpm: align arguments with open parenthesis Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-15 16:02   ` Simon Glass
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 05/32] tpm: use the BIT() macro where applicable Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-15 16:03   ` Simon Glass
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 06/32] tpm: fix spelling Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-15 16:03   ` Simon Glass
2018-05-26 15:54   ` [U-Boot] [U-Boot,v4,06/32] " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 07/32] tpm: add extra blank lines between declarations and code Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-15 16:04   ` Simon Glass
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 08/32] tpm: add Revision ID field in the chip structure Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 09/32] tpm: prepare introduction of TPMv2.x support in Kconfig Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-27 22:22     ` Miquel Raynal
2018-05-15  9:57 ` [U-Boot] [PATCH v4 10/32] tpm: disociate TPMv1.x specific and generic code Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 11/32] tpm: add missing parameter in private data structure description Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-15 16:04   ` Simon Glass
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 12/32] tpm: prepare support for TPMv2.x commands Miquel Raynal
2018-05-15 15:58   ` Tom Rini
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 13/32] tpm: add macros to enhance TPM commands readability Miquel Raynal
2018-05-15 15:59   ` Tom Rini
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 14/32] tpm: add possible traces to analyze buffers returned by the TPM Miquel Raynal
2018-05-15 15:59   ` Tom Rini
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 15/32] tpm: report driver error code to upper layer Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:54   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 16/32] tpm: add TPM2_Startup command support Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 17/32] tpm: add TPM2_SelfTest " Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 18/32] tpm: add TPM2_Clear " Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot,v4,18/32] " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 19/32] tpm: add TPM2_PCR_Extend " Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 20/32] tpm: add TPM2_PCR_Read " Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 21/32] tpm: add TPM2_GetCapability " Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 22/32] tpm: add dictionary attack mitigation commands support Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 23/32] tpm: add TPM2_HierarchyChangeAuth command support Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 24/32] tpm: add PCR authentication commands support Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 25/32] tpm: add support for TPMv2.x SPI modules Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-15 16:04   ` Simon Glass
2018-05-15 16:20     ` Miquel Raynal
2018-05-15 16:26       ` Simon Glass
2018-05-26 15:55   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 26/32] tpm: add the possibility to reset the chip with a gpio Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-15 16:05   ` Simon Glass
2018-05-15 16:32     ` Miquel Raynal
2018-05-15 17:01       ` Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 27/32] doc: device-tree-bindings: add TIS TPMv2.0 SPI module info Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 28/32] test/py: add TPMv2.x test suite Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot,v4,28/32] " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 29/32] tpm: add a Sandbox TPMv2.x driver Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:55   ` [U-Boot] [U-Boot,v4,29/32] " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 30/32] doc: device-tree-bindings: add Sandbox TPMv2.0 module info Miquel Raynal
2018-05-15 16:00   ` Tom Rini
2018-05-26 15:56   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 31/32] sandbox: dts: add Sandbox TPMv2.x node Miquel Raynal
2018-05-15 16:01   ` Tom Rini
2018-05-26 15:56   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15  9:57 ` [U-Boot] [PATCH v4 32/32] configs: add TPMv2.x support in Sandbox Miquel Raynal
2018-05-15 16:01   ` Tom Rini
2018-05-26 15:56   ` [U-Boot] [U-Boot, v4, " Tom Rini
2018-05-15 16:01 ` Tom Rini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180515160110.GS3424@bill-the-cat.ec.rr.com \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.