Commit Graph

36 Commits

Author SHA1 Message Date
Stefan Berger
51f3860dfe 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>
2019-07-09 10:38:07 -04:00
Stefan Berger
dce95d0d96 header: Add support for DragonFly BSD
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-10 16:13:09 +00:00
Stefan Berger
9c9ed515f4 build-sys: Include -T$(top_srcdir)/include for out-of-tree builds
For sys_dependencies.h to be found during out-of-tree builds we
need to include -I$(top_srcdir)/include.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-01 11:45:09 -04:00
Stefan Berger
2559aa9451 Move conditional includes into sys_dependencies.h
Move the OS specific conditional includes into sys_dependencies.h
while adding OS X support.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 11:48:10 -04:00
Stefan Berger
fbc596abbb swtpm: Provide support for TPM2 using --tpm2
Implement support for TPM2. Some of the capabilities are not supported yet in
this patch.

Extend the man pages with description for --tpm2.

Missing: configure should probe for needed API calls in libtpms

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:46 -04:00
Stefan Berger
00ae0d2c40 swtpm_ioctl: add padding bytes for 32 bit architectures
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-04 15:40:33 -04:00
Stefan Berger
2b8a668dbb swtpm: Implement CMD_GETINFO to retrieve TPM specification info
We quetry the swtpm for TPM specification info that goes into the
certificate for the EK.

Update the test cases that now see more capabilties being returned
by the swtpm.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-23 10:00:26 -04:00
Stefan Berger
86b27a739e swtpm: add hex numbers to CMD_* enums
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-03-05 13:25:32 -05:00
Stefan Berger
10241197c2 swtpm: reformat tpm_ioctl.h to also fit QEMU
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-01-21 19:27:33 -05:00
Stefan Berger
688c8e2400 swtpm: Implemented support for PTM_SET_BUFFERSIZE command
Implement a command for setting and querying the buffer size the
TPM implementation (libtpms) is using. The setting of the
buffersize allows to reduce the size of the buffer to a size
that the interface can support so that these two sizes match
and the TPM will not produce larger responses than what the
interface can support.

Extend swtpm_ioctl with an option to set the buffersize.

Adapt the existing tests to reflect the newly supported command.
Implement a new test for getting/setting of the buffer size.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-11-05 14:53:00 -05:00
Amarnath Valluri
1fb8bb790f Support added to receive data socket over control socket
As objected by QEMU upstream developers to use two different sockets for
starting/using of swtpm, This commit adds support for passing unix domain
socket over control channel.

The summary of the changes include:
 - Defined new control command CMD_SET_DATAFD, using this clients can send data
   socket.
 - set mlp.fd and mlp.flags outside of the mainloop
 - updated the testcases

Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
2017-09-29 13:11:01 -04:00
Stefan Berger
aeee2dc88b swtpm: Fix typo in command name
Fix a typo in two command names so that they are similar to
the command name spelling used for the ioctl's.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-20 16:58:44 -04:00
Stefan Berger
6a2dd35b41 swtpm: Add support for sending state blobs to the TPM
Implement the CMD_SET_STATE_BLOB command.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-25 23:47:44 -04:00
Stefan Berger
8f387d55e6 swtpm: Add support for getting state blobs from the TPM
Add support for CMD_GET_STATE_BLOB to get the current state of
the TPM.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-25 23:39:24 -04:00
Stefan Berger
03e0099137 swtpm: Implement two more control channel commands.
Implement two more control channel commands:
- CMD_STORE_VOLATILE
- CMD_HASH_DATA

Implement test cases.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-24 09:34:59 -04:00
Stefan Berger
f56a0cd2a5 swtpm: Further implement the control channel for socket and chardev
Further implement the control channel for the socket and chardev
interface swtpms.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-21 15:25:18 -04:00
Stefan Berger
804e74728e swtpm: add CMD_SHUTDOWN to control channel
Extend the control channel with CMD_SHUTDOWN to shut down the TPM.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-20 20:55:15 -05:00
Stefan Berger
5f1ef9565d swtpm: Replace the CUSE TPM with the new implementation
Replace the CUSE TPM with the new BSD implementation.
Update the license references and the license itself.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-07 15:01:57 -05:00
Stefan Berger
a1fa5d77e2 swtpm: add version info to all programs
Move src/swtpm/swtpm.h.in to include/swtpm.h.in to make it commonly
available. Adapt all other programs to use it and display version information
in the help screen.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-03 19:31:10 -05:00
Stefan Berger
6852f6c89b swtpm: introduce control channel for chardev TPM
Implement a control channel for the 'chardev' swtpm that implements
a minimal set of control messages for now.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-27 22:13:37 -05:00
Stefan Berger
373a9be985 Some more changes to the ioctl's
Some more changes to tpm_ioctl.h including
- comment for request and response part of an ioctl
- unified format
- prefix all constants with PTM_

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-10-03 18:41:33 -04:00
Stefan Berger
d8b618851f Improve comments in tpm_ioctl.h
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-06-18 13:13:46 -04:00
Stefan Berger
ff1a99d7e6 swtpm: receiving of TPM state blob ends once last byte has been copied
The receiving of TPM state blob ends when the last byte has been copied
into a response to the user. No more request need to be sent afterwards.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-06-05 16:28:09 -04:00
Stefan Berger
05cd79b843 Support read()/write() for TPM state blob transfer
Support the read/write interface and POSIX API calls for transfer of
TPM state blobs.

Extend the swtpm_ioctl program to support this as well. Use the
environment variable SWTPM_IOCTL_BUFFERSIZE to set the size of the
buffer to use and enable the read/write interface in this (test)
program.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-06-04 18:49:25 -04:00
Stefan Berger
5e60c24f40 remove the tpm_number from the public interface
Remove the tpm_number from the public interface (while we still can do that)

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-28 12:55:30 -04:00
Stefan Berger
31380fe68e tpm_ioctl: Remove _t from the types
Since POSIX reserves the *_t namespace of types, remove it from
all our typedefs. While doing that, adjust the typedefs to all have
the prefix ptm_ .

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-28 12:55:30 -04:00
Stefan Berger
857daa32b9 tpm_ioctl: convert blob type to 32 bit int
Convert the blob type to 32bit int (while we still can do that ... )

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-28 12:55:30 -04:00
Stefan Berger
0224c76d68 cleanup in tpm_ioctl.h
Do some cleanups in tpm_ioctl.h

Signed-off-by; Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-28 06:50:04 -04:00
Stefan Berger
ad976d1a2e Add copyright stanza where missing; update date
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-26 20:52:40 -04:00
Stefan Berger
bd98690a4a Add ioctl to get configuration flags about keys in use
Add an ioctl that lets an application retrieve which keys are in use by the
TPM, i.e., file encryption or migration key

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-26 07:30:38 -04:00
Stefan Berger
4bee90cbc7 Adjust blob size to a size that should work for all architectures
PPC64 seems to not work with 8k blob sizes, but 7k worked.
To be on the safe size, we set the size so that the requests
and responses are below a 4k page size.
2015-04-01 22:45:57 -04:00
Stefan Berger
58548ac677 swtpm: document some more code
Add documentation to the include file and some functions in  the source
code files.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>jo
2015-03-30 10:06:49 -04:00
Stefan Berger
950040f03c swtpm_cuse: implement STOP ioctl
Implement a STOP ioctl in the swtpm and swtpm_ioctl client.
Modify test cases to used swtpm_ioctl --stop.
2015-03-16 11:50:03 -04:00
Stefan Berger
198ebab3c1 Add new ioctls for getting and setting state blobs
Add new ioctls to get and set the 3 different types of state blobs
from and to the CUSE TPM. Add test cases for testing the new ioctl's
on a CUSE TPM that stores the state encrypted and on a CUSE TPM that
stores it non-encrypted.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-03-12 09:32:28 -04:00
Stefan Berger
0321a3808d Add ioctl to reset the establishment bit
Add an ioctl to reset the establishment bit. It takes as an
argument the locality to use.
2014-12-08 11:35:16 -05:00
Stefan Berger
f163b20210 initial check-in 2014-12-05 11:16:03 -05:00