aboutsummaryrefslogtreecommitdiff
path: root/tpm/tpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'tpm/tpm.c')
-rw-r--r--tpm/tpm.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tpm/tpm.c b/tpm/tpm.c
index 02735493c5..ffd24956d7 100644
--- a/tpm/tpm.c
+++ b/tpm/tpm.c
@@ -61,6 +61,20 @@ static bool tpm_model_is_registered(enum TpmModel model)
return false;
}
+/*
+ * Write an error message in the given output buffer.
+ */
+void tpm_write_fatal_error_response(uint8_t *out, uint32_t out_len)
+{
+ if (out_len >= sizeof(struct tpm_resp_hdr)) {
+ struct tpm_resp_hdr *resp = (struct tpm_resp_hdr *)out;
+
+ resp->tag = cpu_to_be16(TPM_TAG_RSP_COMMAND);
+ resp->len = cpu_to_be32(sizeof(struct tpm_resp_hdr));
+ resp->errcode = cpu_to_be32(TPM_FAIL);
+ }
+}
+
const TPMDriverOps *tpm_get_backend_driver(const char *type)
{
int i;