2015-05-26 22:51:06 +02:00
|
|
|
/*
|
|
|
|
* TPM utility functions
|
|
|
|
*
|
|
|
|
* Copyright (c) 2010 - 2015 IBM Corporation
|
|
|
|
* Authors:
|
|
|
|
* Stefan Berger <stefanb@us.ibm.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>
|
|
|
|
*/
|
|
|
|
|
2016-01-26 19:17:30 +01:00
|
|
|
#include "qemu/osdep.h"
|
2017-11-04 03:49:23 +01:00
|
|
|
#include "qemu/error-report.h"
|
2017-12-18 19:36:31 +01:00
|
|
|
#include "qapi/error.h"
|
|
|
|
#include "qapi/visitor.h"
|
2015-05-26 22:51:06 +02:00
|
|
|
#include "tpm_int.h"
|
2017-10-10 00:55:58 +02:00
|
|
|
#include "exec/memory.h"
|
2019-08-12 07:23:51 +02:00
|
|
|
#include "hw/qdev-properties.h"
|
2017-12-18 19:36:31 +01:00
|
|
|
#include "sysemu/tpm_backend.h"
|
2020-06-12 10:54:43 +02:00
|
|
|
#include "sysemu/tpm_util.h"
|
2018-03-03 02:42:48 +01:00
|
|
|
#include "trace.h"
|
2017-11-04 03:49:23 +01:00
|
|
|
|
2017-12-18 19:36:31 +01:00
|
|
|
/* tpm backend property */
|
|
|
|
|
|
|
|
static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
|
|
|
Error **errp)
|
|
|
|
{
|
|
|
|
DeviceState *dev = DEVICE(obj);
|
|
|
|
TPMBackend **be = qdev_get_prop_ptr(dev, opaque);
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
p = g_strdup(*be ? (*be)->id : "");
|
|
|
|
visit_type_str(v, name, &p, errp);
|
|
|
|
g_free(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
|
|
|
Error **errp)
|
|
|
|
{
|
|
|
|
DeviceState *dev = DEVICE(obj);
|
|
|
|
Property *prop = opaque;
|
|
|
|
TPMBackend *s, **be = qdev_get_prop_ptr(dev, prop);
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
if (dev->realized) {
|
|
|
|
qdev_prop_set_after_realize(dev, name, errp);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
error: Eliminate error_propagate() with Coccinelle, part 1
When all we do with an Error we receive into a local variable is
propagating to somewhere else, we can just as well receive it there
right away. Convert
if (!foo(..., &err)) {
...
error_propagate(errp, err);
...
return ...
}
to
if (!foo(..., errp)) {
...
...
return ...
}
where nothing else needs @err. Coccinelle script:
@rule1 forall@
identifier fun, err, errp, lbl;
expression list args, args2;
binary operator op;
constant c1, c2;
symbol false;
@@
if (
(
- fun(args, &err, args2)
+ fun(args, errp, args2)
|
- !fun(args, &err, args2)
+ !fun(args, errp, args2)
|
- fun(args, &err, args2) op c1
+ fun(args, errp, args2) op c1
)
)
{
... when != err
when != lbl:
when strict
- error_propagate(errp, err);
... when != err
(
return;
|
return c2;
|
return false;
)
}
@rule2 forall@
identifier fun, err, errp, lbl;
expression list args, args2;
expression var;
binary operator op;
constant c1, c2;
symbol false;
@@
- var = fun(args, &err, args2);
+ var = fun(args, errp, args2);
... when != err
if (
(
var
|
!var
|
var op c1
)
)
{
... when != err
when != lbl:
when strict
- error_propagate(errp, err);
... when != err
(
return;
|
return c2;
|
return false;
|
return var;
)
}
@depends on rule1 || rule2@
identifier err;
@@
- Error *err = NULL;
... when != err
Not exactly elegant, I'm afraid.
The "when != lbl:" is necessary to avoid transforming
if (fun(args, &err)) {
goto out
}
...
out:
error_propagate(errp, err);
even though other paths to label out still need the error_propagate().
For an actual example, see sclp_realize().
Without the "when strict", Coccinelle transforms vfio_msix_setup(),
incorrectly. I don't know what exactly "when strict" does, only that
it helps here.
The match of return is narrower than what I want, but I can't figure
out how to express "return where the operand doesn't use @err". For
an example where it's too narrow, see vfio_intx_enable().
Silently fails to convert hw/arm/armsse.c, because Coccinelle gets
confused by ARMSSE being used both as typedef and function-like macro
there. Converted manually.
Line breaks tidied up manually. One nested declaration of @local_err
deleted manually. Preexisting unwanted blank line dropped in
hw/riscv/sifive_e.c.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200707160613.848843-35-armbru@redhat.com>
2020-07-07 18:06:02 +02:00
|
|
|
if (!visit_type_str(v, name, &str, errp)) {
|
2017-12-18 19:36:31 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
s = qemu_find_tpm_be(str);
|
|
|
|
if (s == NULL) {
|
|
|
|
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
|
|
|
object_get_typename(obj), prop->name, str);
|
|
|
|
} else if (tpm_backend_init(s, TPM_IF(obj), errp) == 0) {
|
|
|
|
*be = s; /* weak reference, avoid cyclic ref */
|
|
|
|
}
|
|
|
|
g_free(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void release_tpm(Object *obj, const char *name, void *opaque)
|
|
|
|
{
|
|
|
|
DeviceState *dev = DEVICE(obj);
|
|
|
|
Property *prop = opaque;
|
|
|
|
TPMBackend **be = qdev_get_prop_ptr(dev, prop);
|
|
|
|
|
|
|
|
if (*be) {
|
|
|
|
tpm_backend_reset(*be);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const PropertyInfo qdev_prop_tpm = {
|
|
|
|
.name = "str",
|
|
|
|
.description = "ID of a tpm to use as a backend",
|
|
|
|
.get = get_tpm,
|
|
|
|
.set = set_tpm,
|
|
|
|
.release = release_tpm,
|
|
|
|
};
|
|
|
|
|
2017-09-29 13:10:19 +02:00
|
|
|
/*
|
|
|
|
* Write an error message in the given output buffer.
|
|
|
|
*/
|
|
|
|
void tpm_util_write_fatal_error_response(uint8_t *out, uint32_t out_len)
|
|
|
|
{
|
|
|
|
if (out_len >= sizeof(struct tpm_resp_hdr)) {
|
2018-02-02 00:05:10 +01:00
|
|
|
tpm_cmd_set_tag(out, TPM_TAG_RSP_COMMAND);
|
|
|
|
tpm_cmd_set_size(out, sizeof(struct tpm_resp_hdr));
|
|
|
|
tpm_cmd_set_error(out, TPM_FAIL);
|
2017-09-29 13:10:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool tpm_util_is_selftest(const uint8_t *in, uint32_t in_len)
|
|
|
|
{
|
2018-01-29 19:33:03 +01:00
|
|
|
if (in_len >= sizeof(struct tpm_req_hdr)) {
|
|
|
|
return tpm_cmd_get_ordinal(in) == TPM_ORD_ContinueSelfTest;
|
2017-09-29 13:10:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-05-26 22:51:06 +02:00
|
|
|
/*
|
2017-11-04 04:00:36 +01:00
|
|
|
* Send request to a TPM device. We expect a response within one second.
|
2015-05-26 22:51:06 +02:00
|
|
|
*/
|
2017-11-04 04:00:36 +01:00
|
|
|
static int tpm_util_request(int fd,
|
2018-01-29 19:33:03 +01:00
|
|
|
const void *request,
|
2017-11-04 04:00:36 +01:00
|
|
|
size_t requestlen,
|
2018-01-29 19:33:03 +01:00
|
|
|
void *response,
|
2017-11-04 04:00:36 +01:00
|
|
|
size_t responselen)
|
2015-05-26 22:51:06 +02:00
|
|
|
{
|
|
|
|
fd_set readfds;
|
|
|
|
int n;
|
|
|
|
struct timeval tv = {
|
|
|
|
.tv_sec = 1,
|
|
|
|
.tv_usec = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
n = write(fd, request, requestlen);
|
|
|
|
if (n < 0) {
|
2017-10-11 14:52:43 +02:00
|
|
|
return -errno;
|
2015-05-26 22:51:06 +02:00
|
|
|
}
|
|
|
|
if (n != requestlen) {
|
2017-10-11 14:52:43 +02:00
|
|
|
return -EFAULT;
|
2015-05-26 22:51:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
FD_ZERO(&readfds);
|
|
|
|
FD_SET(fd, &readfds);
|
|
|
|
|
|
|
|
/* wait for a second */
|
|
|
|
n = select(fd + 1, &readfds, NULL, NULL, &tv);
|
|
|
|
if (n != 1) {
|
2017-10-11 14:52:43 +02:00
|
|
|
return -errno;
|
2015-05-26 22:51:06 +02:00
|
|
|
}
|
|
|
|
|
2017-11-04 04:00:36 +01:00
|
|
|
n = read(fd, response, responselen);
|
2015-05-26 22:51:06 +02:00
|
|
|
if (n < sizeof(struct tpm_resp_hdr)) {
|
2017-10-11 14:52:43 +02:00
|
|
|
return -EFAULT;
|
2015-05-26 22:51:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* check the header */
|
2018-01-29 19:33:03 +01:00
|
|
|
if (tpm_cmd_get_size(response) != n) {
|
2017-10-11 14:52:43 +02:00
|
|
|
return -EMSGSIZE;
|
2015-05-26 22:51:06 +02:00
|
|
|
}
|
|
|
|
|
2017-11-04 04:00:36 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A basic test of a TPM device. We expect a well formatted response header
|
|
|
|
* (error response is fine).
|
|
|
|
*/
|
|
|
|
static int tpm_util_test(int fd,
|
2018-01-29 19:33:03 +01:00
|
|
|
const void *request,
|
2017-11-04 04:00:36 +01:00
|
|
|
size_t requestlen,
|
|
|
|
uint16_t *return_tag)
|
|
|
|
{
|
2018-01-29 19:33:03 +01:00
|
|
|
char buf[1024];
|
2017-11-04 04:00:36 +01:00
|
|
|
ssize_t ret;
|
|
|
|
|
|
|
|
ret = tpm_util_request(fd, request, requestlen,
|
|
|
|
buf, sizeof(buf));
|
|
|
|
if (ret < 0) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-01-29 19:33:03 +01:00
|
|
|
*return_tag = tpm_cmd_get_tag(buf);
|
2015-05-26 22:51:06 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Probe for the TPM device in the back
|
|
|
|
* Returns 0 on success with the version of the probed TPM set, 1 on failure.
|
|
|
|
*/
|
|
|
|
int tpm_util_test_tpmdev(int tpm_fd, TPMVersion *tpm_version)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Sending a TPM1.2 command to a TPM2 should return a TPM1.2
|
|
|
|
* header (tag = 0xc4) and error code (TPM_BADTAG = 0x1e)
|
|
|
|
*
|
|
|
|
* Sending a TPM2 command to a TPM 2 will give a TPM 2 tag in the
|
|
|
|
* header.
|
|
|
|
* Sending a TPM2 command to a TPM 1.2 will give a TPM 1.2 tag
|
|
|
|
* in the header and an error code.
|
|
|
|
*/
|
|
|
|
const struct tpm_req_hdr test_req = {
|
|
|
|
.tag = cpu_to_be16(TPM_TAG_RQU_COMMAND),
|
|
|
|
.len = cpu_to_be32(sizeof(test_req)),
|
|
|
|
.ordinal = cpu_to_be32(TPM_ORD_GetTicks),
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct tpm_req_hdr test_req_tpm2 = {
|
|
|
|
.tag = cpu_to_be16(TPM2_ST_NO_SESSIONS),
|
|
|
|
.len = cpu_to_be32(sizeof(test_req_tpm2)),
|
|
|
|
.ordinal = cpu_to_be32(TPM2_CC_ReadClock),
|
|
|
|
};
|
|
|
|
uint16_t return_tag;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Send TPM 2 command */
|
2018-01-29 19:33:03 +01:00
|
|
|
ret = tpm_util_test(tpm_fd, &test_req_tpm2,
|
2015-05-26 22:51:06 +02:00
|
|
|
sizeof(test_req_tpm2), &return_tag);
|
|
|
|
/* TPM 2 would respond with a tag of TPM2_ST_NO_SESSIONS */
|
|
|
|
if (!ret && return_tag == TPM2_ST_NO_SESSIONS) {
|
|
|
|
*tpm_version = TPM_VERSION_2_0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Send TPM 1.2 command */
|
2018-01-29 19:33:03 +01:00
|
|
|
ret = tpm_util_test(tpm_fd, &test_req,
|
2015-05-26 22:51:06 +02:00
|
|
|
sizeof(test_req), &return_tag);
|
|
|
|
if (!ret && return_tag == TPM_TAG_RSP_COMMAND) {
|
|
|
|
*tpm_version = TPM_VERSION_1_2;
|
|
|
|
/* this is a TPM 1.2 */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
*tpm_version = TPM_VERSION_UNSPEC;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2017-11-04 03:49:23 +01:00
|
|
|
|
|
|
|
int tpm_util_get_buffer_size(int tpm_fd, TPMVersion tpm_version,
|
|
|
|
size_t *buffersize)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
switch (tpm_version) {
|
|
|
|
case TPM_VERSION_1_2: {
|
|
|
|
const struct tpm_req_get_buffer_size {
|
|
|
|
struct tpm_req_hdr hdr;
|
|
|
|
uint32_t capability;
|
|
|
|
uint32_t len;
|
|
|
|
uint32_t subcap;
|
|
|
|
} QEMU_PACKED tpm_get_buffer_size = {
|
|
|
|
.hdr = {
|
|
|
|
.tag = cpu_to_be16(TPM_TAG_RQU_COMMAND),
|
|
|
|
.len = cpu_to_be32(sizeof(tpm_get_buffer_size)),
|
|
|
|
.ordinal = cpu_to_be32(TPM_ORD_GetCapability),
|
|
|
|
},
|
|
|
|
.capability = cpu_to_be32(TPM_CAP_PROPERTY),
|
|
|
|
.len = cpu_to_be32(sizeof(uint32_t)),
|
|
|
|
.subcap = cpu_to_be32(TPM_CAP_PROP_INPUT_BUFFER),
|
|
|
|
};
|
|
|
|
struct tpm_resp_get_buffer_size {
|
|
|
|
struct tpm_resp_hdr hdr;
|
|
|
|
uint32_t len;
|
|
|
|
uint32_t buffersize;
|
2018-01-29 19:33:03 +01:00
|
|
|
} QEMU_PACKED tpm_resp;
|
2017-11-04 03:49:23 +01:00
|
|
|
|
2018-01-29 19:33:03 +01:00
|
|
|
ret = tpm_util_request(tpm_fd, &tpm_get_buffer_size,
|
|
|
|
sizeof(tpm_get_buffer_size),
|
|
|
|
&tpm_resp, sizeof(tpm_resp));
|
2017-11-04 03:49:23 +01:00
|
|
|
if (ret < 0) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-01-29 19:33:03 +01:00
|
|
|
if (be32_to_cpu(tpm_resp.hdr.len) != sizeof(tpm_resp) ||
|
|
|
|
be32_to_cpu(tpm_resp.len) != sizeof(uint32_t)) {
|
2018-03-03 02:42:48 +01:00
|
|
|
trace_tpm_util_get_buffer_size_hdr_len(
|
|
|
|
be32_to_cpu(tpm_resp.hdr.len),
|
|
|
|
sizeof(tpm_resp));
|
|
|
|
trace_tpm_util_get_buffer_size_len(be32_to_cpu(tpm_resp.len),
|
|
|
|
sizeof(uint32_t));
|
2017-11-04 03:49:23 +01:00
|
|
|
error_report("tpm_util: Got unexpected response to "
|
|
|
|
"TPM_GetCapability; errcode: 0x%x",
|
2018-01-29 19:33:03 +01:00
|
|
|
be32_to_cpu(tpm_resp.hdr.errcode));
|
2017-11-04 03:49:23 +01:00
|
|
|
return -EFAULT;
|
|
|
|
}
|
2018-01-29 19:33:03 +01:00
|
|
|
*buffersize = be32_to_cpu(tpm_resp.buffersize);
|
2017-11-04 03:49:23 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TPM_VERSION_2_0: {
|
|
|
|
const struct tpm2_req_get_buffer_size {
|
|
|
|
struct tpm_req_hdr hdr;
|
|
|
|
uint32_t capability;
|
|
|
|
uint32_t property;
|
|
|
|
uint32_t count;
|
|
|
|
} QEMU_PACKED tpm2_get_buffer_size = {
|
|
|
|
.hdr = {
|
|
|
|
.tag = cpu_to_be16(TPM2_ST_NO_SESSIONS),
|
|
|
|
.len = cpu_to_be32(sizeof(tpm2_get_buffer_size)),
|
|
|
|
.ordinal = cpu_to_be32(TPM2_CC_GetCapability),
|
|
|
|
},
|
|
|
|
.capability = cpu_to_be32(TPM2_CAP_TPM_PROPERTIES),
|
|
|
|
.property = cpu_to_be32(TPM2_PT_MAX_COMMAND_SIZE),
|
|
|
|
.count = cpu_to_be32(2), /* also get TPM2_PT_MAX_RESPONSE_SIZE */
|
|
|
|
};
|
|
|
|
struct tpm2_resp_get_buffer_size {
|
|
|
|
struct tpm_resp_hdr hdr;
|
|
|
|
uint8_t more;
|
|
|
|
uint32_t capability;
|
|
|
|
uint32_t count;
|
|
|
|
uint32_t property1;
|
|
|
|
uint32_t value1;
|
|
|
|
uint32_t property2;
|
|
|
|
uint32_t value2;
|
2018-01-29 19:33:03 +01:00
|
|
|
} QEMU_PACKED tpm2_resp;
|
2017-11-04 03:49:23 +01:00
|
|
|
|
2018-01-29 19:33:03 +01:00
|
|
|
ret = tpm_util_request(tpm_fd, &tpm2_get_buffer_size,
|
|
|
|
sizeof(tpm2_get_buffer_size),
|
|
|
|
&tpm2_resp, sizeof(tpm2_resp));
|
2017-11-04 03:49:23 +01:00
|
|
|
if (ret < 0) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-01-29 19:33:03 +01:00
|
|
|
if (be32_to_cpu(tpm2_resp.hdr.len) != sizeof(tpm2_resp) ||
|
|
|
|
be32_to_cpu(tpm2_resp.count) != 2) {
|
2018-03-03 02:42:48 +01:00
|
|
|
trace_tpm_util_get_buffer_size_hdr_len2(
|
|
|
|
be32_to_cpu(tpm2_resp.hdr.len),
|
|
|
|
sizeof(tpm2_resp));
|
|
|
|
trace_tpm_util_get_buffer_size_len2(
|
|
|
|
be32_to_cpu(tpm2_resp.count), 2);
|
2017-11-04 03:49:23 +01:00
|
|
|
error_report("tpm_util: Got unexpected response to "
|
|
|
|
"TPM2_GetCapability; errcode: 0x%x",
|
2018-01-29 19:33:03 +01:00
|
|
|
be32_to_cpu(tpm2_resp.hdr.errcode));
|
2017-11-04 03:49:23 +01:00
|
|
|
return -EFAULT;
|
|
|
|
}
|
2018-01-29 19:33:03 +01:00
|
|
|
*buffersize = MAX(be32_to_cpu(tpm2_resp.value1),
|
|
|
|
be32_to_cpu(tpm2_resp.value2));
|
2017-11-04 03:49:23 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TPM_VERSION_UNSPEC:
|
|
|
|
return -EFAULT;
|
|
|
|
}
|
|
|
|
|
2018-03-03 02:42:48 +01:00
|
|
|
trace_tpm_util_get_buffer_size(*buffersize);
|
2017-11-04 03:49:23 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2017-10-11 16:36:53 +02:00
|
|
|
|
|
|
|
void tpm_sized_buffer_reset(TPMSizedBuffer *tsb)
|
|
|
|
{
|
|
|
|
g_free(tsb->buffer);
|
|
|
|
tsb->buffer = NULL;
|
|
|
|
tsb->size = 0;
|
|
|
|
}
|
2020-01-21 16:29:30 +01:00
|
|
|
|
|
|
|
void tpm_util_show_buffer(const unsigned char *buffer,
|
|
|
|
size_t buffer_size, const char *string)
|
|
|
|
{
|
|
|
|
size_t len, i;
|
|
|
|
char *line_buffer, *p;
|
|
|
|
|
2020-06-12 10:54:40 +02:00
|
|
|
if (!trace_event_get_state_backends(TRACE_TPM_UTIL_SHOW_BUFFER)) {
|
|
|
|
return;
|
|
|
|
}
|
2020-01-21 16:29:30 +01:00
|
|
|
len = MIN(tpm_cmd_get_size(buffer), buffer_size);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* allocate enough room for 3 chars per buffer entry plus a
|
|
|
|
* newline after every 16 chars and a final null terminator.
|
|
|
|
*/
|
|
|
|
line_buffer = g_malloc(len * 3 + (len / 16) + 1);
|
|
|
|
|
|
|
|
for (i = 0, p = line_buffer; i < len; i++) {
|
|
|
|
if (i && !(i % 16)) {
|
|
|
|
p += sprintf(p, "\n");
|
|
|
|
}
|
|
|
|
p += sprintf(p, "%.2X ", buffer[i]);
|
|
|
|
}
|
|
|
|
trace_tpm_util_show_buffer(string, len, line_buffer);
|
|
|
|
|
|
|
|
g_free(line_buffer);
|
|
|
|
}
|