]> git.proxmox.com Git - swtpm.git/log
swtpm.git
2 years agoswtpm_bios: Use unsigned int tcp_port to filter out negative port numbers
Stefan Berger [Sat, 26 Mar 2022 02:54:21 +0000 (22:54 -0400)]
swtpm_bios: Use unsigned int tcp_port to filter out negative port numbers

The port being parsed must be given as unsigned int so that the comparison
of *tcp_port >= 65536 also filters out negative numbers passed via the
command line. Previously one could pass -1 and swtpm_bios would try to
connect.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_ioctl: Use unsigned int tcp_port to filter out negative port numbers
Stefan Berger [Sat, 26 Mar 2022 02:41:00 +0000 (22:41 -0400)]
swtpm_ioctl: Use unsigned int tcp_port to filter out negative port numbers

The port being parsed must be given as unsigned int so that the comparison
of *tcp_port >= 65536 also filters out negative numbers passed via the
command line. Previously one could pass -1 and swtpm_ioctl would try to
connect to port 65535.

Resolves: https://github.com/stefanberger/swtpm/issues/679
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agobuild-sys: Move block with CUSE-related tests after initial CUSE tests
Stefan Berger [Mon, 21 Mar 2022 19:55:29 +0000 (15:55 -0400)]
build-sys: Move block with CUSE-related tests after initial CUSE tests

Mof the block with the CUSE-related tests further up to be following the
first set of CUSE-related tests.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agobuild-sys: Show the value of with_chardev after test for chardev
Stefan Berger [Mon, 21 Mar 2022 19:55:11 +0000 (15:55 -0400)]
build-sys: Show the value of with_chardev after test for chardev

Show the value of with_chardev after the test for whether to build
with chadev rather than with_cuse.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agobuild-sys: Determine GNUTLS_LIBS using pkg-config [OS X]
Stefan Berger [Mon, 21 Mar 2022 19:55:09 +0000 (15:55 -0400)]
build-sys: Determine GNUTLS_LIBS using pkg-config [OS X]

Determine GNUTLS_LIBS using pkg-config rather than hard-coding
it. On OS X it may return a -L<path> to succeed the linking.

Resolves: https://github.com/stefanberger/swtpm/issues/676
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Do not chdir(/) when using --daemon
Stefan Berger [Thu, 3 Mar 2022 14:13:26 +0000 (09:13 -0500)]
swtpm: Do not chdir(/) when using --daemon

With relative paths being used the chdir("/") in daemonize_finish() will
cause file access errors.

Fixes: 98d1d12 ("swtpm: Make --daemon not racy")
Resolves: https://github.com/stefanberger/swtpm/issues/671
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agobuild-sys: Add probing for -fstack-protector
Stefan Berger [Wed, 2 Mar 2022 18:52:53 +0000 (13:52 -0500)]
build-sys: Add probing for -fstack-protector

Add probing for -fstack-protector to the existing
-fstack-protector-strong since not all platforms support either one
of them.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoman: Add missing .config directory to path description when using ${HOME}
Stefan Berger [Mon, 21 Feb 2022 23:58:26 +0000 (18:58 -0500)]
man: Add missing .config directory to path description when using ${HOME}

When the ${HOME} directory is used for finding swtpm_setup.conf it is
to be found in ${HOME}/.config/swtpm_setup.conf.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Resolves: https://github.com/stefanberger/swtpm/issues/664

2 years agotests: Use ${WORKDIR} in config files to test env. var replacement
Stefan Berger [Tue, 22 Feb 2022 12:46:26 +0000 (07:46 -0500)]
tests: Use ${WORKDIR} in config files to test env. var replacement

To test the replacement of environment variables with their values
use ${WORKDIR} in the test case config files.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm-localca: Re-implement variable resolution for swtpm-localca.conf
Stefan Berger [Mon, 21 Feb 2022 23:37:34 +0000 (18:37 -0500)]
swtpm-localca: Re-implement variable resolution for swtpm-localca.conf

swtpm_localca v0.5 supported resolution of environment variables for
the swtpm-localca.conf configuration file. This functionality was lost
during the port to 'C' in v0.6. This patch now re-implements it.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Resolves: https://github.com/stefanberger/swtpm/issues/663

2 years agoswtpm_localca: Test for available issuercert before creating CA
Stefan Berger [Tue, 1 Feb 2022 17:40:06 +0000 (12:40 -0500)]
swtpm_localca: Test for available issuercert before creating CA

Avoid trying to create TPM certificates while the issuer certificate has
not been created, yet (in a 2nd step).

To resolve this do not just test for availability of the signing key, which
is created first, but also test for the issuer certifcate, which is created
in a 2nd step when the local CA is created. If either one is missing,
attempt to create the CA.

Resolves: https://github.com/stefanberger/swtpm/issues/644
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Check header size indicator against expected size (CID 375869)
Stefan Berger [Wed, 16 Feb 2022 16:17:47 +0000 (11:17 -0500)]
swtpm: Check header size indicator against expected size (CID 375869)

This fix addresses Coverity issue CID 375869.

Check the header size indicated in the header of the state against the
expected size and return an error code in case the header size indicator
is different. There was only one header size so far since blobheader was
introduced, so we don't need to deal with different sizes.

Without this fix a specially craft header could have cause out-of-bounds
accesses on the byte array containing the swtpm's state.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Check for unreasonable number of PCR banks (CID 370783)
Stefan Berger [Wed, 16 Feb 2022 15:21:15 +0000 (10:21 -0500)]
swtpm_setup: Check for unreasonable number of PCR banks (CID 370783)

This fix addresses Coverity issue CID 370783.

Check for an unreasonable number of PCR banks returned from command sent
to swtpm. Limit the number of PCR banks that can be returned to '20',
which is more than enough.

Previously we may not have sanitized the variable correctly but safeguards
were in place:

Even if the 16 bit variable count was the maximum possible (0xffff) we
should be able to allocate the all_pcr_banks array of string pointers.

Safeguards to not overstep the parsed array are in place in the loop
that's entered afterwards where the count variable serves as a limit
for the loop.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Free string array in case of failure
Stefan Berger [Wed, 16 Feb 2022 15:35:14 +0000 (10:35 -0500)]
swtpm_setup: Free string array in case of failure

Free the allocated string array in case of failure.

Existing callers auto-free the array already, so there's no memory leak,
but it is better to free it in the function where it is allocated.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Cast constant to uint64_t before shifting (CID 375870)
Stefan Berger [Wed, 16 Feb 2022 15:05:30 +0000 (10:05 -0500)]
swtpm: Cast constant to uint64_t before shifting (CID 375870)

Cast the '1' to uint64_t as suggested by Coverity (CID 375870).
Since 'j' is always less than '32', the previous code was correct as
well.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: fix newline before full stop in swtpm-not-found error
наб [Thu, 25 Nov 2021 22:28:11 +0000 (23:28 +0100)]
swtpm_setup: fix newline before full stop in swtpm-not-found error

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
2 years agoMove *.conf and *.options to man5
Seunghun Han [Thu, 11 Nov 2021 02:38:22 +0000 (11:38 +0900)]
Move *.conf and *.options to man5

According to the man page sections guideline, man8 should be used
for system administration commands. So this commit moves *.conf and
*.options files to man5.

Signed-off-by: Seunghun Han <kkamagui@gmail.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Implement function reporting error when choosing unsupported TPM
Stefan Berger [Fri, 19 Nov 2021 22:35:33 +0000 (17:35 -0500)]
swtpm: Implement function reporting error when choosing unsupported TPM

Implement tpmlib_choose_tpm_version() that reports an error when an un-
supported version is chosen. Have it used by existing code where possible.

If TPM 1.2 is not supported by libtpms, the following message is now
displayed:

swtpm: Error: TPM 1.2 is not supported by libtpms.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2024583
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agobuild-sys: Bump up version to 0.8.0 at beginning of dev cycle
Stefan Berger [Sat, 20 Nov 2021 16:14:44 +0000 (11:14 -0500)]
build-sys: Bump up version to 0.8.0 at beginning of dev cycle

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agodebian/rpm: Adjust changelog for 0.7.0 release
Stefan Berger [Mon, 18 Oct 2021 19:23:42 +0000 (15:23 -0400)]
debian/rpm: Adjust changelog for 0.7.0 release

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoCHANGES: Add more documentation for changes in 0.7.0
Stefan Berger [Mon, 18 Oct 2021 19:19:57 +0000 (15:19 -0400)]
CHANGES: Add more documentation for changes in 0.7.0

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agobuild-sys: Move regex to test PCR banks into configure script
Stefan Berger [Mon, 8 Nov 2021 12:24:06 +0000 (07:24 -0500)]
build-sys: Move regex to test PCR banks into configure script

Move the regex test for the PCR banks into the configure script.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_localca: Do not assign pointer to g_strchomp result (Coverity)
Stefan Berger [Fri, 5 Nov 2021 22:05:18 +0000 (18:05 -0400)]
swtpm_localca: Do not assign pointer to g_strchomp result (Coverity)

Get rid of a Coverity complaint by not assigning the same pointer
to the result of g_strchomp() as the parameter to the function.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Do not assign pointer to g_strchomp result (Coverity)
Stefan Berger [Fri, 5 Nov 2021 22:03:39 +0000 (18:03 -0400)]
swtpm_setup: Do not assign pointer to g_strchomp result (Coverity)

Get rid of a Coverity complaint by not assigning the same pointer
to the result of g_strchomp() as the parameter to the function.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agotests: Fix expiration date check for 32 bit machines
Stefan Berger [Fri, 5 Nov 2021 19:16:43 +0000 (15:16 -0400)]
tests: Fix expiration date check for 32 bit machines

certtool on 32 bit machines seems to expire a never expiring certificate
in 2037 rather than 9999.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Fix compilation error on 32bit machines
Stefan Berger [Fri, 5 Nov 2021 19:02:05 +0000 (15:02 -0400)]
swtpm: Fix compilation error on 32bit machines

Fix the following compilation error occurring on 32bit machines:

swtpm_nvstore_linear_file.c: In function 'SWTPM_NVRAM_LinearFile_Mmap':
swtpm_nvstore_linear_file.c:58:20: error: comparison of integer expressions of different signedness: '__off_t' {aka 'long int'} and 'unsigned int' [-Werror=sign-compare]
   58 |     if (st.st_size >= (uint32_t)sizeof(struct nvram_linear_hdr)) {
      |                    ^~

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agotests: OSSL 3: Make TPM 1.2 test compile; skip IBM TSS 2 test
Stefan Berger [Fri, 5 Nov 2021 12:23:04 +0000 (08:23 -0400)]
tests: OSSL 3: Make TPM 1.2 test compile; skip IBM TSS 2 test

Add CFLAGS="-DOPENSSL_SUPPRESS_DEPRECATED=1" to the configure line
to avoid compile-time errors when building the TPM 1.2 test with
OpenSSL 3.0.

IBM TSS2 v1.6 test does not currently work with OpenSSL 3.0, so
skip it.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Add support for --reconfigure flag to change active PCR banks
Stefan Berger [Fri, 29 Oct 2021 17:04:07 +0000 (13:04 -0400)]
swtpm_setup: Add support for --reconfigure flag to change active PCR banks

Add support for --reconfigure option for the swtpm_setup to be able to
change the active PCR banks. This option only works with --tpm2 and does
not allow to pass several other options such --create-ek or
--create-ek-cert or --create-platform-cert that would alter the state of
the TPM 2 in other ways.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agotests: Support filenames with spaces in some functions
Stefan Berger [Fri, 29 Oct 2021 16:57:40 +0000 (12:57 -0400)]
tests: Support filenames with spaces in some functions

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Create flags by shifting '1'
Stefan Berger [Fri, 29 Oct 2021 15:42:27 +0000 (11:42 -0400)]
swtpm_setup: Create flags by shifting '1'

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agotests: exit with error code if mktemp fails
Stefan Berger [Tue, 2 Nov 2021 01:15:32 +0000 (21:15 -0400)]
tests: exit with error code if mktemp fails

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_localca: Replace '+' and ',' characters in VMId's
Stefan Berger [Mon, 1 Nov 2021 13:08:22 +0000 (09:08 -0400)]
swtpm_localca: Replace '+' and ',' characters in VMId's

Certain characters are not accepted by gnutls when creating the
subject with the 'CN' from the vmid, so we have to replace those
characters with another one, such as '_'.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Write active_pcr_banks into swtpm_setup.conf
Stefan Berger [Thu, 28 Oct 2021 17:04:24 +0000 (13:04 -0400)]
swtpm_setup: Write active_pcr_banks into swtpm_setup.conf

Write the active_pcr_banks into swtpm_setup.conf with the default
PCR banks from the configure script.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Get active PCR banks from swtpm_setup.conf
Stefan Berger [Thu, 28 Oct 2021 16:23:14 +0000 (12:23 -0400)]
swtpm_setup: Get active PCR banks from swtpm_setup.conf

If the user did not provide the PCR banks to activate through the command
line options, try to read it from the config file and if nothing is found
there, fall back to the DEFAULT_PCR_BANKS as set during configure time.

Move the check for the PCR banks after the access check to the
configuration file.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Move code to activate PCR banks into own function
Stefan Berger [Thu, 28 Oct 2021 15:54:20 +0000 (11:54 -0400)]
swtpm_setup: Move code to activate PCR banks into own function

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agobuild-sys: Add support for --enable-default-pcr-banks=list of PCR banks
Stefan Berger [Thu, 28 Oct 2021 15:25:31 +0000 (11:25 -0400)]
build-sys: Add support for --enable-default-pcr-banks=list of PCR banks

Add an option that allows for the configuration of the default PCR bank
to use. This was currently hard coded to sha256 and now may be passed
via this option. The fallback is still sha256. Valid PCR bank names are
sha1, sha256, sha384, and sha512. The passed list must be a comma-
separated list of the valid PCR bank names.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoman: Add version when feature was added when missing fix some others
Stefan Berger [Fri, 29 Oct 2021 17:40:12 +0000 (13:40 -0400)]
man: Add version when feature was added when missing fix some others

Add the version to items indicating when the feature was added.
Fix and unify some other ones.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup.conf: Use /usr/bin/swtpm_localca for create_certs_tool
Stefan Berger [Thu, 28 Oct 2021 18:06:29 +0000 (14:06 -0400)]
swtpm_setup.conf: Use /usr/bin/swtpm_localca for create_certs_tool

swtpm_setup.conf has traditionally pointed to
/usr/share/swtpm/swtpm-localca for create_certs_tool but since
/usr/bin/swtpm_localca is now available, have newly created
config files point to this executable instead.

Since there are possibly many swtpm_setup.conf out there pointing
to /usr/share/swtpm/swtpm-localca, we have to still install
swtm_localca there as well and package it.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Add missing sys/wait.h include (BSDs)
Stefan Berger [Wed, 27 Oct 2021 23:24:06 +0000 (19:24 -0400)]
swtpm_setup: Add missing sys/wait.h include (BSDs)

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Add missing signal.h include (BSDs)
Stefan Berger [Wed, 27 Oct 2021 23:23:10 +0000 (19:23 -0400)]
swtpm: Add missing signal.h include (BSDs)

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agotests: Convert 2 test cases to use --daemon option
Stefan Berger [Wed, 27 Oct 2021 01:38:45 +0000 (21:38 -0400)]
tests: Convert 2 test cases to use --daemon option

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agotests: Add test case for chardev for swtpm --print-states option
Stefan Berger [Wed, 27 Oct 2021 01:38:00 +0000 (21:38 -0400)]
tests: Add test case for chardev for swtpm --print-states option

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Make --daemon not racy
Nicolas Williams [Tue, 12 Oct 2021 16:58:06 +0000 (11:58 -0500)]
swtpm: Make --daemon not racy

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2 years agoswtpm_setup: Only activate SHA256 PCR bank, not SHA1 bank anymore
Stefan Berger [Fri, 22 Oct 2021 10:53:36 +0000 (06:53 -0400)]
swtpm_setup: Only activate SHA256 PCR bank, not SHA1 bank anymore

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoman: Improve the documentation of swtpm_setup's --create-config-files
Stefan Berger [Tue, 19 Oct 2021 14:00:24 +0000 (10:00 -0400)]
man: Improve the documentation of swtpm_setup's --create-config-files

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Report stderr as returned by external tool (swtpm-localcal)
Stefan Berger [Tue, 19 Oct 2021 11:10:44 +0000 (07:10 -0400)]
swtpm_setup: Report stderr as returned by external tool (swtpm-localcal)

Report the error printed out via stderr as returned by swtpm-localca for
example.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agorpm: Update spec file to also work on CentOS9-stream
Stefan Berger [Mon, 18 Oct 2021 16:06:22 +0000 (12:06 -0400)]
rpm: Update spec file to also work on CentOS9-stream

CentOS9 has no more trousers, so disable it for rhel >= 9.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agotest: Add missing _test_tpm2_file_permissions file to EXTRA_DIST
Stefan Berger [Mon, 18 Oct 2021 13:52:01 +0000 (09:52 -0400)]
test: Add missing _test_tpm2_file_permissions file to EXTRA_DIST

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agorpm/debian: Clean up packaging files
Stefan Berger [Mon, 18 Oct 2021 13:20:33 +0000 (09:20 -0400)]
rpm/debian: Clean up packaging files

- Remove unused python3-twisted and gmp-devel.
- Add back rule to package /man8/swtpm_localca.8*

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agorpm: Remove man8/swtpm_localca.8 from specfile
Stefan Berger [Mon, 18 Oct 2021 11:19:23 +0000 (07:19 -0400)]
rpm: Remove man8/swtpm_localca.8 from specfile

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Disable fsync on file & dir due to TPM timeouts (issue #597)
Stefan Berger [Fri, 15 Oct 2021 03:34:53 +0000 (23:34 -0400)]
swtpm: Disable fsync on file & dir due to TPM timeouts (issue #597)

We cannot currently fsync on the TPM's state file and the dir since this
takes too long and commands in a VM may time out. The reason for this is
that the TPM 2 code occasionally writes the permanent state out even on
commands like TPM2_PCR_Extend that must not take a long time.

See explanation for this in the libtpms PR https://github.com/stefanberger/libtpms/pull/274 .

We will re-enable this feature in 'a while' once the updated libtpms
version has been made more widely available.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Initialize variables to avoid compiler warnings
Stefan Berger [Fri, 15 Oct 2021 11:44:53 +0000 (07:44 -0400)]
swtpm_setup: Initialize variables to avoid compiler warnings

Fix issue #591 by initializing the variables swtpm_has_tpm2 and
swtpm_has_tpm12.

swtpm_setup.c:1178:31: note: 'swtpm_has_tpm2' was declared here
     gboolean swtpm_has_tpm12, swtpm_has_tpm2;
                               ^~~~~~~~~~~~~~
swtpm_setup.c:1019:5: error: 'swtpm_has_tpm12' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     printf("{ \"type\": \"swtpm_setup\", "
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            "\"features\": [ %s%s\"cmdarg-keyfile-fd\", \"cmdarg-pwdfile-fd\", \"tpm12-not-need-root\""

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Fix case when no backend URI has been specified
Stefan Berger [Tue, 12 Oct 2021 10:27:26 +0000 (06:27 -0400)]
swtpm: Fix case when no backend URI has been specified

It is possible to start swtpm with this command line even though
neither storage nor communication channels have been provided.

./src/swtpm/swtpm socket --flags not-need-init,startup-clear

Since sending a startup message to the TPM will cause it to
want to store permanent state, we have to handle the case when
no storage backend was given and therefore the backend_uri
is NULL.

Previously the above command line caused a NULL pointer exception
but now handles this case with the following output:

swtpm: SWTPM_NVRAM_Init: Missing backend URI.
swtpm: Error: Could not initialize libtpms.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Fix a forgotten endianess-conversion
Stefan Berger [Mon, 11 Oct 2021 20:20:46 +0000 (16:20 -0400)]
swtpm: Fix a forgotten endianess-conversion

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_localca: Created certificates for CAs and TPM that do not expire
Stefan Berger [Fri, 8 Oct 2021 15:19:33 +0000 (11:19 -0400)]
swtpm_localca: Created certificates for CAs and TPM that do not expire

Rather than having the CA certificates, that are created on the fly,
expire in 10 years, have them not expire at all.

Also create TPM certificates that don't expire and extend a test
case for this.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_cert: Allow passing -1 for days to get a non-expiring certificate
Stefan Berger [Fri, 8 Oct 2021 16:06:50 +0000 (12:06 -0400)]
swtpm_cert: Allow passing -1 for days to get a non-expiring certificate

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Exit with error code 1 on unknown option
Stefan Berger [Fri, 8 Oct 2021 13:35:47 +0000 (09:35 -0400)]
swtpm_setup: Exit with error code 1 on unknown option

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_localca: Exit with error code 1 on unknown option
Stefan Berger [Fri, 8 Oct 2021 13:40:55 +0000 (09:40 -0400)]
swtpm_localca: Exit with error code 1 on unknown option

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_localca: Use g_get_user_config_dir() rather than own code
Stefan Berger [Thu, 7 Oct 2021 20:00:06 +0000 (16:00 -0400)]
swtpm_localca: Use g_get_user_config_dir() rather than own code

Replace own code with g_get_user_config_dir() which makes things
a lot simpler.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Use g_get_user_config_dir() rather than own code
Stefan Berger [Thu, 7 Oct 2021 19:47:39 +0000 (15:47 -0400)]
swtpm_setup: Use g_get_user_config_dir() rather than own code

Replace own code with g_get_user_config_dir() which makes things
a lot simpler.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agotests: Add a test case for the new swtpm_setup option
Stefan Berger [Thu, 7 Oct 2021 12:41:47 +0000 (08:41 -0400)]
tests: Add a test case for the new swtpm_setup option

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agosamples: Have swtpm-create-user-config-files run swtpm_setup
Stefan Berger [Thu, 7 Oct 2021 00:18:01 +0000 (20:18 -0400)]
samples: Have swtpm-create-user-config-files run swtpm_setup

Have swtpm-create-user-config-files run swtpm_setup with the new
--create-config-files option and possible parameters.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Implement --create-user-config skip-if-exist
Stefan Berger [Thu, 7 Oct 2021 00:37:59 +0000 (20:37 -0400)]
swtpm_setup: Implement --create-user-config skip-if-exist

Implement support for skipping over creating the files
if any one of the config files already exist.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Implement option --create-config-files to create config files
Stefan Berger [Wed, 6 Oct 2021 20:58:04 +0000 (16:58 -0400)]
swtpm_setup: Implement option --create-config-files to create config files

Implement the option --create-config-files to create config files
for swtpm_setup and swtpm-localca for a user account. The files will
be created under the $XDG_CONFIG_HOME or $HOME/.config directories.

This option supports optional arguments 'overwrite' to allow overwriting
existing config files as well as the optional argument 'root' to create
config files under root's home directory. Both options can be passed
by separating them with a ','.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Move ARRAY_LEN and min #define's to swtpm_utils.h
Stefan Berger [Wed, 6 Oct 2021 17:57:38 +0000 (13:57 -0400)]
swtpm: Move ARRAY_LEN and min #define's to swtpm_utils.h

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agod/swtpm-tools postinst: create the TSS user if it does not exist
Thomas Lamprecht [Thu, 7 Oct 2021 10:14:11 +0000 (12:14 +0200)]
d/swtpm-tools postinst: create the TSS user if it does not exist

Adapted from tpm-udev [0] which handles that, but it is not really a
hard-requirement for swtpm and TSS_USER is configurable after all
(even if that is mostly used for the test system).

So, create that user and group if it does not exists to avoid errors
and failing installation.

[0]: https://salsa.debian.org/debian/tpm-udev/-/blob/master/debian/tpm-udev.postinst

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/swtpm-tools postinst: avoid trying to create/chown in non-configure steps
Thomas Lamprecht [Thu, 7 Oct 2021 10:10:43 +0000 (12:10 +0200)]
d/swtpm-tools postinst: avoid trying to create/chown in non-configure steps

configure steps should be limited to get only executed on, well
configuration, so check for that and do nothing in the remaining
commands [0] the postinst can be called with.

[0]: https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#summary-of-ways-maintainer-scripts-are-called

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodebian: downgrade trousers package dependency to recommended
Thomas Lamprecht [Thu, 7 Oct 2021 07:09:33 +0000 (09:09 +0200)]
debian: downgrade trousers package dependency to recommended

Currently `trousers` is listed as (hard) Dependency, but it does not
seems to be required for quite a few usecases, e.g., ours where we
mainly using swtpm for providing a tpm to VMs.

With trousers in Debian one gets an additional pain point: it comes
with rather dated and in some cirumstances failing by mistake init
script [0] that can throw errors when setting up during installation
and thus fail the whole installation of swtpm as Debian policy for
`Depends` hits:

> A package will not be configured unless all of the packages listed
> in its Depends field have been correctly configured
-- [1]

Declaring dependencies for things are not a hard requirement means
that a user will be required to install more dependencies than
actually needed.

Just documenting that as fact why I investigated in the
hard-requirement on trousers in the first place, not an actual
justification - it's a packaging bug after all.

So downgrade the dependency to "Suggests", as it seems a reasonable
level when checking its documented meaning:

> This is used to declare that one package may be more useful with
> one or more others. Using this field tells the packaging system and
> the user that the listed packages are related to this one and can
> perhaps enhance its usefulness, but that installing this one without
> them is perfectly reasonable.
-- [1]

[0]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895201
[1]: https://www.debian.org/doc/debian-policy/ch-relationships.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoman: Enumerate the nvram-backend-dir separately
Stefan Berger [Wed, 6 Oct 2021 22:16:04 +0000 (18:16 -0400)]
man: Enumerate the nvram-backend-dir separately

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Display the --print-states capability and document it
Stefan Berger [Wed, 6 Oct 2021 22:13:01 +0000 (18:13 -0400)]
swtpm: Display the --print-states capability and document it

Display the --print-states capability in the --print-capabilites
output as cmdarg-print-states.

Document availability in the man page.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Move gmalloc after block that may return NULL on failure v0.7.0-rc1
Stefan Berger [Tue, 5 Oct 2021 20:22:25 +0000 (16:22 -0400)]
swtpm_setup: Move gmalloc after block that may return NULL on failure

To avoid a memory leak, move the gmalloc after a block that may
return NULL on failure.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Introduce label to skip over closing of pidfile
Stefan Berger [Tue, 5 Oct 2021 20:18:25 +0000 (16:18 -0400)]
swtpm_setup: Introduce label to skip over closing of pidfile

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Call msync with length = 0 on Cygwin
Stefan Berger [Tue, 5 Oct 2021 18:29:51 +0000 (14:29 -0400)]
swtpm: Call msync with length = 0 on Cygwin

Cygwin internally uses the Windows API call FlushViewOfFile that
seems to not like to be called with an excessive number of bytes.
Instead, call it with length = 0 so that 'the file is flushed from
the base address to the end of the mapping' and then msync() succeeds.

Source:
https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-flushviewoffile

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Use SWTPM_ATTR_UNUSED on unused parameters (BSDs)
Stefan Berger [Tue, 5 Oct 2021 16:46:40 +0000 (12:46 -0400)]
swtpm_setup: Use SWTPM_ATTR_UNUSED on unused parameters (BSDs)

To silence the BSD gcc compiler on unused function parameters,
use SWTPM_ATTR_UNUSED.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Use pidfile filename rather than fd (Cygwni, BSDs)
Stefan Berger [Tue, 5 Oct 2021 16:39:49 +0000 (12:39 -0400)]
swtpm_setup: Use pidfile filename rather than fd (Cygwni, BSDs)

Use the pidfile filename rather than the fd because Cygwin for example
does not seem to support passed file descriptors and also OpenBSD
does not pass some test cases because of this.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agotests: Use /usr/bin/env bash rather than /bin/bash (BSDs)
Stefan Berger [Tue, 5 Oct 2021 16:36:48 +0000 (12:36 -0400)]
tests: Use /usr/bin/env bash rather than /bin/bash (BSDs)

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoheaders: Add defines for little endian data conversion (OS X)
Stefan Berger [Tue, 5 Oct 2021 15:37:54 +0000 (11:37 -0400)]
headers: Add defines for little endian data conversion (OS X)

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Use compiler and system dependent header files
Stefan Berger [Tue, 5 Oct 2021 15:22:24 +0000 (11:22 -0400)]
swtpm: Use compiler and system dependent header files

The header file endian.h does not exists everywhere, so we have to
use system_dependencies.h to get something similar on all systems.

Some compilers, such as gcc on FreeBSD, are picky about unused
function parameters, so we have to decorate the unused ones
with SWTPM_ATTR_UNUSED.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Use sys/mount.h and support block devs only if BLKGETSIZE64 exists
Stefan Berger [Tue, 5 Oct 2021 15:17:01 +0000 (11:17 -0400)]
swtpm: Use sys/mount.h and support block devs only if BLKGETSIZE64 exists

The header file fs/linux.h only exists on Linux but we can also
use sys/mount.h, which also exists on Cygwin and the BSDs.

Only support  block devices if BLKGETSIZE64 is defined.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: mention dir:// and file:// in man page and usage
Stefan Reiter [Thu, 30 Sep 2021 13:59:40 +0000 (15:59 +0200)]
swtpm_setup: mention dir:// and file:// in man page and usage

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
2 years agoswtpm_setup: add test case to exercise file backend
Stefan Reiter [Thu, 30 Sep 2021 09:27:14 +0000 (11:27 +0200)]
swtpm_setup: add test case to exercise file backend

heavily copy-pas^W inspired by 'test_swtpm_setup_overwrite'

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
2 years agoswtpm_setup: add file backend
Stefan Reiter [Thu, 30 Sep 2021 08:40:01 +0000 (10:40 +0200)]
swtpm_setup: add file backend

Add a second backend for supporting the file:// linear nvram store in
swtpm.

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
2 years agoswtpm_setup: add abstract swtpm_backend_ops with dir:// implementation
Stefan Reiter [Thu, 30 Sep 2021 08:03:05 +0000 (10:03 +0200)]
swtpm_setup: add abstract swtpm_backend_ops with dir:// implementation

Abstract away implementation specific code for handling TPM state in
swtpm_setup. The current code for handling directories is moved to
'swtpm_backend_dir.c'.

Where possible, the input argument is simply passed verbatim as
'backend-uri' to swtpm.

No functional change intended, aside from supporting 'dir://' as
optional prefix. The checks for lock-file accessibility are moved to
check_access(), but that shouldn't affect anything AFAICT.

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
2 years agoswtpm_setup: use mkstemp for pidfile
Stefan Reiter [Thu, 30 Sep 2021 08:17:57 +0000 (10:17 +0200)]
swtpm_setup: use mkstemp for pidfile

This avoids issues with state backends where we don't have a convenient
directory for a pidfile available.

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
2 years agoswtpm_setup: remove redundant delete_state function
Stefan Reiter [Thu, 30 Sep 2021 07:30:45 +0000 (09:30 +0200)]
swtpm_setup: remove redundant delete_state function

...and use delete_swtpm_statefiles instead. This function iterates the
folder instead of just deleting one file, but since it is already called
before the init call guarded here, it can only affect files created by
this run anyway.

Note that delete_state had slightly different return semantics, but it
doesn't matter, as the return value is ignored here anyway (best effort
cleanup).

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
2 years agoswtpm: Add "nvram-backend-linear" capability
Stefan Reiter [Thu, 5 Aug 2021 12:22:46 +0000 (14:22 +0200)]
swtpm: Add "nvram-backend-linear" capability

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
2 years agoswtpm: Add "file://" backend to man page
Stefan Reiter [Thu, 5 Aug 2021 12:18:09 +0000 (14:18 +0200)]
swtpm: Add "file://" backend to man page

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
2 years agoswtpm: Add tests for "linear file" backend
Stefan Reiter [Thu, 5 Aug 2021 12:14:15 +0000 (14:14 +0200)]
swtpm: Add tests for "linear file" backend

Adapt save_load_state tests to include coverage of the "linear file"
backend mode. "tpm2" is save/load is tested with both a regular file and
a loop device to excercise the blockdev mmap code.

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
2 years agoswtpm: Add "linear file" nvram store backend
Stefan Reiter [Thu, 5 Aug 2021 12:09:55 +0000 (14:09 +0200)]
swtpm: Add "linear file" nvram store backend

Implements a second abstraction layer as an NVRAM storage backend: The
"linear" backend stores data in a simple format that can contain
multiple files (multiple TPM states and numbers) in one linear address
space. This can then be mapped to files or other "block-device-like"
interfaces using nvram_linear_file_ops implementations.

A simple one using mmap is provided with the URI type "file://".

Does not support any locking at the moment, users must ensure exclusive
access themselves.

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
2 years agotests: Skip TPM 2 pkcs11-related test when ASAN is used
Stefan Berger [Mon, 4 Oct 2021 22:07:43 +0000 (18:07 -0400)]
tests: Skip TPM 2 pkcs11-related test when ASAN is used

The key is freed using 'gnutls_privkey_deinit(pkcs11key)', yet the
following memory leaks show up that are most likely in the pkcs11 module.
Skip the test if ASAN is being used to avoid the test failure.

Direct leak of 55080 byte(s) in 1 object(s) allocated from:
    #0 0x7fdabb152af7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7fdab6b737c6 in C_Initialize (/usr/lib64/pkcs11/libtpm2_pkcs11.so+0x147c6)
    #2 0x7fdab9a5f8a9 in initialize_module_inlock_reentrant (/lib64/libp11-kit.so.0+0x2b8a9)
    #3 0x7fdab9a5fc88 in managed_C_Initialize (/lib64/libp11-kit.so.0+0x2bc88)
    #4 0x7fdab9a66018 in p11_kit_modules_initialize (/lib64/libp11-kit.so.0+0x32018)
    #5 0x7fdab9a66778 in p11_kit_modules_load_and_initialize (/lib64/libp11-kit.so.0+0x32778)
    #6 0x7fdabab10dc5 in auto_load (/lib64/libgnutls.so.30+0x9cdc5)
    #7 0x7fdabab12656 in gnutls_pkcs11_init (/lib64/libgnutls.so.30+0x9e656)
    #8 0x7fdabab12779 in _gnutls_pkcs11_check_init (/lib64/libgnutls.so.30+0x9e779)
    #9 0x7fdabab1af1f in gnutls_pkcs11_privkey_import_url (/lib64/libgnutls.so.30+0xa6f1f)
    #10 0x7fdabaaee0e3 in gnutls_privkey_import_url (/lib64/libgnutls.so.30+0x7a0e3)
    #11 0x40abee in main /home/stefanb/dev/swtpm/src/swtpm_cert/ek-cert.c:1399
    #12 0x7fdab9f5ab74 in __libc_start_main (/lib64/libc.so.6+0x27b74)
    #13 0x40366d in _start (/home/stefanb/dev/swtpm/src/swtpm_cert/swtpm_cert+0x40366d)

Indirect leak of 8208 byte(s) in 1 object(s) allocated from:
    #0 0x7fdabb152af7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7fdab6b736f9 in C_Initialize (/usr/lib64/pkcs11/libtpm2_pkcs11.so+0x146f9)
    #2 0x7fdab9a5f8a9 in initialize_module_inlock_reentrant (/lib64/libp11-kit.so.0+0x2b8a9)
    #3 0x7fdab9a5fc88 in managed_C_Initialize (/lib64/libp11-kit.so.0+0x2bc88)
    #4 0x7fdab9a66018 in p11_kit_modules_initialize (/lib64/libp11-kit.so.0+0x32018)
    #5 0x7fdab9a66778 in p11_kit_modules_load_and_initialize (/lib64/libp11-kit.so.0+0x32778)
    #6 0x7fdabab10dc5 in auto_load (/lib64/libgnutls.so.30+0x9cdc5)
    #7 0x7fdabab12656 in gnutls_pkcs11_init (/lib64/libgnutls.so.30+0x9e656)
    #8 0x7fdabab12779 in _gnutls_pkcs11_check_init (/lib64/libgnutls.so.30+0x9e779)
    #9 0x7fdabab1af1f in gnutls_pkcs11_privkey_import_url (/lib64/libgnutls.so.30+0xa6f1f)
    #10 0x7fdabaaee0e3 in gnutls_privkey_import_url (/lib64/libgnutls.so.30+0x7a0e3)
    #11 0x40abee in main /home/stefanb/dev/swtpm/src/swtpm_cert/ek-cert.c:1399
    #12 0x7fdab9f5ab74 in __libc_start_main (/lib64/libc.so.6+0x27b74)
    #13 0x40366d in _start (/home/stefanb/dev/swtpm/src/swtpm_cert/swtpm_cert+0x40366d)

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Make fsync-related errors non-fatal (for libvirt using AppArmor)
Stefan Berger [Fri, 1 Oct 2021 20:50:07 +0000 (16:50 -0400)]
swtpm: Make fsync-related errors non-fatal (for libvirt using AppArmor)

Only recent libvirt versions have the patch for the AppArmor profile for
libvirt to allow fsync after opening a directory for reading. Rather
than failing hard on the open-directory-for-reading error, log it once
and continue and do not try it again after.

This patch addresses the problems seen on Ubuntu related to an older
version of libvirt without the AppArmor profile update.
- issue #484
- issue #549
- issue #559

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoRevert "swtpm: Make fsync() errors non-fatal (for libvirt using AppArmor)"
Stefan Berger [Fri, 1 Oct 2021 20:43:18 +0000 (16:43 -0400)]
Revert "swtpm: Make fsync() errors non-fatal (for libvirt using AppArmor)"

This reverts commit 04cb07fa6c02afdf16c1adb4b5c202d93c6b190c.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoUpdate bug_report.md
Stefan Berger [Sat, 2 Oct 2021 15:18:02 +0000 (11:18 -0400)]
Update bug_report.md

Ask users to include log files, such as libvirt log files.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm: Make fsync() errors non-fatal (for libvirt using AppArmor)
Stefan Berger [Fri, 1 Oct 2021 13:18:58 +0000 (09:18 -0400)]
swtpm: Make fsync() errors non-fatal (for libvirt using AppArmor)

Only recent libvirt versions have the patch for the AppArmor profile
for libvirt to allow fsync on dir and directory. Rather than failing
hard on this error, log it once and continue and do not try fsync
again after.

This patch addresses the problems seen on Ubuntu related to an older
version of libvirt without the AppArmor profile update.
- issue #484
- issue #549
- issue #559

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Fix errno comparison on end-of-directory (FreeBSD)
Stefan Berger [Thu, 30 Sep 2021 17:40:26 +0000 (13:40 -0400)]
swtpm_setup: Fix errno comparison on end-of-directory (FreeBSD)

FreeBSD may return errno EINVAL beside ENOENT once there are no more
entries in a directory to walk over. It claims that readdir() follows
the getdirentries() return codes, which do include EINVAL but not
ENOENT. But ENOENT is also being used.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_localca: Fix memory leak on arrays of strings
Stefan Berger [Wed, 29 Sep 2021 23:58:56 +0000 (19:58 -0400)]
swtpm_localca: Fix memory leak on arrays of strings

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_localca: Use return from main rather than exit to resolve ASAN issue
Stefan Berger [Wed, 29 Sep 2021 23:20:32 +0000 (19:20 -0400)]
swtpm_localca: Use return from main rather than exit to resolve ASAN issue

Use return rather than exit() when returning from main so that g_autofree'd
variables can be freed.

This resolves issue #568 that occurs with clang only.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_setup: Use return from main rather than exit to resolve ASAN issue
Stefan Berger [Wed, 29 Sep 2021 23:17:59 +0000 (19:17 -0400)]
swtpm_setup: Use return from main rather than exit to resolve ASAN issue

Use return rather than exit() when returning from main so that g_autofree'd
variables can be freed.

This resolves issue #568 that occurs with clang only.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agotests: Use nm and grep to check for ASAN
Stefan Berger [Wed, 29 Sep 2021 16:35:58 +0000 (12:35 -0400)]
tests: Use nm and grep to check for ASAN

clang doesn't link executables built with ASAN support to libasan, like
gcc does, so we have to use nm rather than ldd for checking for whether
the executable was built with ASAN. nm is part of the binutils package
and should be available on all systems where gcc was installed.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2 years agoswtpm_localca: Fix a TPM 1.2/TCSD related memory leak
Stefan Berger [Wed, 29 Sep 2021 15:55:39 +0000 (11:55 -0400)]
swtpm_localca: Fix a TPM 1.2/TCSD related memory leak

Auto-free the variables used for holding values read from the config
file.

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