aboutsummaryrefslogtreecommitdiff
path: root/lib/tpm-v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tpm-v2.c')
-rw-r--r--lib/tpm-v2.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c
index 697b982..9ab5b46 100644
--- a/lib/tpm-v2.c
+++ b/lib/tpm-v2.c
@@ -44,6 +44,23 @@ u32 tpm2_self_test(struct udevice *dev, enum tpm2_yes_no full_test)
return tpm_sendrecv_command(dev, command_v2, NULL, NULL);
}
+u32 tpm2_auto_start(struct udevice *dev)
+{
+ u32 rc;
+
+ rc = tpm2_self_test(dev, TPMI_YES);
+
+ if (rc == TPM2_RC_INITIALIZE) {
+ rc = tpm2_startup(dev, TPM2_SU_CLEAR);
+ if (rc)
+ return rc;
+
+ rc = tpm2_self_test(dev, TPMI_YES);
+ }
+
+ return rc;
+}
+
u32 tpm2_clear(struct udevice *dev, u32 handle, const char *pw,
const ssize_t pw_sz)
{