Commit Graph

1439 Commits

Author SHA1 Message Date
Stefan Berger
3d75c96537 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>
2021-07-13 22:19:38 -04:00
Stefan Berger
3acc2ee1ce 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>
2021-07-13 18:23:39 -04:00
Andrea Bolognani
5e73e324bd 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>
2021-07-08 08:29:02 -04:00
Andrea Bolognani
502cb1129a 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>
2021-07-08 08:29:02 -04:00
Stefan Berger
7be5d76679 test: Extend TPM 1.2 test case to also cover 'savestate'
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-07-07 15:44:46 -04:00
Stefan Berger
b517f350a2 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>
2021-07-07 15:44:46 -04:00
Stefan Berger
978d22bcec tests: Add swtpm_setup test cases with --lock-nvram and --create-spk options
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-29 11:26:30 -04:00
Stefan Berger
ecdfc77116 swtpm: Fix issues raised by -Wextra (Cygwin)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-24 18:58:22 -04:00
Eiichi Tsukata
a5f4e65749 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>
2021-06-24 16:19:59 -04:00
Stefan Berger
a69388c0f4 swtpm_setup: Fix issues raised by -Wextra
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-24 15:05:03 -04:00
Stefan Berger
6a6fd6e811 swtpm_ioctl: Fix issues raised by -Wextra
Signed-off-by: Stefan Berger <stefanb@linu.ibm.com>
2021-06-24 15:05:03 -04:00
Stefan Berger
e7488fd1e5 swtpm_cert: Fix issues raised by -Wextra
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-24 15:05:03 -04:00
Stefan Berger
5302269acc swtpm_bios: Fix issues raised by -Wextra
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-24 15:05:03 -04:00
Stefan Berger
fa2fc871d2 swtpm: Fix issues raised by -Wextra
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-24 15:05:03 -04:00
Stefan Berger
84c10ba7e4 samples: swtpm_localca: Fix issues raised by -Wextra
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-24 15:05:03 -04:00
Tomasz Kłoczko
75c5da2cf1 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>
2021-06-22 17:03:31 -04:00
Tomasz Kłoczko
5c5856ea8f build-sys: Report $CFLAGS and $LDFLAGS at the end
Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
2021-06-22 17:03:31 -04:00
Tomasz Kłoczko
7f81d31288 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>
2021-06-22 17:03:31 -04:00
Tomasz Kłoczko
47f973ed71 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>
2021-06-22 17:03:31 -04:00
Tomasz Kłoczko
b295c76850 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>
2021-06-22 17:03:31 -04:00
Stefan Berger
2c270f0407 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>
2021-06-21 19:58:49 -04:00
Stefan Berger
53a81d0c9c 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>
2021-06-21 19:58:49 -04:00
Stefan Berger
a59eead4bc 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>
2021-06-16 18:01:35 -04:00
Stefan Berger
3252334cba 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>
2021-06-16 14:00:18 -04:00
Felipe Franciosi
4a96c7f54a 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>
2021-06-15 08:35:53 -04:00
Stefan Berger
2bf68cc4be 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>
2021-06-11 07:53:28 -04:00
Stefan Berger
ec49cac756 build-sys: Bump up version to 0.7.0 at beginning of dev cycle
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-11 07:53:28 -04:00
Stefan Berger
ea627b3b5e debian/rpm: Adjust changelog for 0.6.0 release
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-04 16:04:09 -04:00
Stefan Berger
1415cfaa1b CHANGES: Add more documentation for changes in 0.6.0
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-04 16:04:09 -04:00
Stefan Berger
932dc4e270 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>
2021-06-04 16:04:09 -04:00
Stefan Berger
c86be8d960 swtpm: Add 2021 as year in the Copyright notice
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-04 16:04:09 -04:00
Stefan Berger
d37095af6c Travis: Remove much of the python related stuff
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-04 16:04:09 -04:00
Stefan Berger
8658bdf102 debian/rpm: Remove left-over python files that do not exist anymore
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-04 16:04:09 -04:00
Stefan Berger
b570103473 build-sys: Display json-glib and glib related cflags and libs
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-04 16:04:09 -04:00
Stefan Berger
80271b5f26 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>
2021-06-04 16:04:09 -04:00
Stefan Berger
71c353a728 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>
2021-06-04 16:04:09 -04:00
Stefan Berger
c8c3bb4170 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>
2021-06-04 16:04:09 -04:00
Stefan Berger
4165421a9d 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>
2021-06-04 16:04:09 -04:00
Stefan Berger
7f1f1fff46 rpm: Readd swtpm.spec to be able to easily install dependencies
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-04 16:04:09 -04:00
Andrea Bolognani
4608cc333a 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>
2021-06-03 16:09:00 -04:00
Andrea Bolognani
d66adbae5e 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>
2021-06-03 16:09:00 -04:00
Andrea Bolognani
3ec34c2b8a 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>
2021-06-03 16:09:00 -04:00
Andrea Bolognani
5dd316bc34 rpm: Use HTTPS URL
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2021-06-03 16:09:00 -04:00
Andrea Bolognani
f747974b43 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>
2021-06-03 16:09:00 -04:00
Andrea Bolognani
94af033e58 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>
2021-06-03 16:09:00 -04:00
Andrea Bolognani
a6db0e2696 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>
2021-06-03 16:09:00 -04:00
Stefan Berger
4ec17885c4 utils: Have logit and logerr call alog to unify their code
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-01 09:31:43 -04:00
Stefan Berger
0df3ec7180 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>
2021-06-01 09:31:43 -04:00
Stefan Berger
e689684c57 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>
2021-06-01 09:31:43 -04:00
Stefan Berger
b1cde69b09 swtpm_setup: Add proper DEPENDENCY for swtpm_setup on swtpm_utils.la
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-01 09:31:43 -04:00