@@ -78,15 +78,6 @@ bool tpm_backend_had_startup_error(TPMBackend *s)
return k->ops->had_startup_error(s);
}
-size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb)
-{
- TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-
- assert(k->ops->realloc_buffer);
-
- return k->ops->realloc_buffer(sb);
-}
-
void tpm_backend_deliver_request(TPMBackend *s)
{
g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_PROCESS_CMD,
@@ -258,17 +258,6 @@ static bool tpm_passthrough_get_startup_error(TPMBackend *tb)
return tpm_pt->had_startup_error;
}
-static size_t tpm_passthrough_realloc_buffer(TPMSizedBuffer *sb)
-{
- size_t wanted_size = 4096; /* Linux tpm.c buffer size */
-
- if (sb->size != wanted_size) {
- sb->buffer = g_realloc(sb->buffer, wanted_size);
- sb->size = wanted_size;
- }
- return sb->size;
-}
-
static void tpm_passthrough_cancel_cmd(TPMBackend *tb)
{
TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
@@ -460,7 +449,6 @@ static const TPMDriverOps tpm_passthrough_driver = {
.opts = tpm_passthrough_cmdline_opts,
.desc = "Passthrough TPM backend driver",
.create = tpm_passthrough_create,
- .realloc_buffer = tpm_passthrough_realloc_buffer,
.reset = tpm_passthrough_reset,
.had_startup_error = tpm_passthrough_get_startup_error,
.cancel_cmd = tpm_passthrough_cancel_cmd,
@@ -963,6 +963,16 @@ static int tpm_tis_do_startup_tpm(TPMState *s)
return tpm_backend_startup_tpm(s->be_driver);
}
+static void tpm_tis_realloc_buffer(TPMSizedBuffer *sb)
+{
+ size_t wanted_size = 4096; /* Linux tpm.c buffer size */
+
+ if (sb->size != wanted_size) {
+ sb->buffer = g_realloc(sb->buffer, wanted_size);
+ sb->size = wanted_size;
+ }
+}
+
/*
* Get the TPMVersion of the backend device being used
*/
@@ -1010,9 +1020,9 @@ static void tpm_tis_reset(DeviceState *dev)
tis->loc[c].state = TPM_TIS_STATE_IDLE;
tis->loc[c].w_offset = 0;
- tpm_backend_realloc_buffer(s->be_driver, &tis->loc[c].w_buffer);
+ tpm_tis_realloc_buffer(&tis->loc[c].w_buffer);
tis->loc[c].r_offset = 0;
- tpm_backend_realloc_buffer(s->be_driver, &tis->loc[c].r_buffer);
+ tpm_tis_realloc_buffer(&tis->loc[c].r_buffer);
}
tpm_tis_do_startup_tpm(s);
@@ -85,8 +85,6 @@ struct TPMDriverOps {
/* returns true if nothing will ever answer TPM requests */
bool (*had_startup_error)(TPMBackend *t);
- size_t (*realloc_buffer)(TPMSizedBuffer *sb);
-
void (*reset)(TPMBackend *t);
void (*cancel_cmd)(TPMBackend *t);
@@ -141,16 +139,6 @@ int tpm_backend_startup_tpm(TPMBackend *s);
bool tpm_backend_had_startup_error(TPMBackend *s);
/**
- * tpm_backend_realloc_buffer:
- * @s: the backend
- * @sb: the TPMSizedBuffer to re-allocated to the size suitable for the
- * backend.
- *
- * This function returns the size of the allocated buffer
- */
-size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb);
-
-/**
* tpm_backend_deliver_request:
* @s: the backend to send the request to
*