Commit Graph

1439 Commits

Author SHA1 Message Date
Stefan Berger
1fb811bf9e rpm: swtpm-tools requires swtpm of the exact same version
Tie swtpm-tools updating to swtpm updating and vice versa by requiring
swtpm-tools the swtpm package to have the same version.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-25 08:35:45 -04:00
Stefan Berger
b4372fe50f tests: Use python3 rather than python for the test programs
Fedora policy seems to be to use python3 explicitly for the hashbang
rather than python, which could be either python2 or python3. So convert
it to python3. Also adapt configure.ac to require python3 executable.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-25 08:35:45 -04:00
Stefan Berger
a246953a50 build-sys: Install libswpm_libtpms into $(libdir)/swtpm
Install the private libswtpm_libtpms into $(libdir)/swtpm
rather than into the shared libaries directory.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-25 08:35:45 -04:00
Stefan Berger
908afaf5f8 build-sys: Replace AC_PROG_LIBTOOL with LT_INIT
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-25 08:35:45 -04:00
Stefan Berger
3041f38769 build-sys: Do not build man page or SELinux policy for CUSE if --without-cuse is used
To make the RPM building easier for the --without-cuse case we have to omit
a couple of files from being built so that they are not left-overs when
packing the RPM without building swtpm-cuse.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-25 08:35:45 -04:00
Stefan Berger
0528804205 rpm: Replace %bcond_with gnutls with %bcond_without gnutls
The meaning of %bcond_without is that it enables a feature by default.
We want to buld with gnutls, so enable it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-25 08:35:45 -04:00
Stefan Berger
e1eca6c8f8 rpm: Add entry to changelog
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-25 08:35:45 -04:00
Stefan Berger
3b40c9167a build-sys: Fix policy package dependencies for out-of-tree build
An out-of-tree build fails to build swtpm_svirt.pp due to missing
source files from the swtpm.pp policy. Add the swtpm.{te,if,fc} files
as dependencies of the swtpm_svirt.pp policy package.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-25 08:35:45 -04:00
Stefan Berger
1e1252b153 build-sys: Fix the SELinux policy build target for parallel builds
Use .NOTPARALLEL for the SELinux policy build target to avoid running
the rule concurrently and deleting the tmp directory while another
build is running.

For some reason it is not possible to use $(MAKE) since otherwise the
building of the policy package fails.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:48:41 -04:00
Stefan Berger
940a774bb4 docu: Cut down the README to its minimum
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:48:41 -04:00
Stefan Berger
ca14f1cfd9 SELinux: Fix some nits in the SELinux policy files
This patch is partially from Lukas Vrabec (lvrabec@redhat.com) and fixes
some nits in the SELinux policy.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:48:41 -04:00
Stefan Berger
5b09de83a2 SELinux: Install policy package files to /usr/share/selinux/packages
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:48:41 -04:00
Stefan Berger
0f05604869 build-sys: Create compressed policy package files
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:48:41 -04:00
Stefan Berger
b88244ebeb SELinux: Extend SELinux policy with rules for svirt_tcg
Extend the SELinux policy with rules for svirt_tcg when
QEMU is not being started with KVM by libvirt.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:48:41 -04:00
Stefan Berger
b28f585c41 SELinux: Fix title in interface file
Fix the title in the interface file to say 'swtpm'.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:48:41 -04:00
Stefan Berger
94bb9f2d71 Travis: Fix the coverity scan build
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:46:58 -04:00
Stefan Berger
caae7b1ad7 ek-cert: Initialize datum variable to prevent unintialized access
Coverity scan shows an uninitialized access in case an error is
encountered and the cleanup path is taken before datum was initialized.
Fix the error by initializing the variable.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:46:58 -04:00
Stefan Berger
cc6c586f78 swtpm_cert: Fix a potential buffer overrun error
Coverity scan discovered a buffer overrun error in case the
datum->size = 0. Fix the error.

The function with the potential error is not called if datum->size == 0.

Also make the 'size' variable larger so there cannot be a overrun in
'size = datum->size + sizeof(buffer) - i'.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:46:39 -04:00
Stefan Berger
aded2b6f69 swtpm: Initialize hdrflags to 0 in case no header was read
The hdrflags need to be initialized to 0 in case no header
was read from the file.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 16:42:47 -04:00
Stefan Berger
f98592c590 git: Ignore install-sh
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 12:52:05 -04:00
Stefan Berger
a967f79d52 man: Replace bindaddress with bindaddr in swtpm man page
The swtpm man page incorrectly showed binaddress as the option parameter
for the address to bind to. It must be called bindaddr.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 12:23:22 -04:00
Stefan Berger
71d9581aa4 tests: Extend test cases with aes-256-cbc state file encryption
Extend existing test cases with aes-256-cbc state file encryption.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 12:23:22 -04:00
Stefan Berger
2e260468cb swtpm_setup: Add support for choosing the cipher
Implement command line support for choosing the cipher to use for
the TPM state encryption. Either aes-128-cbc or aes-256-cbc can be
used. The same cipher has to be passed on the swtpm command line
when using the TPM.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 11:45:44 -04:00
Stefan Berger
8ce50494c7 swtpm: Check the size of the user's key against expected size
Use the flags in the header to check the size of the provided key(s) against
the one(s) from the user. There are the state and migration keys, each has
a different flag in the header if a 256bit key was used. We display an error
about the mismatching key size against expected size if the given key is of
the wrong size.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 11:45:44 -04:00
Stefan Berger
68a5b24124 swtpm: Add support for aes-256-cbc
Extend the buffer the key is read into to hold an 256bit key.

Add support for aes-256-cbc. Also, aes-128-cbc is now a synonym for
aes-cbc.

Update the man pages to reflect the AES 128 support.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 11:45:44 -04:00
Stefan Berger
6e58cbeae2 swtpm: Extend en- and decryption functions for 256 bit keys
Enable 256 bit AES keys in the en- and decryption functions.
Set a flag in the header to at least indicate whether 128bit
or 256bit keys were used.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 11:45:44 -04:00
Stefan Berger
748df6eea9 swtpm: Prepare key parsing functions to accept 256 bit keys
Prepare the functions that parse or read the key from a file
to accept 256 bit keys.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 11:45:44 -04:00
Stefan Berger
3916364950 swtpm: Remove unnecessary fields from symmetric key structure
Remove the valid field from the symmtric key structure and
user userKeyLength > 0 instead, which is the same.

Also remove the tag and fill fields, which were originally used in
TPM 1.2.

Use function calls to test whether the file or migration key is
available where possible.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 11:45:44 -04:00
Stefan Berger
e7ba49110c swtpm: Add key length to symmetric key structure
To get rid of the hard coded AES key size of 128, we add a filed
userKeyLength that describes the length of the key being used.
We replace TPM_AES_BLOCK_SIZE with userKeyLength where possible.

Rename TPM_AES_BLOCK_SIZE to SWTPM_AES_BLOCK_SIZE.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 11:45:44 -04:00
Stefan Berger
a39f098fd6 swtpm: Use pbkdf2 as default kdf and sha512 for test cases
Use pbkdf2 as the default kdf and sha512 for the existing
test case. Do away with file limit of 32 bytes. This may
break backwards compatibility for some but better to do this
before a release...

Switch the existing test cases to use kdf=sha512 on the command
line where necessary to that the state for these test cases
does not need to be recreated.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 11:45:44 -04:00
Stefan Berger
c1c46dbafc rpm: Point RPM Source URL to github.com
Point the source URL in the rpm spec to github.com where in the future
the tar should be located.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-13 09:50:38 -04:00
Stefan Berger
dea49eb3e6 debian: Use autogen.sh
Use autogen.sh when building a Debian package.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-13 09:28:15 -04:00
Stefan Berger
8f0f381f95 scripting: Use #!/usr/bin/env bash rather than /bin/bash
On some systems /bin/bash does not exists but the bash is somewhere
else and can be invoked with /usr/bin/env bash.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-10 16:49:12 +00:00
Stefan Berger
9e786a3ae5 tests: Enable test_ctrchannel on DragonFly BSD
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-10 16:14:06 +00: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
54854cff1a swtpm_setup: Enable on DragonFly BSD
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-10 16:12:33 +00:00
Stefan Berger
f3a1b29d8b SELinux: Explicitly list policy package file dependencies
The building of rpm files fails due to some issues with the rules. To make
this work we explicily list the policy packages' dependencies and use them
in the rules. This now make 'make distcheck' work and lets us build an RPM.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-04 12:05:51 -04:00
Stefan Berger
affd80ad6d travis: use 'distcheck' rather than 'check'
To test the creation of the tar and out-of-tree builds all the time, do
'distcheck' rather than a simple 'check'.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-01 14:49:49 -04:00
Stefan Berger
c51c07a016 tests: Pass top level source dir to test cases for out-of-tree builds
Some test cases that root has to run did not pass the out-of-tree
builds. We need to pass the top level source dir to these test cases
and change some variable accessing config files to the right directory
for the out-of-tree build to work.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-01 14:49:49 -04:00
Stefan Berger
87668f53f4 SELinux: Fix Makefile.am for out-of-tree builds
Fix the Makefile.am for out-of-tree builds so that 'make distcheck'
runs without errors.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-01 14:18:23 -04: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
80f985897c tests: Implement support for OS/X (Darwin)
If the file descriptor 100 is open prior to trying to open
it, it must be closed first on OS/X, otherwise we get test
case failures due to interrupted connections.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 15:44:24 -04:00
Stefan Berger
6e552e9889 swtpm_setup: Implement support for OS/X (Darwin)
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 15:40:55 -04:00
Stefan Berger
8aff5f7665 tests: set CERTTOOL to gnutls-certtool on OS/X
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 15:40:01 -04:00
Stefan Berger
b63000fa8d samples: set CERTTOOL to gnutls-certtool on OS/X
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 15:39:00 -04:00
Stefan Berger
f13d2a045c sample: wrap flock in flock_fd for support on OS/X
OS/X has a flock (v0.2.3) implementation using

brew tap discoteq/discoteq
brew install flock

The current version doesn't support -x as a parameter for
an exclusive lock but uses an exclusive lock when no parameter
is passed at all.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 15:27:25 -04:00
Stefan Berger
bd8f4cae3a swtpm_setup: Use env var '_' to get path of program on OS/X
OS/X also does not have a proc filesystem, so we use the '_'
environment variable to determine the path of the program.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 14:59:37 -04:00
Stefan Berger
af23737e6e swtpm: Work around deprecated daemon() on OS X
The daemon() call is deprecated on OS X. This patch works around it so
that we can compiled with -Wall -Werror and still can use the daemon()
call while avoiding compiler errors due to this function's deprecation
marking in stdlib.h.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 14:22:09 -04:00
Stefan Berger
c7d22cf60a swtpm: Remove unused mainloop parameter from functions
Remove the struct mainLoopParams type of parameter from functions
where it is not needed.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 12:38:08 -04:00
Stefan Berger
1294b307b5 swtpm: Fix typo in name of header guards
OS X compiler detected a typo in the name of the header guards.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 12:33:41 -04:00