Commit Graph

1332 Commits

Author SHA1 Message Date
Stefan Berger
471d8daef2 swtpm_ioctl: Add missing option descriptions to usage page
Add missing --unix and tcp option descriptions to the usage page.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-06-26 20:15:01 -04:00
Stefan Berger
4c707474d5 swtpm_bios: Fix typo in usage page
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-06-26 20:14:00 -04:00
Stefan Berger
ae801f7b27 Adding RHEL/Centos status info 2016-06-26 20:03:43 -04:00
Stefan Berger
70f3e24891 tests: Use a function to wait for pid file to appear
Introduce wait_for_file function to wait for a file for a max. amount of
time and have that function poll for the file to appear.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-06-26 13:57:35 -04:00
Stefan Berger
01eb4d3a3b swtpm_ioctl: Add support for UnixIO and TCP control channel
Add support for UnixIO and TCP control channels. Both types of
transport require that packets are sent in big endian format
and therefore some code needs to be adjusted for that. The
ioctl interface is local and in that case no endianess conversion
is done.

Add a new test case that uses the extended swtpm_ioctl tool to
test the control channel.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-20 16:58:48 -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
bf2cee5c73 swtpm_ioctl: replace return codes in main()
Replace the return codes in main with EXIT_SUCCESS and EXIT_FAILURE.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-20 10:55:28 -04:00
Stefan Berger
37dcf15b86 swtpm_ioctl: add --tpm-device command line option
Add support for providing the TPM device via command line option
--tpm-device <device>.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-20 10:46:10 -04:00
Stefan Berger
96cc5d6027 swtpm_ioctl: switch to using getopt_long for option parsing
Rather than parsing the option on our own use getopt_long() now.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-19 14:21:58 -04:00
Stefan Berger
fc4e289617 swtpm_bios: Add support for UnixIO socket
Add support for UnixIO socker using --unixio command line
option.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-18 17:21:20 -04:00
Stefan Berger
7382352955 swtpm: Add support for commands over UnixIO socket
Add support for receiving TPM commands over UnixIO socket.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-18 17:15:08 -04:00
Stefan Berger
ea898d5b63 swtpm_bios: Add option parameter --tcp to connect to TCP socket
Add support for connecting to a TCP socket where a TPM is listening
for commands.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-18 15:46:23 -04:00
Stefan Berger
e8e4cbe52c swtpm_bios: Add empty option as last one in the list.
Add an empty option as the last one in the list.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-18 15:44:44 -04:00
Stefan Berger
85bae89bb0 tests: source script relative to directory
'source' tests_cuse relative to the tests directory

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-15 22:16:00 -04:00
Stefan Berger
4ec7d70fe8 swtpm_bios: redirect error output to stderr
Redirect all error output to stderr.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-15 21:51:55 -04:00
Stefan Berger
04b607b346 swtpm_bios: add --tpm-device command line option
Add support for providing the TPM device via command line option
--tpm-device <device>.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-15 21:51:18 -04:00
Stefan Berger
8d69193426 swtpm_bios: switch to using getopt_long for option parsing
Rather than parsing the option on our own use getopt_long()
now.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-15 18:20:35 -04:00
Stefan Berger
5647fe1536 Fix the size of the receive buffer
Fix the size of the receive buffer input.body to match the largest
buffer any type of command has.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-14 14:25:09 -04:00
Stefan Berger
1828edeebe Search for certtool when checking for gnutls
Search for certtol when checking for gnutls. It is require if --with-gnutls
is selected since some of the test related scripts will use it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-14 14:00:11 -04:00
Stefan Berger
492a635e69 swtpm: Add support for setting the locality on the TPM
Implement the CMD_SET_LOCALITY command.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-26 13:27:03 -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
a7a261a7e0 swtpm: move function to convert blobtype to name to tpmlib.c
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-25 10:30:56 -04:00
Stefan Berger
73e0c38d8e swtpm: Check for bad input packets sizes
Check all commands for bad input packet sizes.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-25 09:52:54 -04:00
Stefan Berger
3488d25f45 swtpm: Implement resetting the establishment bit with a command
Implement the resetting of the establishment bit with a command

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-24 22:00:24 -04:00
Stefan Berger
b5fbddbcf1 swtpm: deactivate reset establishment
Deactivate the code around resetting the TPM established bit
since its implementation currently requires libtpms 0.6.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-24 14:33:58 -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
3f4b2d599e Make TCP socket port reusable
Set the SO_REUSEADDR socket option.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-21 12:59:24 -04:00
Stefan Berger
708a1a471e swtpm: Fix parsing of the options
Fix the parsing of the command line options.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-21 12:47:00 -04:00
Stefan Berger
c2d04f537b swtpm: Fix application of flag mask
Fix the application of the flag mask.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-21 12:46:56 -04:00
Stefan Berger
9195be7f87 swtpm: Listen for TCP connections
Fix a problem with the socket TPM not listening for TCP connections.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-21 11:29:54 -04:00
Stefan Berger
4716d35a69 swtpm: Rename --connect to --server
Rename the --connect option to --server.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-20 14:50:40 -04:00
Stefan Berger
16eb0ff25a swtpm: Extend TCP server parameters with bind address
Extend TCP server parameters with an IPv4/IPv6 bind address
parameter.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-20 14:49:36 -04:00
Stefan Berger
9ddc699812 swtpm: Add the control channel to the socket interface TPM
Add the control channel to the socket interface TPM as well.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-18 16:51:19 -04:00
Stefan Berger
b959335e5d swtpm: let socket and character interfaces share the mainloop
Let the socket and character interfaces share the same mainloop
function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-18 15:55:35 -04:00
Stefan Berger
bfa865a7a1 Prepare the mainloop function for usage by the socket interface
Prepare the mainloop function so that it can be used by the socket
interface as well.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-18 15:14:16 -04:00
Stefan Berger
320d90641e swtpm: move chardev's mainloop into own file
Move the swtpm chardev main loop into its own file for sharing
with the socket interface.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-18 14:27:09 -04:00
Stefan Berger
7c0a033f96 swtpm: add --connect option support
Add support for --connect option for the socket version of the TPM.
This parameter takes the type, port, file descriptor and disconnect
options. Only TCP connections are currently supported.

See updated man pages.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-18 13:36:40 -04:00
Stefan Berger
45cfd52628 tpm_fastpath
Only let certain commands that are cancelable be processed
by the thread. Directly process all other commands.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-16 20:03:06 -04:00
Stefan Berger
81c55814dd swtpm_bios: Exit with error if TPM needs to be reset for activation
Exit with error code 129 if the TPM needs to be reset to become activated.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-02-18 09:55:23 -05:00
Stefan Berger
f3a199859b Adding CLAs for corporate and individual contributors.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-02-01 11:56:24 -05:00
Stefan Berger
86cc4527b4 build: Add check for libtpms crytpo library
Extend configure.ac to check for the crypto library libtpms is
using and make sure we are using the same here. Due to symbol
clashes between freebl and openssl related to the hash update
functions, we get crashes otherwise.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-26 12:24:52 -05:00
Stefan Berger
37c73b4ba7 build: Add tpm_bios.h to noinst_HEADERS
tpm_bios.h was missing in the tar created by 'make dist'. This patch
fixes it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-25 16:26:00 -05:00
Stefan Berger
3b64478713 swtpm_bios: use data structures to write commands
Use TPM data structures and constants to write commands.

Fix white space errors on the way.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-24 11:21:14 -05:00
Stefan Berger
ed29bd7229 swtpm: do not compare positive integer with < 0
Do not compare positive integer with < 0.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-24 10:07:55 -05:00
Stefan Berger
71b91c9cef swtpm: do not compare positive integer with < 0
Do not compare positivie integer with < 0.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-24 09:42:50 -05:00
Stefan Berger
feee88b0d8 swtpm: use ioctl structure to return values
Use the ioctl structures to return values. Properly initialize the
TPM result value.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-24 09:40:44 -05:00
Stefan Berger
1e0296851f swtpm: check for unsupported file descriptor types
Rather than checking whether the given file descriptor is a character
device, check whether it is one of the unsupported ones. This addresses
a problem when passing anonymous file descriptors that are not character
devices.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-22 07:43:59 -05:00
Stefan Berger
ffc498b4ca swtpm_setup: send command for EK creation directly
Send the TPM command for EK creation directly; it requires no
crytpo and can be hard coded.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-13 20:07:12 -05:00