Commit Graph

1028 Commits

Author SHA1 Message Date
Stefan Berger
3f37cc3e5f swtpm: Set errno to 0 before calling strtoul
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-03-31 08:14:33 -04:00
Stefan Berger
d7bbe3de5c swtpm_ioctl: Rearrange code for Unix client socket setup
Rearrange the code of the setup of the Unix client socket.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-03-14 08:37:56 -04:00
Stefan Berger
faceb515c4 swtpm_bios: Rearrange code for Unix client socket setup
Rearrange the code of the setup of the Unix client socket.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-03-14 08:37:56 -04:00
Stefan Berger
753770033a swtpm: Initialize variables in ctrlchannel_return_state
Initialize variables in ctrlchannel_return_state so that all error cases
are properly handled.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-03-14 08:37:56 -04:00
Stefan Berger
5569ab5674 swtpm: describe ctrlchannel_process_fd function
Describe purpose and parameters of the ctrlchannel_process_fd function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-03-14 08:37:56 -04:00
Stefan Berger
f5b286fc7d swtpm_ioctl: initialize locality variable
Initialize the locality variable.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-03-14 08:37:34 -04:00
Stefan Berger
1d450b8db2 Merge pull request #25 from pohly/patch-1
README: clarify status of qemu tpm patches
2017-03-01 10:03:28 -05:00
Stefan Berger
89d85f9a93 test: Add --log parameter to test logging
Add the --log parameter to test log levels 1 and 20.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-03 15:15:31 -05:00
Stefan Berger
51c41a4862 swtpm: set default log level to 1
Set the default log level to 1 so that console output is shown.
This can be turned off with --log level=0

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-03 11:21:31 -05:00
Stefan Berger
380763be6b swtpm: Set loglevel to 1 if log file or file descriptor is given
Set the default log level to 1 if log file or file descriptors are
given.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-03 10:23:38 -05:00
Stefan Berger
65d8e4d834 man pages: make log level bold
Fix the log level parameter to appear in bold.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-02 17:53:17 -05:00
Stefan Berger
c7c657ec3d swtpm_cuse: Add log level parameter to help screen and man page
Add the log level parameter to the CUSE TPM's help screen and man
page.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-02 17:52:30 -05:00
Stefan Berger
540a9a9632 swtpm_cert: Create sets of items
Following the example in the Appendix A.1 of the TCG EK Credential
Profile Spec Version 2.0, a ASN.1 SET is supposed to be created for
each one of the items. This patch fixes the format.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-02 13:07:32 -05:00
Stefan Berger
624b11d860 swtpm_cert: use GNUTLS 3.5 function to set TPM data
Use the GNUTLS 3.5 function gnutls_x509_crt_set_subject_alt_othername
to set the TP<M and platform manufacturer info since the other function
does not accept binary data.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-02 10:50:35 -05:00
Stefan Berger
cde5f608e5 tests: Skip CUSE TPM related tests if cuse module is not available
Skip the CUSE TPM related tests if the CUSE kernel module is not
available. Return similar error messages for both CUSE and VTPM proxy
module if they are not available.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-02 09:01:55 -05:00
Stefan Berger
4994a97e52 tests: Fix return code to skip test
Fix the return code indicating that the test code be skipped.
We need to return 77.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-01 17:28:18 -05:00
Stefan Berger
70ee833604 Improve the build and install instructions
Improve the instruction for building the project on Debian and
RPM based systems.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-31 20:06:52 -05:00
Stefan Berger
ca906a0212 tests: Wait for chardev to appear
Wait for the chardev the VTPM proxy device creates to actually appear.
In some cases the exec statement opening the file would otherwise
create a file /dev/tpm0 for example and subsequently tests then ended
up failing.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-24 08:43:50 -05:00
Stefan Berger
e8b5115f1a swtpm: Expose logging level to command line
Expose the logging level to the command line by extending the
log option with a level parameter.
Extend the man swtpm man page with the level parameter.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-23 19:09:50 -05:00
Stefan Berger
a167784102 swtpm: Support unsigned int option
Implement support for an unsigned int option.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-23 18:20:18 -05:00
Stefan Berger
e34f4ef8eb swtpm: Implement logging following indentation level
Introduce a log level for the logging functions. The log level
is defined by the number of spaces used for indentation. Adapt
the log functions to only log when the number of leading spaces
in a string is appropriate for logging.

Call the log function of libtpms to set the file descriptor to
log to, the log level, and log line prefix.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-23 18:20:17 -05:00
Stefan Berger
f44aec27e0 swtpm: Fix buffer used in logging output
Fix the buffer used in the logging output.

Signed-off-b: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-23 17:52:25 -05:00
Stefan Berger
2308308b5f tests: Add a test case for swtpm using the vTPM proxy device
Add a test case for swtpm chardev using the vTPM proxy device.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-15 09:47:01 -05:00
Stefan Berger
8047b5d62d Add bindaddr and ifname parameters to --server option on help screen
Fix the missing mentioning of the bindaddr and ifname parameters for
the --server option on the help screen.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-15 08:55:53 -05:00
Stefan Berger
4c6fc24467 Errno is not set after inet_pton
Do not call strerror(errno) after failure from inet_pton.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-15 08:55:49 -05:00
Stefan Berger
c751e32ec7 Only compile vTPM proxy support if available on platform
Support for vTPM proxy is only available on Linux.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-15 08:55:07 -05:00
Stefan Berger
099c9cb64b Announce the TPM frontend device name and major/minor numbers
Announce the TPM frontend device name and major/minor numbers.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-14 15:28:05 -05:00
Stefan Berger
794f84982d swtpm: print TPM commands read from file descriptor
Print TPM commands read from the file descriptor.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-13 21:48:12 -05:00
Stefan Berger
ee8b6c2d65 Implement option --vtpm-proxy to create Linux vtpm proxy device
Implement the option --vtpm-proxy that create a Linux vtpm proxy device
and makes the chardev TPM listen on the anaonymous file descriptor that
is returned from the ioctl creating the device.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-13 21:45:04 -05:00
Patrick Ohly
1239447c77 README: clarify status of qemu tpm patches
Makes it easier to find them and learn about the upstream status.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2017-01-10 17:25:37 +01:00
Stefan Berger
3a8a06ad0a Display chardev choice only if compiled in
Only display the chardev choice if chardev support has been
compiled in.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-03 08:22:55 -05:00
Stefan Berger
498433f7b5 Detect whether to build with chardev
Detect whether to build with the chardev interface and only run tests that
need the chardev if it is supported on a particular platform.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-03 07:18:38 -05:00
Stefan Berger
f26ec8c8c7 Conditionally run tests
Conditionally run tests if building with CUSE interface or if
building with swtpm_setup.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-02 21:01:16 -05:00
Stefan Berger
9d64b92375 Return EXIT_FAILURE if unknown command was given
Return EXIT_FAILURE to the caller if an unknown command was given.

Signed-off-by: Stefan Berger <stefan@linux.vnet.ibm.com>
2017-01-02 20:53:28 -05:00
Stefan Berger
6286beacd2 Enable building on cygwin
Enable building the swtpm on cygwin.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-02 20:53:28 -05:00
Stefan Berger
c3fdf68860 Skip swtpm_setup build if NVRAM tools are not available
When NVRAM tools are not available we skip building swtpm_setup.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-02 20:53:28 -05:00
Stefan Berger
09d1a532ba Add configure option --with-cuse to enable building without CUSE
Enable building without CUSE interface using --without-cuse.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-02 18:54:30 -05:00
Stefan Berger
bc3539a7ad Replace the CLA with the DCO, simply requiring a Signed-off-by:
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-12-21 11:11:48 -05:00
Stefan Berger
4c0b273b09 build: search for nonstandard libtpms locations using LIBRARY_PATH
Allow setting the LIBRARY_PATH variable when running configure so
that we can find libtpms in non-standard locations.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-12-06 15:46:31 -05:00
Stefan Berger
2cd10cee2f build: fix Debian packaging if swtpm_cert is missing
Fix the Debian packaging if swtpm_cert is missing. We convert
swtpm-tools.install into an executable shell script that displays
all files to package.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-09-27 17:26:08 -04:00
Stefan Berger
82693130d0 build: Package swtpm_ioctls.3 in swtpm-dev package
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-09-27 17:24:14 -04:00
Stefan Berger
f6864d75c4 Merge pull request #10 from nicholasbishop/patch-1
Fix two typos in the README
2016-07-17 19:04:29 -04:00
Nicholas Bishop
1797d09a25 Fix two typos in the README 2016-07-12 13:37:23 -04:00
Stefan Berger
5db666e8fb rpm: kernel-modules-extra only required on Fedora
The kernel-moudles-extra packages is only required on Fedora.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-06-27 07:02:27 -04:00
Stefan Berger
969edf6f9e Allow choice of crypto subsystem via rpmbuild parameter
Use 'rpmbuild -ba --define "crypto_subsystem openssl" dist/swtpm.spec'
to build swtpm with openssl.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-06-27 06:38:39 -04:00
Stefan Berger
3aa53709a1 swtpm_setup: support --tpmstate as alias for --tpm-state
Support --tpm-state option as an alias for the --tpmstate option.
--tpm-state is a parameter that is also supported by the swtpm
program, so for consistency reasons we should have the same name
for the option here.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-06-26 20:26:53 -04:00
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