aboutsummaryrefslogtreecommitdiff
path: root/backends/tpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/tpm.c')
-rw-r--r--backends/tpm.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/backends/tpm.c b/backends/tpm.c
index 37c84b7c66..ca3a78eea8 100644
--- a/backends/tpm.c
+++ b/backends/tpm.c
@@ -41,7 +41,7 @@ enum TpmType tpm_backend_get_type(TPMBackend *s)
{
TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
- return k->ops->type;
+ return k->type;
}
int tpm_backend_init(TPMBackend *s, TPMState *state,
@@ -53,7 +53,7 @@ int tpm_backend_init(TPMBackend *s, TPMState *state,
s->recv_data_callback = datacb;
s->had_startup_error = false;
- return k->ops->init ? k->ops->init(s) : 0;
+ return k->init ? k->init(s) : 0;
}
int tpm_backend_startup_tpm(TPMBackend *s)
@@ -68,7 +68,7 @@ int tpm_backend_startup_tpm(TPMBackend *s)
NULL);
g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_INIT, NULL);
- res = k->ops->startup_tpm ? k->ops->startup_tpm(s) : 0;
+ res = k->startup_tpm ? k->startup_tpm(s) : 0;
s->had_startup_error = (res != 0);
@@ -90,8 +90,8 @@ void tpm_backend_reset(TPMBackend *s)
{
TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
- if (k->ops->reset) {
- k->ops->reset(s);
+ if (k->reset) {
+ k->reset(s);
}
tpm_backend_thread_end(s);
@@ -103,34 +103,34 @@ void tpm_backend_cancel_cmd(TPMBackend *s)
{
TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
- assert(k->ops->cancel_cmd);
+ assert(k->cancel_cmd);
- k->ops->cancel_cmd(s);
+ k->cancel_cmd(s);
}
bool tpm_backend_get_tpm_established_flag(TPMBackend *s)
{
TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
- return k->ops->get_tpm_established_flag ?
- k->ops->get_tpm_established_flag(s) : false;
+ return k->get_tpm_established_flag ?
+ k->get_tpm_established_flag(s) : false;
}
int tpm_backend_reset_tpm_established_flag(TPMBackend *s, uint8_t locty)
{
TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
- return k->ops->reset_tpm_established_flag ?
- k->ops->reset_tpm_established_flag(s, locty) : 0;
+ return k->reset_tpm_established_flag ?
+ k->reset_tpm_established_flag(s, locty) : 0;
}
TPMVersion tpm_backend_get_tpm_version(TPMBackend *s)
{
TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
- assert(k->ops->get_tpm_version);
+ assert(k->get_tpm_version);
- return k->ops->get_tpm_version(s);
+ return k->get_tpm_version(s);
}
TPMInfo *tpm_backend_query_tpm(TPMBackend *s)
@@ -140,8 +140,9 @@ TPMInfo *tpm_backend_query_tpm(TPMBackend *s)
info->id = g_strdup(s->id);
info->model = s->fe_model;
- info->options = k->ops->get_tpm_options ?
- k->ops->get_tpm_options(s) : NULL;
+ if (k->get_tpm_options) {
+ info->options = k->get_tpm_options(s);
+ }
return info;
}