tpm: Export the open/close functions

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 <sjg@chromium.org>
This commit is contained in:
Simon Glass 2018-11-18 14:22:26 -07:00
parent 07e127d85d
commit 51f00c1704
3 changed files with 50 additions and 43 deletions

View file

@ -18,24 +18,6 @@
#define tpm_u16(x) __MSB(x), __LSB(x)
#define tpm_u32(x) tpm_u16((x) >> 16), tpm_u16((x) & 0xFFFF)
/**
* tpm_open() - Request access to locality 0 for the caller
*
* After all commands have been completed the caller is supposed to
* call tpm_close().
*
* Returns 0 on success, -ve on failure.
*/
int tpm_open(struct udevice *dev);
/**
* tpm_close() - Close the current session
*
* Releasing the locked locality. Returns 0 on success, -ve 1 on
* failure (in case lock removal did not succeed).
*/
int tpm_close(struct udevice *dev);
/**
* Pack data into a byte string. The data types are specified in
* the format string: 'b' means unsigned byte, 'w' unsigned word,