Commit Graph

926 Commits

Author SHA1 Message Date
Tomasz Kłoczko
6d78f7fff2 build-sys: Call autoupdate and fix some resulting issues
autoreconf from autoconf 2.71 emmits a lot of warnings:

+ autoreconf -fiv
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: aclocal --force -I m4
autoreconf: running: /usr/bin/autoconf --force
configure.ac:29: warning: The macro `AC_CONFIG_HEADER' is obsolete.
configure.ac:29: You should run autoupdate.
./lib/autoconf/status.m4:719: AC_CONFIG_HEADER is expanded from...
configure.ac:29: the top level
configure.ac:53: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:53: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:53: the top level
configure.ac:76: warning: The macro `AC_HEADER_STDC' is obsolete.
configure.ac:76: You should run autoupdate.
./lib/autoconf/headers.m4:704: AC_HEADER_STDC is expanded from...
configure.ac:76: the top level
configure.ac:81: warning: The macro `AC_TYPE_SIGNAL' is obsolete.
configure.ac:81: You should run autoupdate.
./lib/autoconf/types.m4:776: AC_TYPE_SIGNAL is expanded from...
configure.ac:81: the top level
configure.ac:202: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:202: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:202: the top level
configure.ac:267: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:267: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:267: the top level
configure.ac:430: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:430: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:430: the top level
configure.ac:437: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:437: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:437: the top level
configure.ac:517: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:517: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:517: the top level
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:40: installing './compile'
configure.ac:48: installing './missing'
Makefile.am:34: warning: .PHONY was already defined in condition WITH_SELINUX, which is included in condition TRUE ...
Makefile.am:28: ... '.PHONY' previously defined here
src/swtpm/Makefile.am: installing './depcomp'
autoreconf: './config.sub' is updated
autoreconf: './config.guess' is updated
autoreconf: Leaving directory '.'

Execute autoupdate to apply all those changes.

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-23 22:40:08 -04:00
Stefan Berger
a0e5d1572d tests: Allow volatile state file >= 9000 bytes in test_tpm2_migration_key
Changes to libtpms will require that the volatile state files
during this test may be larger than 9000 bytes.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-05-13 16:34:36 -04:00
Stefan Berger
3919bf09c8 samples: Apply password for signing key when creating platform cert (bugfix)
Apply the password for the signing key and parent key when creating a
platform certificate. The bug was introduced in commit 961bb827
"samples: Use new pwd format option for secretly passing passwords"

Extend a test case to ensure that the passwords are always used.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-16 12:36:15 -04:00
Stefan Berger
2778103901 samples: Properly apply passwords for localca signing key (bugfix)
When the local CA was create the signing key of the intermediate CA
was not properly protected by the passwords. This patch fixes this.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-16 12:36:15 -04:00
Stefan Berger
749cc2249c swtpm: Change include of sys/fcntl.h to fcntl.h
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-16 13:38:07 -04:00
Stefan Berger
80f04180f2 rpm/debian: Add 0.3.4-1 entry to changelog
Also add missing 0.3.3-1 entries.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-11 15:14:19 -04:00
Stefan Berger
a9c9bc05b9 CHANGES: Updated CHANGES document for 0.3.4
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-11 15:14:19 -04:00
Stefan Berger
63bf151a6e swtpm: Address cygwin compilation warning
Compilation on cygwin reports the following issue:

In file included from key.c:43:
key.c: In function ‘key_stream_to_bin’:
key.c:135:26: error: array subscript has type ‘char’ [-Werror=char-subscripts]
  135 |            !isspace(input[digits]) &&
      |                     ~~~~~^~~~~~~~
key.c:143:40: error: array subscript has type ‘char’ [-Werror=char-subscripts]
  143 |     if (input[digits] && !isspace(input[digits]))
      |                                   ~~~~~^~~~~~~~

Address the issue using an explicit cast of char to int.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-11 15:14:19 -04:00
Stefan Berger
0583f4566e swtpm_setup: Get rid of eval when calling external tool (swtpm-localca)
Get rid of using eval when calling $create_certs_tool and only use
eval for resolving variables from the config file.

We only want variable substitution for entries from configuration
files, so escape all other special shell characters that may be
making it onto the command line so that no subshells are opened
and no redirection to files can occurr.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-11 15:14:19 -04:00
Stefan Berger
140d8c0348 tests: Extend swtpm-localca test with odd vmid strings
Extend the swtpm-localca test with odd vmid string to ensure
that they go into the certificate unmodified.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-11 15:14:19 -04:00
Stefan Berger
7e8909880e samples: Get rid of using eval when running swtpm_cert
Get rid of using eval when running swtpm_cert in swtpm-localca.
This is to avoid further evaluation of bash expression that can
spawn subshells ('$(echo foo)') or do other bad things. Bad input
could come from malformed configuration files.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-11 15:14:19 -04:00
Stefan Berger
5a3520f1f8 samples: Escape many more characters before calling eval on an entry
Escape many more special shell characters before calling eval on
an entry to convert a variable to its value. Uncareful writing of
a swtpm-local.conf config file could have lead to files being over-
written using '>' for example.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-11 15:14:19 -04:00
Stefan Berger
a2666e085d build-sys: build swtpm-0.3.4
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-11 15:14:19 -04:00
Stefan Berger
413168bb35 tests: Assign unique ports 65452/65453 to test_tpm2_save_load_state
Assign the unique port 65452/65354 to test_tpm2_save_load_state to
avoid conflict with test_tpm_probe also using

SWTPM_SERVER_PORT=65526
SWTPM_CTRL_PORT=65527

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-06 17:22:41 -04:00
Stefan Berger
978d60fed0 tests: Assign unique ports 65448/65449 to test_tpm2_setbuffersize
Assign unique ports 65448/65449 to test_tpm2_setbuffersize to avoid clash
with test_samples_create_tpmca using TCSD_LISTEN_PORT=65436.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-06 17:22:41 -04:00
Stefan Berger
823f821b37 tests: Modify sample key to be 2048 bit rather than only 2033 bit
The generated sample keys started with 00010203, thus leaving the upper
15 bits of the key as '0', which in turn causes gnutls to think that the
key is only 2033 bit long, thus rejecting certificate verification once
the min-verification-profile is set to 'medium' in gnutls's config file
in /etc/crypto-policies/back-ends/gnutls.config.

We now create sample keys starting with 800102, which sets the highest bit.

This fixes test errors on Fedora Rawhide due to the change in the
min-verification-profile setting in gnutls.config.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-31 15:57:40 -04:00
Stefan Berger
091be8054b CHANGES: Updated CHANGES document for 0.3.3
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-27 15:13:14 -04:00
Stefan Berger
17df9f9dff build-sys: Check whether tss user and group are available
This is a backport of patch aa88eeb.

If the tcsd (trousers) is available, TPM 1.2 support should work as well.
Typically the tss user and group should be defined at this point, but
this may not always be the case, so make sure that this user and group
are available on the system.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-27 15:13:14 -04:00
Stefan Berger
1f2fc8055a swtpm_setup: Only change file and directory ownership if needed
This is a backport of patch b71a228.

Change the file and directory ownership of tcsd related files only if it
is absolutely needed. It is not needed if we are running as user TCSD_USER
in group TCSD_GROUP because then the files were created with the needed
owner and group. This avoids problems when trying to change file ownership
when invoked by libvirt where we do not have the capabilities to change
file ownership even as root.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-27 15:13:14 -04:00
Stefan Berger
0d08b73218 swtpm_setup: Allow group read-rights on $TCSD_CONFIG file if tss user != tss group
This is a backport of patch 0d9d33d.

When the TSS_USER != TSS_GROUP, e.g., user 'root' and group 'tss', then
tcsd requires that the access mode bits on the $TCSD_CONFIG file are set
to 0640, otherwise we get this error:

TCSD ERROR: TCSD config file (/tmp/tmp.Yd4LIF7mCE) must be mode 0640

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-27 15:13:14 -04:00
Stefan Berger
cef0d1b900 swtpm_setup: log errors from tcsd in logfile
This is a backport of patch 9d8d6d0.

Redirect stdout and stderr from tcsd into a file and if tcsd reported
an error copy the error into the logfile. This makes debugging tcsd
related issues, such as ownership or access mode issues, easier.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-27 15:13:14 -04:00
Stefan Berger
1747f7e6a5 build-sys: build swtpm-0.3.3
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-27 15:13:14 -04:00
Stefan Berger
8a9f56082e build-sys: Explicitly link libswtpm_libtpms with -lcrypto (Gentoo)
This patch fixes the following linker issue reported for Gentoo in
issue #280.

ld.lld: error: /var/tmp/portage/app-crypt/swtpm-0.3.1-r1/work/swtpm-0.3.1/src/swtpm/.libs/libswtpm_libtpms.so: undefined reference to EVP_sha512
ld.lld: error: /var/tmp/portage/app-crypt/swtpm-0.3.1-r1/work/swtpm-0.3.1/src/swtpm/.libs/libswtpm_libtpms.so: undefined reference to PKCS5_PBKDF2_HMAC
ld.lld: error: /var/tmp/portage/app-crypt/swtpm-0.3.1-r1/work/swtpm-0.3.1/src/swtpm/.libs/libswtpm_libtpms.so: undefined reference to SHA512

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-22 08:37:06 -04:00
Stefan Berger
a1939951ed build-sys: Use AC_COMPILE_IFELSE to check for unused linker flags (clang)
This patch fixes a clang issue report in issue #280.

clang does not use ld, so we cannot grep for support of certain linker
flags but have to test-compile.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-22 08:37:06 -04:00
Stefan Berger
81ee8aa658 debian: Address some issues raised by lintian
Remove swtpm_cuse related install script since not needed anymore.

Also address the following issue:

E: swtpm-tools: unknown-control-interpreter control/postinst #!/usr/bin/env

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-09 16:49:56 -04:00
Stefan Berger
cff6a44572 rpm/debian: Add 0.3.2-1 entry to changelog
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-09 16:49:56 -04:00
Stefan Berger
c31b1e6569 CHANGES: Updated CHANGES document for 0.3.1 and 0.3.2
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-09 16:49:56 -04:00
Stefan Berger
211800f1b5 tests: Adapt test cases' expected PCR result due to libtpms TPM 2 fix
libtpms version 0.6.3, 0.7.3, and master have a change to the TPM 2 code
that affects the pcrUpdateCounter, which now returns a smaller value than
before.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-06-29 10:07:28 -04:00
Stefan Berger
9f2c3b69e1 build-sys: build swtpm-0.3.2
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-06-29 10:07:28 -04:00
Stefan Berger
8eff9bb522 swtpm_setup: bugfix: Create ECC storage primary key in owner hierarchy
The ECC storage primary key was mistakently created in the endorsement
hierarchy but should be in the owner hierarchy. This patch corrects this
to have this key created in the owner hierarchy (like the RSA key),
thus using 0x40 00 00 01.

This only mattered if one used --create-spk and --ecc together.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-05-01 15:57:30 -04:00
Stefan Berger
5f4e9ea75f swtpm_setup: bugfix: remove tpm2_stirrandom and tpm2_changeeps
Remove tpm2_stirrandom, which we should not need to run on a newly
created TPM 2.
Also remove tpm2_changeeps which was called twice when creating two
EKs, thus invalidating a previous EK that may have been created.

An issue was that when using --ecc with --create-spk, the persisted
storage primary key disappeared due to the changeeps.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-05-01 15:57:30 -04:00
Stefan Berger
2eff2690c1 swtpm: Make coverity happy by handling default case in case statement
Handle the default cases, which shouldn't ever be reachable, and set
the tocopy to '0' so that no unitialized variable gets copied.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-26 17:24:17 -04:00
Stefan Berger
bf2b87de36 tests: Repeat download of TPM 1.2 test suite with random wait intervals
Sometimes the download of the TPM 1.2 test suite from sourceforge
fails. So retry up to 3 times and wait a random seconds in the interval
of [3..10] before retrying.

Check the hash of the file we downloaded to make sure we get what we
expected.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-26 17:24:17 -04:00
Stefan Berger
dd27cd6375 swtpm: Remove unnecessary #include <seccomp.h> (fixes SuSE build)
It's not necessary anymore to #include <seccomp.h> from the main programs.
Once removed, it also fixes the build on SuSE where seccomp.h is in
seccomp/seccomp.h and we didn't use the LIBSECCOMP_CFLAGS for swtpm.c etc.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-26 17:24:17 -04:00
Stefan Berger
7630424932 RPM: Update gitcommit for a useful 0.3.1 checkout
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-03-30 09:01:25 -04:00
Stefan Berger
7b30a547ee Debian: Adjust changelog for 0.3.1 release
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-03-30 08:33:16 -04:00
Stefan Berger
c5f2974ca6 Travis: Checkout a certain libtpms revision
Allow specifying a libtpms revision to test with, defaulting to
master branch.

Have the OS X test use the stable-0.6.0 branch.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-03-18 17:42:22 -04:00
Stefan Berger
340d22b5c4 swtpm: Fix vtpm proxy case without startup flags
'swtpm chardev --vptm-proxy' currently requires a '--flag startup-xyz'
to be passed since otherwise the need_init_cmd variable would not be
set to false and swtpm would terminate after sending the startup
command. To maintain backwards compatibility we have to always
set the need_init_cmd variable to false for the --vtpm-proxy case
and must not require a startup flag to be passed.

Roll back one of the test case to not use the startup flag.

Fixes: e6bc4bdf0 ('swtpm: Enable sending startup commands ...')
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-03-07 09:09:11 -05:00
Stefan Berger
451735a5da tests: Skip test 4 of derived keys in case an allowed error is encounterd
libtpms may not support TDES, so we have to skip test case 4 in
case we encounter an allowed error message.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-26 10:15:54 -05:00
Stefan Berger
74ae43bd8e RPM: Update gitcommit for a useful 0.3.0 checkout
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-17 13:58:03 -05:00
Stefan Berger
3b269659df Travis: Run make check with VERBOSE=1
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-17 13:58:03 -05:00
Stefan Berger
38f36f30e3 Debian: Adjust changelog for 0.3.0 release
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-17 12:11:31 -05:00
Stefan Berger
27d3fc877b Debian: Remove CUSE TPM from build and adjust rules file
Remove the CUSE TPM from the build and adjust the rules file
so that the build works on Ubuntu servers for example.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-17 12:11:31 -05:00
Stefan Berger
9c72780580 RPM: Adjust changelog for 0.3.0 release
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-17 12:11:31 -05:00
Stefan Berger
2e187bc299 build-sys: Set version to 0.3.0 for next release
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-17 12:11:31 -05:00
Stefan Berger
16952a5fdc CHANGES: Add documentation for changes in 0.3.0
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-17 12:11:31 -05:00
Stefan Berger
d1083d1164 swtpm: Only call memcpy if tocopy != 0 (coverity)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-14 09:53:32 -05:00
Stefan Berger
195353de60 tests: Skip swtpm_cert --print-capabilities test if not compiled
If swtpm_cert is not compiled, do not attempt the --print-capabilities
test.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-13 20:38:48 -05:00
Stefan Berger
695274e024 tests: Adjust tests to use new startup options
Adjust the vtpm proxy test case and others to make use of the new
startup options. Make sure that subsequent Startups sent to the
TPM fail with the expected error code.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-08 18:19:08 -05:00
Stefan Berger
041a70e7b0 man: Document new startup options and capabilities advertisement
Add documentation about the new startup options support as well
as the new capability and its meaning.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-08 18:19:08 -05:00