summaryrefslogtreecommitdiffstats
path: root/include/tpm-common.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-18 14:22:26 -0700
committerSimon Glass <sjg@chromium.org>2018-11-29 09:30:06 -0700
commit51f00c1704e505f51a02a3687e4384231ce8ae20 (patch)
tree019ad60bed1d06aef4b527daa3b206e1491a9381 /include/tpm-common.h
parent07e127d85d9f22ac93f1e9da41a985013c4002ed (diff)
downloadu-boot-51f00c1704e505f51a02a3687e4384231ce8ae20.tar.gz
u-boot-51f00c1704e505f51a02a3687e4384231ce8ae20.tar.xz
u-boot-51f00c1704e505f51a02a3687e4384231ce8ae20.zip
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>
Diffstat (limited to 'include/tpm-common.h')
-rw-r--r--include/tpm-common.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/tpm-common.h b/include/tpm-common.h
index 449ad4c96e..f8c5569003 100644
--- a/include/tpm-common.h
+++ b/include/tpm-common.h
@@ -182,6 +182,24 @@ int do_##cmd(cmd_tbl_t *cmdtp, int flag, \
}
/**
+ * 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);
+
+/**
* tpm_get_desc() - Get a text description of the TPM
*
* @dev: Device to check