mirror of
https://github.com/stefanberger/swtpm.git
synced 2026-08-11 14:29:07 +00:00
swtpm: Have swtpm report PTM_CAP_SEND_COMMAND_HEADER flag
Have swtpm report PTM_CAP_SEND_COMMAND_HEADER flag for a TPM 2 indicating that it knows how to handle the TCG header prefix for the data channel. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
e2558a8bea
commit
51f3860dfe
@ -245,6 +245,7 @@ typedef struct ptm_getinfo ptm_getinfo;
|
||||
#define PTM_CAP_SET_DATAFD (1 << 12)
|
||||
#define PTM_CAP_SET_BUFFERSIZE (1 << 13)
|
||||
#define PTM_CAP_GET_INFO (1 << 14)
|
||||
#define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
|
||||
|
||||
enum {
|
||||
PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
|
||||
|
||||
@ -424,9 +424,10 @@ wait_chunk:
|
||||
return recvd;
|
||||
}
|
||||
|
||||
static uint64_t get_ptm_caps_supported(void)
|
||||
static uint64_t get_ptm_caps_supported(TPMLIB_TPMVersion tpmversion)
|
||||
{
|
||||
return PTM_CAP_INIT
|
||||
uint64_t caps =
|
||||
PTM_CAP_INIT
|
||||
| PTM_CAP_SHUTDOWN
|
||||
| PTM_CAP_GET_TPMESTABLISHED
|
||||
| PTM_CAP_SET_LOCALITY
|
||||
@ -443,6 +444,10 @@ static uint64_t get_ptm_caps_supported(void)
|
||||
#endif
|
||||
| PTM_CAP_SET_BUFFERSIZE
|
||||
| PTM_CAP_GET_INFO;
|
||||
if (tpmversion == TPMLIB_TPM_VERSION_2)
|
||||
caps |= PTM_CAP_SEND_COMMAND_HEADER;
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -532,7 +537,7 @@ int ctrlchannel_process_fd(int fd,
|
||||
|
||||
switch (be32toh(input.cmd)) {
|
||||
case CMD_GET_CAPABILITY:
|
||||
*ptm_caps = htobe64(get_ptm_caps_supported());
|
||||
*ptm_caps = htobe64(get_ptm_caps_supported(mlp->tpmversion));
|
||||
|
||||
out_len = sizeof(*ptm_caps);
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user