Commit Graph

1439 Commits

Author SHA1 Message Date
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
Stefan Berger
699c204323 build: Exclude swtpm_cert from Debian package if not found
Exclude the swtpm_cert tool and its man page if it is not found
due to it not being compiled due to backlevel gnutls library.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-13 16:23:08 -05:00
Stefan Berger
08f09d299e build: Fix the Debian package dependencies
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-13 12:37:41 -05:00
Stefan Berger
4536ec6de2 Revert "build: Include swtpm_cert if it was built, other fixes"
This reverts commit a0116f936a.
2016-01-13 12:35:38 -05:00
Stefan Berger
a0116f936a build: Include swtpm_cert if it was built, other fixes
swtpm_cert is only included in the package if it was built, which works
on >= 15.04.

Get the dependencies right.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-13 12:24:13 -05:00
Stefan Berger
95d41f7fb0 build: add gnutls-utils as dependency
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-13 10:48:20 -05:00
Stefan Berger
4372c7feb8 tests: Display logfile upon failure
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-13 10:35:20 -05:00
Stefan Berger
dcbb1181fb build: Enable building of Debian package
Add debian build files to enable building of Debian package using for exampl

debuild -b   or   dpkg-buildpackage -us -uc

Extend the .gitignore.

The debhelper checks show warnings and errors that will need to be addressed
some other time. For some I don't know how to solve them at the moment.

Signed-off-by: Stefan Berger <stefanb@linux.watson.ibm.com>
2016-01-12 19:56:00 -05:00
Stefan Berger
100029339d build: fix some issues in configure.ac
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-12 19:53:31 -05:00
Stefan Berger
4a37440a4d build: Link libswtpm_libtpms with glib libs
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-12 19:52:29 -05:00
Stefan Berger
c9de5f0ab1 build: add threadpool.h
Add the threadpool.h to the noinst headers, so it ends up in the tgz file.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-29 04:30:27 -05:00
Stefan Berger
c3c7e8f364 swtpm_bios: Introduce durations to wait for command completions
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-29 04:25:42 -05:00
Stefan Berger
abac744529 swtpm_bios: use select for waiting for response
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-28 20:35:29 -05:00
Stefan Berger
1c1efe2dab swtpm: move threadpool code out of cuse-tpm
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-28 16:13:53 -05:00
Stefan Berger
28a18c29b3 swtpm_setup: improve error handling
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-28 16:10:10 -05:00
Stefan Berger
b7a4c100fb samples: improve error handling
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-28 15:58:15 -05:00
Stefan Berger
bb420d7481 swtpm: move process owership to common file and enable in all implementations
Move the code to change process ownership into its own function and enable
--runas|-r <owner> in all implementations.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-27 18:17:49 -05:00
Stefan Berger
e11a75527e tests: add timeout to socat
Add a timeout to socat so that on slower machines the tests succeed.

Clean up an #include.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-21 03:26:46 -05: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
0cfbcb3d82 Update TODO list
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-20 20:07:55 -05:00
Stefan Berger
78c5f924bf swtpm: add cuse TPM interface option to swtpm
Now that the CUSE TPM part is BSD licensed, extend the swtpm
program with the cuse option.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-20 20:06:57 -05:00
Stefan Berger
ddf99d057a swtpm: clean up single letter options
Remove single letter options that are not described in the help screen.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-20 13:17:08 -05:00
Stefan Berger
cf56d345bd tests: Deactivate the checking for the certificate size
Deactivate the checking for the certificate size since different
GnuTLS versions may create certificates of different sizes by adding
additional fields or other data to the cert.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-13 21:58:38 -05:00
Stefan Berger
12837911ce swtpm: do not ignore write return value
If the 'swtpm chardev' receives an error on write() or not all bytes
could be written, log an error and terminate.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-13 21:49:49 -05:00
Stefan Berger
96038cdfec tests: move modprobe cuse into common file
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-13 21:23:12 -05:00
Stefan Berger
86b6ffca75 swtpm: use endian.hi for endianess conversion
Use the macros defined in endian.h for endianess conversion.

Fix the conversion of a 64bit variable.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-07 17:25:17 -05:00
Stefan Berger
2b4c6da540 swtpm: add missing dirent.h include
On PowerKVM dirent.h needs to be included.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-07 17:24:43 -05:00
Stefan Berger
db33da6b78 build: fix build of rpm
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-07 17:24:23 -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
57d542a01c swtpm: transfer the rest of the code
Transfer the rest of the CUSE TPM code into the new application.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-07 14:57:54 -05:00
Stefan Berger
82cf754a79 swtpm: Implement ptm_init_done function
Implement the ptm_init_done function

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-07 14:57:54 -05:00
Stefan Berger
6a102bc764 swtpm: Implement command line option parsing and main function
Implement the command line option parsing and the main() function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-07 14:57:54 -05:00
Stefan Berger
6e0dc3ddd5 swtpm: Re-implement CUSE TPM under BSD license
Eric Richter implemented a clean-room skeleton CUSE driver which
we will now convert to the CUSE TPM. The goal is to replace the
GPL CUSE TPM implementation with this 3-clause BSD implementation.
Among other things, this makes it easier to link with OpenSSL.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-07 14:57:54 -05:00
Stefan Berger
ffcb6535d3 swtpm_bios: Add option to give up physical presence
Extend the swtpm_bios tool with an option to give up physical presence.

Have the TPM error codes reflected in the exit error of 128.

Add a test case for the tool.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-04 18:23:13 -05:00
Stefan Berger
a1030ba771 swtpm_ioctl: do not display help screen on -h
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-04 09:31:55 -05:00
Stefan Berger
57e53b78ea swtpm: Add option to only display version info
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-04 07:32:53 -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
a7bd0ebffc swtpm: poll for HUP as well
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-03 09:15:59 -05:00
Stefan Berger
8cb126e4c3 build: check for socat tool
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-30 15:35:32 -05:00
Stefan Berger
58774fd617 build: move chmod into AC_CONFIG_FILES
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-29 18:59:16 -05:00
Stefan Berger
8a68446e73 swtpm_setup: enable help screen for normal users
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-29 17:05:22 -05:00
Stefan Berger
a3c8e71a1d swtpm: fix some coverity errors
Fix some errors raised by Coverity.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-29 01:48:13 -05:00
Stefan Berger
02017e62b0 test: fix file permission
Signed-off-ny: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-28 10:47:38 -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