]> git.proxmox.com Git - swtpm.git/log
swtpm.git
9 years agoSome more changes to the ioctl's
Stefan Berger [Sat, 3 Oct 2015 22:41:33 +0000 (18:41 -0400)]
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>
9 years agodist: currently build a development version
Stefan Berger [Sat, 3 Oct 2015 22:12:18 +0000 (18:12 -0400)]
dist: currently build a development version

Add .dev to the version of the built swtpm package to indicate
development version.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agobuild: only apply hardening CFLAGS if -O0 is not used
Stefan Berger [Tue, 4 Aug 2015 15:48:02 +0000 (11:48 -0400)]
build: only apply hardening CFLAGS if -O0 is not used

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotests: fix more typos
Stefan Berger [Mon, 3 Aug 2015 13:55:35 +0000 (09:55 -0400)]
tests: fix more typos

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotest: fix a typo
Stefan Berger [Mon, 3 Aug 2015 11:01:10 +0000 (07:01 -0400)]
test: fix a typo

Fix a typing error.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_cert: remove unnecessary file
Stefan Berger [Thu, 2 Jul 2015 22:05:05 +0000 (18:05 -0400)]
swtpm_cert: remove unnecessary file

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agosamples: propagate error code
Stefan Berger [Thu, 2 Jul 2015 20:02:07 +0000 (16:02 -0400)]
samples: propagate error code

Propagate error code to the exit statement.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoman pages: update on swtpm_ioctl.8
Stefan Berger [Thu, 2 Jul 2015 14:58:57 +0000 (10:58 -0400)]
man pages: update on swtpm_ioctl.8

Update swtpm_ioctl.8 to latest content.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoman pages: clarification for swtpm_setup
Stefan Berger [Thu, 2 Jul 2015 14:55:22 +0000 (10:55 -0400)]
man pages: clarification for swtpm_setup

swtpm_setup uses swtpm executable it finds in the path.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_setup: remove PATH extension to local dir
Stefan Berger [Thu, 2 Jul 2015 14:49:24 +0000 (10:49 -0400)]
swtpm_setup: remove PATH extension to local dir

Remove the extension of PATH to the local dir('.') from swtpm_setup.sh
and adapt test cases accordingly.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_setup: cleanup
Stefan Berger [Thu, 2 Jul 2015 00:51:14 +0000 (20:51 -0400)]
swtpm_setup: cleanup

Cleanup the code a bit:
 o added description to several functions
 o remove empty lines between functions
 o cleanup the usage screen
 o fix the parameters to logerr

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotest: poll for port closure
Stefan Berger [Tue, 30 Jun 2015 17:31:08 +0000 (13:31 -0400)]
test: poll for port closure

Poll for the swtpm with socket interface port to close the port

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotest: poll for port available
Stefan Berger [Tue, 30 Jun 2015 17:08:09 +0000 (13:08 -0400)]
test: poll for port available

Poll for the swtpm with socket interface port to become available for
usage.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotests: cleanup testcases
Stefan Berger [Tue, 30 Jun 2015 14:42:05 +0000 (10:42 -0400)]
tests: cleanup testcases

Cleanup the test cases:
- remove unnecessary sleeps
- check exit code of swtpm_ioctl

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_cuse: be more consistent with input buffer size checks
Stefan Berger [Tue, 23 Jun 2015 18:04:39 +0000 (14:04 -0400)]
swtpm_cuse: be more consistent with input buffer size checks

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoImprove comments in tpm_ioctl.h
Stefan Berger [Thu, 18 Jun 2015 17:13:46 +0000 (13:13 -0400)]
Improve comments in tpm_ioctl.h

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoman pages: check in generated man pages
Stefan Berger [Fri, 5 Jun 2015 20:30:09 +0000 (16:30 -0400)]
man pages: check in generated man pages

Check in generated man pages that had been missing.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: receiving of TPM state blob ends once last byte has been copied
Stefan Berger [Fri, 5 Jun 2015 20:28:05 +0000 (16:28 -0400)]
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>
9 years agoswtpm: delete blob file if set blob has length 0
Stefan Berger [Fri, 5 Jun 2015 20:25:29 +0000 (16:25 -0400)]
swtpm: delete blob file if set blob has length 0

If a blob with length 0 is set, we make sure the corresponding file
that would hold this blob is not available.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoSupport read()/write() for TPM state blob transfer
Stefan Berger [Thu, 4 Jun 2015 22:49:25 +0000 (18:49 -0400)]
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>
9 years agoExtend test cases with large permanent state
Stefan Berger [Thu, 4 Jun 2015 14:55:32 +0000 (10:55 -0400)]
Extend test cases with large permanent state

For being able to test the transfer of larger state blobs, extend the existing
test case with creating a large NVRAM location that becomes part of the permanent
state.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotests: remove saving of volatile state before saving blob
Stefan Berger [Thu, 28 May 2015 16:55:30 +0000 (12:55 -0400)]
tests: remove saving of volatile state before saving blob

Remove the explicit saving of volatile state before saving the volatile
state blob to a file.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoremove the tpm_number from the public interface
Stefan Berger [Thu, 28 May 2015 16:55:30 +0000 (12:55 -0400)]
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>
9 years agotpm_ioctl: Remove _t from the types
Stefan Berger [Thu, 28 May 2015 16:55:30 +0000 (12:55 -0400)]
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>
9 years agotpm_ioctl: convert blob type to 32 bit int
Stefan Berger [Thu, 28 May 2015 16:55:30 +0000 (12:55 -0400)]
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>
9 years agoswtpm: move code to set state blob into own function
Stefan Berger [Thu, 28 May 2015 16:55:30 +0000 (12:55 -0400)]
swtpm: move code to set state blob into own function

Move the code that sets the TPM's state blob into its own function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: move code to get the TPM state blobs into own function
Stefan Berger [Thu, 28 May 2015 16:55:30 +0000 (12:55 -0400)]
swtpm: move code to get the TPM state blobs into own function

Move the code to get the TPM state blobs into is own function and introduce
a caching layer that retrieves the state blob from the TPM once and has
subsequent requests to copy the state work on the cached blob.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agocleanup in tpm_ioctl.h
Stefan Berger [Thu, 28 May 2015 10:50:04 +0000 (06:50 -0400)]
cleanup in tpm_ioctl.h

Do some cleanups in tpm_ioctl.h

Signed-off-by; Stefan Berger <stefanb@linux.vnet.ibm.com>

9 years agoAdd copyright stanza where missing; update date
Stefan Berger [Wed, 27 May 2015 00:52:33 +0000 (20:52 -0400)]
Add copyright stanza where missing; update date

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoAdd ioctl to get configuration flags about keys in use
Stefan Berger [Tue, 26 May 2015 11:30:38 +0000 (07:30 -0400)]
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>
9 years agotests: add volatilestate.bin to EXTRA_DIST
Stefan Berger [Mon, 25 May 2015 19:45:53 +0000 (15:45 -0400)]
tests: add volatilestate.bin to EXTRA_DIST

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: Add a command line option for a migration key
Stefan Berger [Sat, 23 May 2015 00:21:38 +0000 (20:21 -0400)]
swtpm: Add a command line option for a migration key

The migration key ensures that TPM state blobs, when retrieved using the
ioctl for getting state blobs, are always encrypted with this key.
When the state is later on loaded back into the TPM using the ioctl
to set the state blobs, the migration key is used to decrypt them.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: Have crypto functions use a key as parameter
Stefan Berger [Fri, 22 May 2015 01:57:09 +0000 (21:57 -0400)]
swtpm: Have crypto functions use a key as parameter

Have the crypto functions use a key as a parameter rather than having them
operate on a specific fixed key.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: break apart key parsing function
Stefan Berger [Fri, 22 May 2015 01:14:27 +0000 (21:14 -0400)]
swtpm: break apart key parsing function

Break the key parsing function apart into a common parsing function
and one specific to the file encryption key.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: prepend a header in front of all blobs retrieved from the TPM
Stefan Berger [Sat, 23 May 2015 03:12:19 +0000 (23:12 -0400)]
swtpm: prepend a header in front of all blobs retrieved from the TPM

Prepend a header in front of all blobs retrieved from the TPM.
Write flags into this header indicating whether the blob is
encrypted.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotests: do not let test_resume_volatile touch files in git
Stefan Berger [Fri, 22 May 2015 17:09:30 +0000 (13:09 -0400)]
tests: do not let test_resume_volatile touch files in git

Have test_resume_volatile create a temporary dir and copy test files to it
that may be modified during the test run.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: integrity protect the encrypt TPM state
Stefan Berger [Tue, 19 May 2015 19:10:35 +0000 (15:10 -0400)]
swtpm: integrity protect the encrypt TPM state

Integrity protect the TPM state when it is written in entrypted form.
libtpms state (for TPM1.2) is also integrity protecting the blobs, but
we better determine the integrity of the decrypted data on the layer
above it.

9 years agoswtpm: more precise error message if setuid doesn't work
Stefan Berger [Sat, 16 May 2015 21:59:39 +0000 (17:59 -0400)]
swtpm: more precise error message if setuid doesn't work

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: assign value to saveptr used in strtok_r
Stefan Berger [Tue, 12 May 2015 18:59:16 +0000 (14:59 -0400)]
swtpm: assign value to saveptr used in strtok_r

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: Ignore the return value of a write op before closing connection
Stefan Berger [Tue, 12 May 2015 18:54:45 +0000 (14:54 -0400)]
swtpm: Ignore the return value of a write op before closing connection

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_setup: Annotate that we pass argv to execv intentionately
Stefan Berger [Tue, 12 May 2015 18:51:16 +0000 (14:51 -0400)]
swtpm_setup: Annotate that we pass argv to execv intentionately

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: No need to compare locality with negative values
Stefan Berger [Tue, 12 May 2015 18:32:36 +0000 (14:32 -0400)]
swtpm: No need to compare locality with negative values

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: change type of len from size_t to ssize_t
Stefan Berger [Tue, 12 May 2015 18:28:36 +0000 (14:28 -0400)]
swtpm: change type of len from size_t to ssize_t

Change the type of the len variable from size_t to ssize_t for
comparison against neg. values to work.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_ioclt: no need to compare locality with values < 0
Stefan Berger [Tue, 12 May 2015 18:26:30 +0000 (14:26 -0400)]
swtpm_ioclt: no need to compare locality with values < 0

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_cert: change variable type from unsigned char to char
Stefan Berger [Tue, 12 May 2015 18:24:27 +0000 (14:24 -0400)]
swtpm_cert: change variable type from unsigned char to char

Change variable type of val1 and val2 from unsigned char to char for
the comparison with neg. numbers to work.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_cuse: no need to compare uint8_t locality with < 0.
Stefan Berger [Tue, 12 May 2015 18:20:16 +0000 (14:20 -0400)]
swtpm_cuse: no need to compare uint8_t locality with < 0.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: replace size_t with ssize_t for variable taking read() return value
Stefan Berger [Tue, 12 May 2015 18:18:23 +0000 (14:18 -0400)]
swtpm: replace size_t with ssize_t for variable taking read() return value

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: Check file descriptor >= 0 before closing
Stefan Berger [Tue, 12 May 2015 18:09:05 +0000 (14:09 -0400)]
swtpm: Check file descriptor >= 0 before closing

Check the file descriptor for >= 0 before closing it. Hopefully
this makes Coverity happy.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_bios: Remove UNIXIO socket related code since not used
Stefan Berger [Tue, 12 May 2015 18:04:03 +0000 (14:04 -0400)]
swtpm_bios: Remove UNIXIO socket related code since not used

We do not support UNIXIO sockets for communicatin with the swtpm
yet, so remove this.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotests: add test case that certificate is created automatically
Stefan Berger [Tue, 12 May 2015 13:32:31 +0000 (09:32 -0400)]
tests: add test case that certificate is created automatically

Add a test case that ensures that swtpm-localca automatically
creates a signing key and issuer cert if none is available.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_ioctl: Move code for loading TPM stateblobs to own function
Stefan Berger [Sun, 10 May 2015 21:53:48 +0000 (17:53 -0400)]
swtpm_ioctl: Move code for loading TPM stateblobs to own function

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_ioctl: Move code for saving TPM stateblobs to own function
Stefan Berger [Sun, 10 May 2015 17:00:20 +0000 (13:00 -0400)]
swtpm_ioctl: Move code for saving TPM stateblobs to own function

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_ioctl: move hashing code into own function
Stefan Berger [Sun, 10 May 2015 14:28:57 +0000 (10:28 -0400)]
swtpm_ioctl: move hashing code into own function

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm: cleanup and commented ptm_ioctl
Stefan Berger [Sat, 9 May 2015 12:43:27 +0000 (08:43 -0400)]
swtpm: cleanup and commented ptm_ioctl

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_ioctl: source formatting
Stefan Berger [Sat, 9 May 2015 12:41:04 +0000 (08:41 -0400)]
swtpm_ioctl: source formatting

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoEnable certificate creation by default
Stefan Berger [Tue, 5 May 2015 15:04:16 +0000 (11:04 -0400)]
Enable certificate creation by default

Modify swtpm_setup.conf to enable the creation of certifcates by default.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agobuild: need at least tpm-tools 1.3.8-6
Stefan Berger [Mon, 4 May 2015 11:33:51 +0000 (07:33 -0400)]
build: need at least tpm-tools 1.3.8-6

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_setup: Print error in case 'eval' fails on file permissions etc.
Stefan Berger [Mon, 4 May 2015 05:20:46 +0000 (01:20 -0400)]
swtpm_setup: Print error in case 'eval' fails on file permissions etc.

Also have the log function print out all parameters.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agobuild: set proper rights on swtpm-localca script when installing
Stefan Berger [Mon, 4 May 2015 05:04:22 +0000 (01:04 -0400)]
build: set proper rights on swtpm-localca script when installing

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agobuild: install /var/lib/swtpm-localca with proper owner
Stefan Berger [Mon, 4 May 2015 04:26:02 +0000 (00:26 -0400)]
build: install /var/lib/swtpm-localca with proper owner

Install /var/lib/swtpm-localca so that tss can access it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_setup: fix variable name typo
Stefan Berger [Mon, 4 May 2015 06:58:13 +0000 (02:58 -0400)]
swtpm_setup: fix variable name typo

Fix a typo in a variable name.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agosamples: automatically create signing key and issuer cert
Stefan Berger [Mon, 4 May 2015 06:48:43 +0000 (02:48 -0400)]
samples: automatically create signing key and issuer cert

Automatically create the signing key and a self-signed issuer
certificate if the state dir has to be created.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agosample: rename swtpm_localca dir to swtpm-localca
Stefan Berger [Mon, 4 May 2015 04:35:25 +0000 (00:35 -0400)]
sample: rename swtpm_localca dir to swtpm-localca

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agosamples: rename swtpm-localca.sh to swtpm-localca
root [Mon, 4 May 2015 03:19:28 +0000 (23:19 -0400)]
samples: rename swtpm-localca.sh to swtpm-localca

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotest: Use TPM_ResetEstablishmentBit command in some tests
Stefan Berger [Sat, 2 May 2015 13:19:46 +0000 (09:19 -0400)]
test: Use TPM_ResetEstablishmentBit command in some tests

Rather than only using the ioctl to reset the TPM Establishment
bit in a given locality, also use the TPM_ResetEstablishmentBit
command for it in some test cases.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotests: Fix test case output
Stefan Berger [Fri, 1 May 2015 20:25:54 +0000 (16:25 -0400)]
tests: Fix test case output

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotests: Extends test_volatilestate with checks on establishment bit
Stefan Berger [Fri, 1 May 2015 16:24:39 +0000 (12:24 -0400)]
tests: Extends test_volatilestate with checks on establishment bit

Extend the testcase test_volatilestate with check on the TPM
establishment bit and that it is saved across volatile save/load
operations.

9 years agotest: Terminate swtpm in case testcase is aborted
Stefan Berger [Wed, 29 Apr 2015 00:16:47 +0000 (20:16 -0400)]
test: Terminate swtpm in case testcase is aborted

Send a SIGTERM to the swtpm in case the testcase is aborted.

9 years agoRequire kernel-modules-extra package
Stefan Berger [Thu, 2 Apr 2015 10:44:38 +0000 (06:44 -0400)]
Require kernel-modules-extra package

The cuse module is found in the kernel-modules-extra package.

9 years agotests: bail out if modprobe cuse fails
Stefan Berger [Thu, 2 Apr 2015 10:43:27 +0000 (06:43 -0400)]
tests: bail out if modprobe cuse fails

Terminate the test case immediately if modprobe cuse fails.

9 years agoAdjust blob size to a size that should work for all architectures
Stefan Berger [Thu, 2 Apr 2015 02:45:57 +0000 (22:45 -0400)]
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.

9 years agoExpect tool is required
Stefan Berger [Thu, 2 Apr 2015 02:38:24 +0000 (22:38 -0400)]
Expect tool is required

Check for the expect tool in configure.
Require the expect tool in the spec file.

9 years agoswtpm: document some more code
Stefan Berger [Mon, 30 Mar 2015 11:47:46 +0000 (07:47 -0400)]
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
9 years agoswtpm: add documentation to options source code
Stefan Berger [Mon, 30 Mar 2015 11:23:45 +0000 (07:23 -0400)]
swtpm: add documentation to options source code

Add documentation to the options source code and introduce an explicit
default value to return in case an option was not found while parsing.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoswtpm_cuse: automatically remove volatile state after retireval
Stefan Berger [Thu, 19 Mar 2015 19:44:18 +0000 (15:44 -0400)]
swtpm_cuse: automatically remove volatile state after retireval

Automatically remove the volatile state file after retrieval.

9 years agoswtpm_cuse: implement STOP ioctl
Stefan Berger [Mon, 16 Mar 2015 15:50:00 +0000 (11:50 -0400)]
swtpm_cuse: implement STOP ioctl

Implement a STOP ioctl in the swtpm and swtpm_ioctl client.
Modify test cases to used swtpm_ioctl --stop.

9 years agoswtpm_ioctl: if blob cannot be found TPM_NON_FATAL is returned
Stefan Berger [Mon, 16 Mar 2015 15:19:38 +0000 (11:19 -0400)]
swtpm_ioctl: if blob cannot be found TPM_NON_FATAL is returned

It's not a fatal error if a blob is not returned and the CUSE TPM replies
with TPM_NON_FATAL error code.

9 years agoswtpm_setup: reuse existing function to stop processes
Stefan Berger [Mon, 16 Mar 2015 15:14:04 +0000 (11:14 -0400)]
swtpm_setup: reuse existing function to stop processes

9 years agoswtpm_setup: check swtpm port
Stefan Berger [Sun, 15 Mar 2015 00:42:59 +0000 (20:42 -0400)]
swtpm_setup: check swtpm port

Also check the port of the swtpm before proceeding.
Fix a typo in the code.

9 years agoswtpm_setup: remove debugging code
Stefan Berger [Fri, 13 Mar 2015 18:52:11 +0000 (14:52 -0400)]
swtpm_setup: remove debugging code

9 years agoswtpm_setup: Test connection with tcsd
Stefan Berger [Fri, 13 Mar 2015 16:35:59 +0000 (12:35 -0400)]
swtpm_setup: Test connection with tcsd

On rare occassions TCSD refuses connections after start and nothing
works; so we test the connection with TCSD and kill it if it doesn't
work.

This now seems to fix the tests/test_parameters that occosionally
had been reporting an error.

9 years agoOnly allow a single command per TCP connection to be sent
Stefan Berger [Fri, 13 Mar 2015 01:45:34 +0000 (21:45 -0400)]
Only allow a single command per TCP connection to be sent

Only allow a single command per TCP connection to be sent to
the socket TPM. This solves a problem with the test_parameters
testcase where the TPM seems to get stuck in the poll().
However, the testcase still is not entirely error-free.

9 years agoOnly list LISTEN sockets when checking on tcsd
Stefan Berger [Thu, 12 Mar 2015 18:21:55 +0000 (14:21 -0400)]
Only list LISTEN sockets when checking on tcsd

Only list LISTEN sockets when checking whether tcsd has started
listening on a socket, yet.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoUpdate man page with description for new commands
Stefan Berger [Thu, 12 Mar 2015 13:49:40 +0000 (09:49 -0400)]
Update man page with description for new commands

Update the man page of swtpm_ioctl with the new commands for
getting stateblobs from the CUSE TPM and setting stateblobs in
the CUSE TPM.

9 years agoAdd new ioctls for getting and setting state blobs
Stefan Berger [Thu, 12 Mar 2015 13:32:28 +0000 (09:32 -0400)]
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>
9 years agoShow error message when not installing as root
Stefan Berger [Fri, 20 Feb 2015 23:44:47 +0000 (18:44 -0500)]
Show error message when not installing as root

Only root can change the ownership of swtpm_setup.sh to tss:tss, so
only root can install the file.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoFix build on RHEL6 where we need -lgthread-2.0
Stefan Berger [Fri, 30 Jan 2015 23:16:09 +0000 (18:16 -0500)]
Fix build on RHEL6 where we need -lgthread-2.0

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoAllocate TPM command buffer on heap rather than on the stack
Stefan Berger [Fri, 30 Jan 2015 22:56:26 +0000 (17:56 -0500)]
Allocate TPM command buffer on heap rather than on the stack

Allocate the TPM command buffer on the heap. Previously it was
allocated on the stack.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoChange void * to concrete structure.
Stefan Berger [Fri, 30 Jan 2015 22:29:54 +0000 (17:29 -0500)]
Change void * to concrete structure.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoAdd some hardening flags to compiler and linker
Stefan Berger [Fri, 30 Jan 2015 22:06:07 +0000 (17:06 -0500)]
Add some hardening flags to compiler and linker

Protect the stack, create position indep. executables, use Relocation
Read-Only (RELRO) and have the linker resolve all symbols upon
program start.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoRemove unused wrapper tcsd-launcher.c
Stefan Berger [Mon, 19 Jan 2015 19:47:35 +0000 (14:47 -0500)]
Remove unused wrapper tcsd-launcher.c

Remove the unused wrapper program tcsd-launcher.c.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoUpdate on TODO
Stefan Berger [Fri, 16 Jan 2015 14:59:51 +0000 (09:59 -0500)]
Update on TODO

9 years agoFix cut and paste error
Stefan Berger [Mon, 22 Dec 2014 20:54:01 +0000 (15:54 -0500)]
Fix cut and paste error

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoRun parallel tests also when building RPMs
Stefan Berger [Fri, 19 Dec 2014 21:16:21 +0000 (16:16 -0500)]
Run parallel tests also when building RPMs

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoAllow tests to run in parallel
Stefan Berger [Fri, 19 Dec 2014 21:10:21 +0000 (16:10 -0500)]
Allow tests to run in parallel

Create uniqe names for the /dev/vtpm* so that tests can run in parallel.
Also separate the state directories of the TPMs into individual temporary
dirs.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoMake SELinux policy extension support chooseable
Stefan Berger [Fri, 19 Dec 2014 14:28:47 +0000 (09:28 -0500)]
Make SELinux policy extension support chooseable

Extend configure.ac to make SELinux policy extension support
chooseable. By default configure will check whether SELinux
support is installed on the local system and will add SELinux
policy extension support if support is found.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoSearch for external echo tool
Stefan Berger [Fri, 19 Dec 2014 03:27:53 +0000 (22:27 -0500)]
Search for external echo tool

Search for bash-external echo tool.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoSupport for openssl
Stefan Berger [Fri, 19 Dec 2014 03:19:57 +0000 (22:19 -0500)]
Support for openssl

Also support swtpm using OpenSSL library.
Introduce --with-openssl in configure.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoCheck for missing freebl headers and freebl lib
Stefan Berger [Thu, 18 Dec 2014 16:04:22 +0000 (11:04 -0500)]
Check for missing freebl headers and freebl lib

Add a check for missing freebl header blapi.h (missing in Ubuntu)
and missing freebl static library that provides AES_CreateContext.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoMerge branch 'master' of https://github.com/stefanberger/swtpm
Stefan Berger [Thu, 11 Dec 2014 19:05:33 +0000 (14:05 -0500)]
Merge branch 'master' of https://github.com/stefanberger/swtpm