06 Feb, 2020

1 commit


05 Dec, 2018

2 commits


30 Nov, 2018

3 commits

  • At present many TPM calls assume there is only one TPM in the system and
    look up this TPM themselves. This is inconsistent with driver model, which
    expects all driver methods to have a device parameter. Update the code to
    correct this.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • At present these functions are not accessible outside the TPM library, but
    in some cases we need to call them. Export them in the header file and add
    a define for the SHA1 digest size.

    Also adjust tpm_open() to call tpm_close() first so that the TPM is in a
    known state before opening (e.g. by a previous phase of U-Boot).

    Signed-off-by: Simon Glass

    Simon Glass
     
  • When SHA1 is used we need 20 bytes for the digest size. Add a constant so
    that clients can make use of this, e.g. to allocate local buffers.

    Signed-off-by: Simon Glass

    Simon Glass
     

28 Jul, 2018

2 commits

  • While there is probably no reason to do so in a real life situation, it
    will allow to compile test both stacks with the same sandbox defconfig.

    As we cannot define two 'tpm' commands at the same time, the command for
    TPM v1 is still called 'tpm' and the one for TPM v2 'tpm2'. While this
    is the exact command name that must be written into eg. test files, any
    user already using the TPM v2 stack can continue to do so by just writing
    'tpm' because as long as TPM v1 support is not compiled, U-Boot prompt
    will search for the closest command named after 'tpm'.

    The command set can also be changed at runtime (not supported yet, but
    ready to be), but as one can compile only either one stack or the other,
    there is still one spot in the code where conditionals are used: to
    retrieve the v1 or v2 command set.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Simon Glass
    [trini: In sandbox_tpm2_fill_buf() use NULL not \0 to ensure NULL
    terminated string due to LLVM warning]
    Signed-off-by: Tom Rini

    Miquel Raynal
     
  • The udevice given to the open() function of course must be opened,
    not closed.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Simon Glass

    Miquel Raynal
     

26 May, 2018

3 commits

  • Choice between v1 and v2 compliant functions is done with the
    configuration.

    Create the various files that will receive TPMv2-only code on the same
    scheme as for the TPMv1 code.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Simon Glass
    Reviewed-by: Tom Rini

    Miquel Raynal
     
  • Both parameters 'duration_ms' and 'retry_time_ms' of the tpm_chip_priv
    structure are documented is the comment above the declaration but 'buf'
    was forgotten. Add the missing description.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Miquel Raynal
     
  • There are no changes in this commit but a new organization of the code
    as follow.

    * cmd/ directory:
    > move existing code from cmd/tpm.c in cmd/tpm-common.c
    > move specific code in cmd/tpm-v1.c
    > create a specific header file with generic definitions for
    commands only called cmd/tpm-user-utils.h

    * lib/ directory:
    > move existing code from lib/tpm.c in lib/tpm-common.c
    > move specific code in lib/tpm-v1.c
    > create a specific header file with generic definitions for
    the library itself called lib/tpm-utils.h

    * include/ directory:
    > move existing code from include/tpm.h in include/tpm-common.h
    > move specific code in include/tpm-v1.h

    Code designated as 'common' is compiled if TPM are used. Code designated
    as 'specific' is compiled only if the right specification has been
    selected.

    All files include tpm-common.h.
    Files in cmd/ include tpm-user-utils.h.
    Files in lib/ include tpm-utils.h.
    Depending on the specification, files may include either (not both)
    tpm-v1.h or tpm-v2.h.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Tom Rini
    [trini: Fix a few more cases of tpm.h -> tpm-v1.h, some Kconfig logic]
    Signed-off-by: Tom Rini

    Miquel Raynal