]> git.proxmox.com Git - swtpm.git/log
swtpm.git
3 years agobuild-sys: Add -Wno-deprecated-declarations to default CFLAGS (OSSL 3)
Stefan Berger [Wed, 15 Sep 2021 15:34:02 +0000 (11:34 -0400)]
build-sys: Add -Wno-deprecated-declarations to default CFLAGS (OSSL 3)

To be able to build with OpenSSL 3.0 we need to added
-Wno-deprecated-declarations to the default CFLAGS.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm: Fix SWTPM_NVRAM_PrintJson() error handling logic
Eiichi Tsukata [Thu, 9 Sep 2021 06:10:11 +0000 (15:10 +0900)]
swtpm: Fix SWTPM_NVRAM_PrintJson() error handling logic

Return -1 when SWTPM_NVRAM_GetFilenameForName() or
SWTPM_NVRAM_Init() fails.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm: Rename SWTPM_NVRAM_Print_Json()
Eiichi Tsukata [Thu, 9 Sep 2021 06:08:52 +0000 (15:08 +0900)]
swtpm: Rename SWTPM_NVRAM_Print_Json()

Rename that to SWTPM_NVRAM_PrintJson() to conform the existing function
naming rule.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agotests: Fix test_tpm2_print_states
Eiichi Tsukata [Thu, 9 Sep 2021 06:07:01 +0000 (15:07 +0900)]
tests: Fix test_tpm2_print_states

Currently it's wrongly running _test_print_states.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm_setup: Use --print-states in check_state_overwrite()
Eiichi Tsukata [Fri, 27 Aug 2021 00:24:41 +0000 (09:24 +0900)]
swtpm_setup: Use --print-states in check_state_overwrite()

Instead of directly accessing TPM state store file, use --print-states
to check if there is existing state file or not. This can reduce TPM
state directory dependencies of swtpm_setup.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm: Add --print-states for reporting TPM states status
Eiichi Tsukata [Fri, 27 Aug 2021 00:22:19 +0000 (09:22 +0900)]
swtpm: Add --print-states for reporting TPM states status

--print-states reports TPM states stored in --tpmstate backend.
This feature is supposed to be used by swtpm_setup for checking TPM state
existence.

Sample output is as follows:

  $ swtpm socket --print-states --tpmstate dir=/tmp --tpm2 | jq .
  {
    "type": "swtpm",
    "states": [
      {
        "name": "tpm2-00.permall"
      }
    ]
  }

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm: Add GetFilepathForName()
Eiichi Tsukata [Mon, 23 Aug 2021 07:34:14 +0000 (16:34 +0900)]
swtpm: Add GetFilepathForName()

Introduce GetFilepathForName() and use it to get a rooted state file
path instead of existing GetFilenameForName().
Move GetFilenameForName() to swtpm_nvstore.c so that other TPM state
store backend can use it.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm_setup: Add tests for --overwrite options
Eiichi Tsukata [Tue, 17 Aug 2021 05:13:40 +0000 (14:13 +0900)]
swtpm_setup: Add tests for --overwrite options

The tests for the following options:
- with "--overwrite"
- with "--not-overwrite"
- without "--overwrite" nor "--not-overwrite"

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm_setup: Use temp dir for certs instead of TPM state dir
Eiichi Tsukata [Thu, 12 Aug 2021 06:19:40 +0000 (15:19 +0900)]
swtpm_setup: Use temp dir for certs instead of TPM state dir

Currently swtpm_setup saves ek.cert and platform.cert to TPM state
directory and removes them later. As the usage of these files are
temporary, temp directory can be used for this purpose. This reduces
dependencies on TPM state dir, which is convenient for pluggable state
store (https://github.com/stefanberger/swtpm/issues/461).

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agotests: Skip chardev related tests after checking for chardev support
Stefan Berger [Sat, 14 Aug 2021 18:18:37 +0000 (14:18 -0400)]
tests: Skip chardev related tests after checking for chardev support

Skip tests that require the chardev after checking for the chardev
interface support in swtpm. Remove the conditional addition of chardev
related tests from the Makefile.am.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm: Add missing braces around TPM_DEBUG after if statement
Stefan Berger [Fri, 13 Aug 2021 19:52:15 +0000 (15:52 -0400)]
swtpm: Add missing braces around TPM_DEBUG after if statement

Fix the following compilation issue:

swtpm_nvstore_dir.c: In function 'SWTPM_NVRAM_Validate_Dir':
swtpm_nvstore_dir.c:149:86: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
         TPM_DEBUG("SWTPM_NVRAM_Validate_Dir: Rooted state path %s\n", tpm_state_path);
                                                                                      ^
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm: Allow sched_setattr in seccomp profile for CUSE TPM
Stefan Berger [Fri, 13 Aug 2021 13:51:21 +0000 (09:51 -0400)]
swtpm: Allow sched_setattr in seccomp profile for CUSE TPM

glib's (v2.68) g_thread_pool_new() calls the syscall sched_setattr(),
which we must allow to avoid termination of the CUSE TPM.

This patch resolves issue #520.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm: Clear keys on heap at termination
Stefan Berger [Fri, 13 Aug 2021 13:08:11 +0000 (09:08 -0400)]
swtpm: Clear keys on heap at termination

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm: Wipe out key to ensure it is not left on the stack
Eiichi Tsukata [Thu, 12 Aug 2021 07:27:27 +0000 (16:27 +0900)]
swtpm: Wipe out key to ensure it is not left on the stack

This change is conforming to the following SEI CERT recommendation.

MEM03-C. Clear sensitive information stored in reusable resources:
https://wiki.sei.cmu.edu/confluence/display/c/MEM03-C.+Clear+sensitive+information+stored+in+reusable+resources

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm: Add "nvram-backend-dir" capability
Eiichi Tsukata [Tue, 27 Jul 2021 01:22:17 +0000 (10:22 +0900)]
swtpm: Add "nvram-backend-dir" capability

Append "nvram-backend-dir" to --print-capabilities output.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm: Add options for pluggable backend (--tpmstate backend-uri)
Eiichi Tsukata [Wed, 14 Jul 2021 07:02:07 +0000 (16:02 +0900)]
swtpm: Add options for pluggable backend (--tpmstate backend-uri)

Add an options to specify pluggable backend URI.

Ex:
  --tpmstate backend-uri=dir://<path_to_dir>

Backend URI is specific to each backend plugin which points to the
location of the NVRAM files.
Currently, "dir" is the only one available backend. In this case
backend-uri should be a path to the directory where files are stored.

This option is designed to compatible with existing "dir" option.
If "dir" is specified, swtpm prioritize "dir" ignoring "backend-uri".

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm: Abstract NVRAM interface for pluggable state store
Eiichi Tsukata [Fri, 25 Jun 2021 02:29:44 +0000 (11:29 +0900)]
swtpm: Abstract NVRAM interface for pluggable state store

Related GH issue: https://github.com/stefanberger/swtpm/issues/461

This patch adds an abstraction layer to NVRAM state store implementation
for pluggable storage backends. No functional changes are intended in
this change. The default state store backend ("dir backend") keeps
current behavior.

To make swtpm ready for pluggable store, this patch moves file related
operations to the seperate file (swtpm_nvstore_dir.c) and defined the
interface for plugins (nvram_backend_ops in swtpm_nvstore.h). The
interface can be used by each plugin which will be added later.

With the interface, each plugin can access its "backend_uri" which
points to the location of the backend storage, for example S3 bucket
URL or iSCSI URL, and decide how it stores TPM state data.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm_setup: Add support for checking for TPM 1.2 and TPM 2 support
Stefan Berger [Mon, 9 Aug 2021 21:09:02 +0000 (17:09 -0400)]
swtpm_setup: Add support for checking for TPM 1.2 and TPM 2 support

Implement get_supported_tpm_versions to get swtpm's support for TPM 1.2
and TPM 2 and use it error out in case user choose a TPM version that
is not supported. Also display the supported TPM versions in the
capabilites JSON.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_setup: Make error message better when swtpm is not an exectuable
Stefan Berger [Tue, 10 Aug 2021 11:24:44 +0000 (07:24 -0400)]
swtpm_setup: Make error message better when swtpm is not an exectuable

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agotests: Fix test case number in case of test being skipped
Stefan Berger [Tue, 10 Aug 2021 11:26:35 +0000 (07:26 -0400)]
tests: Fix test case number in case of test being skipped

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoman: update man pages with new capabilities
Marc-André Lureau [Mon, 9 Aug 2021 19:43:22 +0000 (23:43 +0400)]
man: update man pages with new capabilities

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoswtpm*: report 'version' in --print-capabilities
Marc-André Lureau [Mon, 9 Aug 2021 13:46:16 +0000 (17:46 +0400)]
swtpm*: report 'version' in --print-capabilities

The "version" field can be used to decide when capabilities are
supported/reported and give some library build details.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agotests: test for availability of TPM 2.0 support in swtpm
Marc-André Lureau [Sat, 7 Aug 2021 17:36:42 +0000 (13:36 -0400)]
tests: test for availability of TPM 2.0 support in swtpm

Skip test cases for TPM 2.0 if TPM 2.0 support is not provided by swtpm.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agotests: test for availability of TPM 1.2 support in swtpm
Stefan Berger [Mon, 9 Aug 2021 12:10:07 +0000 (08:10 -0400)]
tests: test for availability of TPM 1.2 support in swtpm

Skip test cases for TPM 1.2 if TPM 1.2 support is not provided by swtpm.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
[ skip more tests ]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoswtpm: report 'tpm-1.2' & 'tpm-2.0' in --print-capabilities
Marc-André Lureau [Fri, 6 Aug 2021 15:13:18 +0000 (19:13 +0400)]
swtpm: report 'tpm-1.2' & 'tpm-2.0' in --print-capabilities

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoswtpm: ignore failure to choose version for --print-capabilities
Marc-André Lureau [Fri, 6 Aug 2021 13:32:17 +0000 (17:32 +0400)]
swtpm: ignore failure to choose version for --print-capabilities

A version was selected early for TPMLIB_GetInfo() to succeed in
--print-capabilities. TPM 1.2 is the default version, but can now be
disabled in libtpms.

Ignore the error when the version is unsupported by libtpms and skip
reporting the GetInfo related details.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoswtpm: Preserve mlp->flags in CMD_SET_DATAFD handler
Nick Chevsky [Sat, 31 Jul 2021 17:17:59 +0000 (12:17 -0500)]
swtpm: Preserve mlp->flags in CMD_SET_DATAFD handler

Fix the handler for control channel command CMD_SET_DATAFD so that
it ORs new bits onto mlp->flags instead of overwriting its value.
This was causing loss of flags previously set during command-line
argument parsing, which resulted in user-provided options (e.g.
--terminate) to be permanently ignored if command CMD_SET_DATAFD
was at any point received on the control channel.

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
3 years agoswtpm: Use the pollfd array's enums as indices when initializing the array
Stefan Berger [Sat, 31 Jul 2021 23:38:54 +0000 (19:38 -0400)]
swtpm: Use the pollfd array's enums as indices when initializing the array

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agotests: Use the --write-ek-cert-files option and check for files
Stefan Berger [Mon, 14 Jun 2021 20:02:29 +0000 (16:02 -0400)]
tests: Use the --write-ek-cert-files option and check for files

Use the --write-ek-cert-files option in existing test cases
and check for written files and correctness of the files.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_setup: Support --write-ek-cert-files as an option
Stefan Berger [Fri, 11 Jun 2021 00:53:45 +0000 (20:53 -0400)]
swtpm_setup: Support --write-ek-cert-files as an option

Write the EK certificate files into the directory specified as parameter
to the --write-ek-cert-files option.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_setup: Get key description from function generating the EK key
Stefan Berger [Fri, 11 Jun 2021 00:05:05 +0000 (20:05 -0400)]
swtpm_setup: Get key description from function generating the EK key

Pass an optional key_description parameter through the APIs to be able to
get the a human readable key description, such as 'rsa2048' or 'secp384r1'
of the key that was created.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_setup: Move functions checking for directory access to library
Stefan Berger [Thu, 17 Jun 2021 15:13:58 +0000 (11:13 -0400)]
swtpm_setup: Move functions checking for directory access to library

Move code from setpm_setup into new function check_directory_access
that checks for existence of directory and access to it.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agotests: Replace ${SWTPM}.pid with swtpm.pid in PID filename in 2 test cases
Stefan Berger [Wed, 28 Jul 2021 12:49:40 +0000 (08:49 -0400)]
tests: Replace ${SWTPM}.pid with swtpm.pid in PID filename in 2 test cases

The PID filename was generated using the ${SWTPM} environment variable,
which caused test failures if set to a URL for example. Replace it with
'swptm'.

This issue was reported in issue #454.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoChange swtpm-localca to swtpm_localca in manpages
Nick Chevsky [Tue, 27 Jul 2021 18:54:45 +0000 (13:54 -0500)]
Change swtpm-localca to swtpm_localca in manpages

- Move content of swtpm-localca(8) manual page to swtpm_localca(8)
  and make swtpm-localca(8) an alias for swtpm_localca(8), mirroring
  the fact that /usr/bin/swtpm_localca is the actual program and
  /usr/share/swtpm/swtpm-localca a wrapper for it.
- Change references to `swtpm-localca` in manual pages' content to
  `swtpm_localca`, reflecting the actual name of the program they are
  meant to document.

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
3 years agobuild-sys: Add MY_CFLAGS, CFLAGS, and MY_LDFLAGS to all Makefile.am's
Stefan Berger [Mon, 26 Jul 2021 20:57:24 +0000 (16:57 -0400)]
build-sys: Add MY_CFLAGS, CFLAGS, and MY_LDFLAGS to all Makefile.am's

Add MY_CFLAGS, CFLAGS, and MY_LDFLAGS to all Makefile.am's so that they
can be defined during configure time as well as CFLAGS added during
build time. LDFLAGS were already handled correctly during build-time.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agobuild-sys: Rename AM_CFLAGS/LDFLAGS to MY_CFLAGS/LDFLAGS
Stefan Berger [Tue, 27 Jul 2021 14:13:49 +0000 (10:13 -0400)]
build-sys: Rename AM_CFLAGS/LDFLAGS to MY_CFLAGS/LDFLAGS

To avoid the following warning use MY_ as a prefix for the offending
variables that have AM_ as a prefix:

configure.ac:587: warning: macro 'AM_CFLAGS' not found in library
configure.ac:590: warning: macro 'AM_LDFLAGS' not found in library

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoRevert "build-sys: Remove AC_SUBST() for AM_CFLAGS and AM_LDFLAGS"
Stefan Berger [Mon, 26 Jul 2021 20:57:54 +0000 (16:57 -0400)]
Revert "build-sys: Remove AC_SUBST() for AM_CFLAGS and AM_LDFLAGS"

This reverts commit 47f973ed71a2c6baec58ed5aa6c0106cff64add6.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoRevert "build-sys: Remove using AM_CFLAGS and AM_LDFLAGS"
Stefan Berger [Mon, 26 Jul 2021 20:57:49 +0000 (16:57 -0400)]
Revert "build-sys: Remove using AM_CFLAGS and AM_LDFLAGS"

This reverts commit 7f81d3128804fc4753d263ff39062fb706bc666c.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoRevert "build-sys: Report $CFLAGS and $LDFLAGS at the end"
Stefan Berger [Mon, 26 Jul 2021 20:57:39 +0000 (16:57 -0400)]
Revert "build-sys: Report $CFLAGS and $LDFLAGS at the end"

This reverts commit 5c5856ea8fce978a20051e3efc4d7ad4c6e35d10.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoDebian packaging improvements
Nick Chevsky [Fri, 23 Jul 2021 20:15:22 +0000 (15:15 -0500)]
Debian packaging improvements

- debian/clean: Add files that were not being automatically cleaned
  up by dh(1)'s `clean` target.
- debian/control:
  - Add new recommended/required fields and bump Standards-Version.
  - Remove redundant build dependencies that are implied transitively.
  - Bump debhelper dependency version to match debian/compat.
  - Move swtpm-libs's ${misc:Pre-Depends} dependency to `Pre-Depends`.
    Resolves `depends-on-misc-pre-depends` Lintian warning.
  - Sort packages and dependency lists alphabetically as per
    wrap-and-sort(1).
- debian/not-installed: List deliberately non-installed files to
  avoid dh_missing(1) warnings.
- debian/rules:
  - Pass --no-scripts to dh_makeshlibs(1) in order to keep a
    ldconfig(8) trigger from being implicitly added, which for
    this package was redundant and triggered Lintian warning
    `package-has-unnecessary-activation-of-ldconfig-trigger`.
  - Remove redundant --parallel dh flag.
  - Remove redundant dh_usrlocal override.
- debian/*.install:
  - Add swtpm-create-tpmca(8) and its manpage, which were missing.
  - Remove redundant `#! /usr/bin/dh-exec` lines.
  - Sort entries alphabetically as per wrap-and-sort(1).
- debian/swtpm-tools.postinst.in: Add `set -e` to fail in case of
  error. Fixes `maintainer-script-ignores-errors` Lintian warning.

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
3 years agoMove swtpm_localca sources from samples/ to src/
Nick Chevsky [Sat, 24 Jul 2021 18:54:40 +0000 (13:54 -0500)]
Move swtpm_localca sources from samples/ to src/

- Move swtpm_localca's sources out of samples/ (where they no longer
  belong now that swtpm_localca is a binary) to src/swtpm_localca/.
- Tests now call the swtpm_localca binary directly at the location
  where it was built, as they do with all other compiled programs.
- Simplify samples/swtpm-localca.in and delete swtpm-localca.2inst,
  removing the now-unnecessary logic to selectively call swtpm_localca
  from different locations (samples/ when running tests vs. /usr/bin/
  post-installation).

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
3 years agoMove swtpm_setup.conf.in from etc/ to samples/
Nick Chevsky [Wed, 21 Jul 2021 18:09:33 +0000 (13:09 -0500)]
Move swtpm_setup.conf.in from etc/ to samples/
- Makes swtpm_setup.conf.in consistent with the rest of the sample
  configuration files in swtpm, whose templates ship in samples/ and
  install the generated files to /etc.
- Works around dh_missing(1) erroneously reporting swtpm_setup.conf as
  non-installed due to its having two copies in the build tree (one in
  etc/ and another in debian/tmp/etc/).

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
3 years agoRemove swtpm.spec from .gitignore
Nick Chevsky [Wed, 21 Jul 2021 20:30:44 +0000 (15:30 -0500)]
Remove swtpm.spec from .gitignore
Even though swtpm.spec is an auto-generated file, the author would
like to keep it in the repository for ease of installing dependencies
during development. As long as the file is meant to be versioned, it
should not be in .gitignore. Discussion for context:
https://github.com/stefanberger/swtpm/pull/496#issuecomment-884432135

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
3 years agoRemove obsolete manpage for swtpm_setup.sh(8)
Nick Chevsky [Wed, 21 Jul 2021 16:56:57 +0000 (11:56 -0500)]
Remove obsolete manpage for swtpm_setup.sh(8)
swtpm_setup.sh was replaced by swtpm_setup in v0.5.0.

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
3 years agodocs: Update INSTALL document
Stefan Berger [Mon, 19 Jul 2021 14:08:41 +0000 (10:08 -0400)]
docs: Update INSTALL document

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoCorrect old reference to swtpm_setup.sh in manpage
Nick Chevsky [Wed, 21 Jul 2021 03:32:06 +0000 (22:32 -0500)]
Correct old reference to swtpm_setup.sh in manpage
swtpm_setup.sh(8) was replaced by swtpm_setup(8) in v0.5.0.

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
3 years agoAdd missing title to swtpm-create-tpmca(8) manual page
Nick Chevsky [Tue, 20 Jul 2021 23:24:42 +0000 (18:24 -0500)]
Add missing title to swtpm-create-tpmca(8) manual page
Fixes `bad-whatis-entry` Lintian warning [1].

[1] https://lintian.debian.org/tags/bad-whatis-entry

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
3 years agoImprovements to .gitignore
Nick Chevsky [Tue, 20 Jul 2021 23:13:14 +0000 (18:13 -0500)]
Improvements to .gitignore
- Add auto-generated files debian/autoreconf.*
- Remove *.patch (Quilt requires these under debian/patches/)

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
3 years agosamples: Use different script for local testing than install
Stefan Berger [Sat, 17 Jul 2021 11:44:31 +0000 (07:44 -0400)]
samples: Use different script for local testing than install

Use a different script for local testing that what is installed into
/usr/share/swtpm/swtpm-localca.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agosamples: Replace swtpm_localca with script calling swtpm-localca (issue #482)
Stefan Berger [Tue, 13 Jul 2021 15:03:18 +0000 (11:03 -0400)]
samples: Replace swtpm_localca with script calling swtpm-localca (issue #482)

Replace the binary swtpm_localca with a script that now calls the binary
swtpm-localca, which is to be installed in $bindir.

So that we can use this for script for calling swtpm-localca during testing
(when it is not installed), write the script in such a way that it de-
termines whether there's swtpm-localca in the same directory and if not call
it from ${bindir}/swtpm-localca.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_setup: Fix compiler errors when memcpy is a macro (Cygwin)
Stefan Berger [Wed, 14 Jul 2021 16:36:41 +0000 (12:36 -0400)]
swtpm_setup: Fix compiler errors when memcpy is a macro (Cygwin)

Since commit 502cb1129ad59 -D_FORTIFY_SOURCE=2 is passed to the gcc
command line resulting in memcpy() becoming a macro on Cygwin, which
then causes the following compiler errors due to the anonymous arrays
being used:

swtpm.c: In function ‘swtpm_tpm2_createprimary_ek_rsa’:
swtpm.c:686:26: error: macro "memcpy" passed 34 arguments, but takes just 3
  686 |         }, authpolicy_len);
      |                          ^
In file included from /usr/include/string.h:180,
                 from swtpm.c:15:
/usr/include/ssp/string.h:97: note: macro "memcpy" defined here
   97 | #define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len)
      |
swtpm.c:682:9: error: statement with no effect [-Werror=unused-value]
  682 |         memcpy(authpolicy, (unsigned char []){
      |         ^~~~~~
swtpm.c:698:26: error: macro "memcpy" passed 50 arguments, but takes just 3
  698 |         }, authpolicy_len);
      |                          ^

The solution is to surround the anonymous array definitions with '( )'.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoman8: Add missing '\' to list of pod files and reduce EXTRA_DIST files
Stefan Berger [Tue, 13 Jul 2021 21:42:39 +0000 (17:42 -0400)]
man8: Add missing '\' to list of pod files and reduce EXTRA_DIST files

Add a missing '\' to the list of pod files and reduce the EXTRA_DIST
files list to only those that available via git and not generated.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agotests: Add test_tpm2_save_load_state to the tests to run
Stefan Berger [Tue, 13 Jul 2021 20:58:39 +0000 (16:58 -0400)]
tests: Add test_tpm2_save_load_state to the tests to run

The test test_tpm2_save_load_state seems to have been forgotten
about and was not run. Add it now to the the tests to run.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoconfigure: Fix spacing for HARDENING_*FLAGS
Andrea Bolognani [Tue, 6 Jul 2021 12:27:11 +0000 (14:27 +0200)]
configure: Fix spacing for HARDENING_*FLAGS

Currently multiple spaces are used when a single one would do,
which will still achieve the same result but is not quite as
aesthetically pleasing :)

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agoconfigure: Fix typo TPM2 -> TMP2
Andrea Bolognani [Tue, 6 Jul 2021 12:23:57 +0000 (14:23 +0200)]
configure: Fix typo TPM2 -> TMP2

This will result in -D_FORTIFY_SOURCE=2 actually being added to
HARDENING_CFLAGS where applicable.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agotest: Extend TPM 1.2 test case to also cover 'savestate'
Stefan Berger [Wed, 7 Jul 2021 17:18:30 +0000 (13:18 -0400)]
test: Extend TPM 1.2 test case to also cover 'savestate'

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agotests: Use --allow-signing with --decryption in some swtpm_setup test
Stefan Berger [Wed, 7 Jul 2021 17:06:42 +0000 (13:06 -0400)]
tests: Use --allow-signing with --decryption in some swtpm_setup test

To increase coverage, use --allow-signing along with --decryption in
some swtpm_setup test cases.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agotests: Add swtpm_setup test cases with --lock-nvram and --create-spk options
Stefan Berger [Tue, 29 Jun 2021 13:56:35 +0000 (09:56 -0400)]
tests: Add swtpm_setup test cases with --lock-nvram and --create-spk options

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm: Fix issues raised by -Wextra (Cygwin)
Stefan Berger [Thu, 24 Jun 2021 20:41:25 +0000 (16:41 -0400)]
swtpm: Fix issues raised by -Wextra (Cygwin)

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm: Issue fsync to ensure state data reaches disk
Eiichi Tsukata [Wed, 23 Jun 2021 03:50:32 +0000 (12:50 +0900)]
swtpm: Issue fsync to ensure state data reaches disk

Add fsync(2) before rename(2) for temp file to ensure data reaches disk
and for directory which containing state file to ensure directory entry
also reaches disk.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
3 years agoswtpm_setup: Fix issues raised by -Wextra
Stefan Berger [Thu, 24 Jun 2021 16:44:46 +0000 (12:44 -0400)]
swtpm_setup: Fix issues raised by -Wextra

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_ioctl: Fix issues raised by -Wextra
Stefan Berger [Thu, 24 Jun 2021 16:43:07 +0000 (12:43 -0400)]
swtpm_ioctl: Fix issues raised by -Wextra

Signed-off-by: Stefan Berger <stefanb@linu.ibm.com>
3 years agoswtpm_cert: Fix issues raised by -Wextra
Stefan Berger [Thu, 24 Jun 2021 16:57:25 +0000 (12:57 -0400)]
swtpm_cert: Fix issues raised by -Wextra

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_bios: Fix issues raised by -Wextra
Stefan Berger [Thu, 24 Jun 2021 16:43:58 +0000 (12:43 -0400)]
swtpm_bios: Fix issues raised by -Wextra

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm: Fix issues raised by -Wextra
Stefan Berger [Thu, 24 Jun 2021 16:55:06 +0000 (12:55 -0400)]
swtpm: Fix issues raised by -Wextra

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agosamples: swtpm_localca: Fix issues raised by -Wextra
Stefan Berger [Thu, 24 Jun 2021 16:42:32 +0000 (12:42 -0400)]
samples: swtpm_localca: Fix issues raised by -Wextra

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agobuild-sys: Remove using -L$(PWD)/.libs -lswtpm_libtpms on linking
Tomasz Kłoczko [Fri, 11 Jun 2021 17:55:44 +0000 (18:55 +0100)]
build-sys: Remove using -L$(PWD)/.libs -lswtpm_libtpms on linking

Such paths should not be used.
Use proper linker libswtpm_libtpms.la scripyt generated by libtool.

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
3 years agobuild-sys: Report $CFLAGS and $LDFLAGS at the end
Tomasz Kłoczko [Fri, 11 Jun 2021 18:01:52 +0000 (19:01 +0100)]
build-sys: Report $CFLAGS and $LDFLAGS at the end

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
3 years agobuild-sys: Remove using AM_CFLAGS and AM_LDFLAGS
Tomasz Kłoczko [Fri, 11 Jun 2021 17:55:17 +0000 (18:55 +0100)]
build-sys: Remove using AM_CFLAGS and AM_LDFLAGS

Those automake variables are used by default.

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
3 years agobuild-sys: Remove AC_SUBST() for AM_CFLAGS and AM_LDFLAGS
Tomasz Kłoczko [Fri, 11 Jun 2021 17:54:53 +0000 (18:54 +0100)]
build-sys: Remove AC_SUBST() for AM_CFLAGS and AM_LDFLAGS

Resolve autoreconf warnings:

configure.ac:602: warning: macro 'AM_CFLAGS' not found in library
configure.ac:605: warning: macro 'AM_LDFLAGS' not found in library

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
3 years agobuild-sys: Call autoupdate and fix some resulting issues
Tomasz Kłoczko [Fri, 11 Jun 2021 17:53:07 +0000 (18:53 +0100)]
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
aclocal: warning: couldn't open directory 'm4': No such file or directory
configure.ac:587: warning: macro 'AM_CFLAGS' not found in library
configure.ac:590: warning: macro 'AM_LDFLAGS' not found in library
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
configure.ac:587: warning: macro 'AM_CFLAGS' not found in library
configure.ac:590: warning: macro 'AM_LDFLAGS' not found in library
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:279: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:279: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:279: the top level
configure.ac:434: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:434: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:434: the top level
configure.ac:441: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:441: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:441: the top level
configure.ac:521: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:521: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:521: the top level
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:40: installing './compile'
configure.ac:43: installing './config.guess'
configure.ac:43: installing './config.sub'
configure.ac:41: installing './install-sh'
configure.ac:48: installing './missing'
samples/Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
autoreconf: Leaving directory '.'
```
Execute autoupdate to apply all those chenges and then cleanup that
in next commits.

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agosample: swtpm-localca: Add missing else branch for pkcs11 and PIN
Stefan Berger [Mon, 21 Jun 2021 21:01:18 +0000 (17:01 -0400)]
sample: swtpm-localca: Add missing else branch for pkcs11 and PIN

Add a missing else branch that was forgotten about when the code was trans-
lated from python. This now also gets the test case
test_tpm2_samples_create_tpmca to work again when it is run from the command
line. This test case doesn't work as part of the test suite due to
concurreny issues with other test cases using tpm2-abrmd at the same.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agotests: Kill tpm2-abrmd with SIGKILL rather SIGTERM
Stefan Berger [Mon, 21 Jun 2021 21:15:21 +0000 (17:15 -0400)]
tests: Kill tpm2-abrmd with SIGKILL rather SIGTERM

Kill an unterminated tpm2-abrmd with SIGKILL rather than SIGTERM

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_setup: Initialize Gerror and free it
Stefan Berger [Wed, 16 Jun 2021 19:08:33 +0000 (15:08 -0400)]
swtpm_setup: Initialize Gerror and free it

Gerror was not initialized to NULL in one place. In the other it wasn't
freed.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agotests: Use common vars for executables in swtpm_setup_create_cert tests
Stefan Berger [Wed, 16 Jun 2021 16:08:55 +0000 (12:08 -0400)]
tests: Use common vars for executables in swtpm_setup_create_cert tests

Use the variables from tests/common for executables used in the
swtpm_setup_create_cert tests.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm: Fix SWTPM names in comments and messages
Felipe Franciosi [Tue, 15 Jun 2021 09:51:01 +0000 (10:51 +0100)]
swtpm: Fix SWTPM names in comments and messages

Some of the code comes from libtpms, where various methods are named
"TPM_Something". The swtpm version of these methods are named
"SWTPM_Something". However, certain debug/log messages and comments were
updated accordingly to reflect that.

This is a cosmetic change that fixes that.

Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
3 years agoswtpm_setup: Replace '\\s' in regex with [[:space:]] to fix cygwin
Stefan Berger [Fri, 11 Jun 2021 02:01:42 +0000 (22:01 -0400)]
swtpm_setup: Replace '\\s' in regex with [[:space:]] to fix cygwin

Cygwin's regex implementation doesn't seem to understand '\\s'
but needs [[:space:]] instead to properly skip over spaces.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agobuild-sys: Bump up version to 0.7.0 at beginning of dev cycle
Stefan Berger [Fri, 11 Jun 2021 05:57:25 +0000 (01:57 -0400)]
build-sys: Bump up version to 0.7.0 at beginning of dev cycle

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agodebian/rpm: Adjust changelog for 0.6.0 release
Stefan Berger [Wed, 2 Jun 2021 20:21:56 +0000 (16:21 -0400)]
debian/rpm: Adjust changelog for 0.6.0 release

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoCHANGES: Add more documentation for changes in 0.6.0
Stefan Berger [Wed, 2 Jun 2021 20:02:13 +0000 (16:02 -0400)]
CHANGES: Add more documentation for changes in 0.6.0

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agobuild-sys: Add HARDENING_CFLAGS and _LDFLAGS to all C programs
Stefan Berger [Fri, 4 Jun 2021 12:04:21 +0000 (08:04 -0400)]
build-sys: Add HARDENING_CFLAGS and _LDFLAGS to all C programs

Add the HARDENING_CFLAGS and _LDFLAGS to all C programs.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm: Add 2021 as year in the Copyright notice
Stefan Berger [Thu, 3 Jun 2021 20:34:25 +0000 (16:34 -0400)]
swtpm: Add 2021 as year in the Copyright notice

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoTravis: Remove much of the python related stuff
Stefan Berger [Thu, 3 Jun 2021 15:50:15 +0000 (11:50 -0400)]
Travis: Remove much of the python related stuff

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agodebian/rpm: Remove left-over python files that do not exist anymore
Stefan Berger [Wed, 2 Jun 2021 20:28:13 +0000 (16:28 -0400)]
debian/rpm: Remove left-over python files that do not exist anymore

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agobuild-sys: Display json-glib and glib related cflags and libs
Stefan Berger [Thu, 3 Jun 2021 15:10:38 +0000 (11:10 -0400)]
build-sys: Display json-glib and glib related cflags and libs

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_setup: Fix the strjoin for the PID file path
Stefan Berger [Thu, 3 Jun 2021 21:08:10 +0000 (17:08 -0400)]
swtpm_setup: Fix the strjoin for the PID file path

The path for the PID file was not joined correctly and was missing
a '/'. Fix this now.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_localca: Adjust expiration days for 32-bit platforms
Stefan Berger [Thu, 3 Jun 2021 14:18:21 +0000 (10:18 -0400)]
swtpm_localca: Adjust expiration days for 32-bit platforms

GnuTLS on 32-bit platforms complains about the long expiration time
of the certificates since they overflow the 32-bit time_t. Reduce
the duration to 12 years.

This system expresses time with a 32-bit time_t; that prevents dates after 2038 to be expressed by GnuTLS.
Overflow while parsing days

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_setup: Initialize autfreed variables with NULL (gcc-11)
Stefan Berger [Thu, 3 Jun 2021 14:04:53 +0000 (10:04 -0400)]
swtpm_setup: Initialize autfreed variables with NULL (gcc-11)

This patch addresses the following gcc-11 compiler issues:

In file included from /usr/include/glib-2.0/glib.h:114,
                 from swtpm_setup_utils.c:14:
swtpm_setup_utils.c: In function 'get_config_value':
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'tmp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   28 |   g_free (*pp);
      |   ^~~~~~~~~~~~
swtpm_setup_utils.c:36:31: note: 'tmp' was declared here
   36 |             g_autofree gchar *tmp;
      |                               ^~~

swtpm.c: In function 'swtpm_start':
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'pidfile_file' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   28 |   g_free (*pp);
      |   ^~~~~~~~~~~~
swtpm.c:54:23: note: 'pidfile_file' was declared here
   54 |     g_autofree gchar *pidfile_file;
      |                       ^~~~~~~~~~~~

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agoswtpm_localca: Initialize autofreed variables to NULL (gcc-11)
Stefan Berger [Thu, 3 Jun 2021 13:54:43 +0000 (09:54 -0400)]
swtpm_localca: Initialize autofreed variables to NULL (gcc-11)

This patch addresses the following gcc-11 compiler issues:

In file included from /usr/include/glib-2.0/glib.h:114,
                 from ../src/utils/swtpm_utils.h:13,
                 from swtpm_localca_utils.c:24:
swtpm_localca_utils.c: In function 'get_config_envvars':
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'value' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   28 |   g_free (*pp);
      |   ^~~~~~~~~~~~
swtpm_localca_utils.c:98:37: note: 'value' was declared here
   98 |             g_autofree gchar *key, *value;
      |                                     ^~~~~
In file included from /usr/include/glib-2.0/glib.h:114,
                 from ../src/utils/swtpm_utils.h:13,
                 from swtpm_localca_utils.c:24:
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'key' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   28 |   g_free (*pp);
      |   ^~~~~~~~~~~~
swtpm_localca_utils.c:98:31: note: 'key' was declared here
   98 |             g_autofree gchar *key, *value;
      |                               ^~~

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agorpm: Readd swtpm.spec to be able to easily install dependencies
Stefan Berger [Fri, 4 Jun 2021 15:31:59 +0000 (11:31 -0400)]
rpm: Readd swtpm.spec to be able to easily install dependencies

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agorpm: Move spec file and include it in dist archives
Andrea Bolognani [Thu, 3 Jun 2021 17:54:43 +0000 (19:54 +0200)]
rpm: Move spec file and include it in dist archives

Having the spec file in the top-level directory of the dist
archive makes it possible to build rpms with a single,
convenient command.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agorpm: Drop git information
Andrea Bolognani [Thu, 3 Jun 2021 17:32:48 +0000 (19:32 +0200)]
rpm: Drop git information

Using these instead of the regular version number makes it
more complicated than necessary to perform builds, and there
doesn't seem to be any advantage in keeping them around.

After this change, the rpm building instructions contained in
the INSTALL file actually work.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agorpm: Remove unnecessary string substitution
Andrea Bolognani [Thu, 3 Jun 2021 18:14:39 +0000 (20:14 +0200)]
rpm: Remove unnecessary string substitution

These are never going to change, so using string substitution
serves no purpose beyon mild obfuscation.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agorpm: Use HTTPS URL
Andrea Bolognani [Thu, 3 Jun 2021 17:25:35 +0000 (19:25 +0200)]
rpm: Use HTTPS URL

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agorpm: Drop swtpm.spec
Andrea Bolognani [Thu, 3 Jun 2021 16:03:44 +0000 (18:03 +0200)]
rpm: Drop swtpm.spec

This file is generated from swtpm.spec.in, and as such should
not be tracked in git; in fact, an entry for it exists in the
gitignore file.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agoINSTALL: Don't make the user run configure twice
Andrea Bolognani [Thu, 3 Jun 2021 16:16:31 +0000 (18:16 +0200)]
INSTALL: Don't make the user run configure twice

autogen.sh will automatically invoke configure passing it any
command line arguments it received, so we shouldn't instruct
the user to unnecessarily run it again immediately afterwards.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agogitignore: Ignore .gch files
Andrea Bolognani [Thu, 3 Jun 2021 16:01:50 +0000 (18:01 +0200)]
gitignore: Ignore .gch files

Configure generates include/swtpm/tpm_ioctl.h.gch when trying
to figure out which hardening options can be enabled.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agoutils: Have logit and logerr call alog to unify their code
Stefan Berger [Mon, 31 May 2021 20:29:02 +0000 (16:29 -0400)]
utils: Have logit and logerr call alog to unify their code

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agotests: Test resolving env. variabels in swtpm_setup config file
Stefan Berger [Mon, 31 May 2021 17:16:39 +0000 (13:16 -0400)]
tests: Test resolving env. variabels in swtpm_setup config file

Modify a test case and write an environment variable into the
swtpm_setup.conf config file to test that it gets resolved.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
3 years agosamples: Rewrite of swtpm_localca in 'C' (addresses issue #437)
Stefan Berger [Mon, 24 May 2021 14:43:49 +0000 (10:43 -0400)]
samples: Rewrite of swtpm_localca in 'C' (addresses issue #437)

This is a 1:1 rewrite of swtpm_localca in 'C' as a final step to get
rid of the python dependency. It addresses issue #437.

Tested on: Cygwin, Fedora 33, Ubuntu Xenial & Bionic, FreeBSD,
           DragonFlyBSD, OpenBSD (i386), Mac, Debian (recent), Centos-8,
           CentOS (recent), Alpine (recent), OpenSUSE (recent),
           Fedora 28 PPC Big Endian

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