Commit Graph

93 Commits

Author SHA1 Message Date
Stefan Berger
140cb42552 build-sys: build swtpm-0.5.5
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2022-03-30 15:51:30 -04:00
Stefan Berger
52d05869a9 build-sys: build swtpm-0.5.4
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2022-03-05 19:43:40 -05:00
Stefan Berger
f66a6e5f14 build-sys: Use -DOPENSSL_SUPPRESS_DEPRECATED (OSSL 3)
Use the (undocumented) OPENSSL_SUPPRESS_DEPRECATED to suppress the
deprecated API warnings when compiling swtpm and swtpm_setup with
OpenSSL 3.0.0 replacing the global -Wno-deprecated-declarations.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-09-19 17:40:16 -04:00
Stefan Berger
f343943828 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>
2021-09-15 19:30:00 -04:00
Tomasz Kłoczko
08816ab3af build-sys: Call autoupdate and fix some resulting issues
autoreconf from autoconf 2.71 emmits a lot of warnings:

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

Execute autoupdate to apply all those changes.

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-23 22:45:35 -04:00
Stefan Berger
735ab5afee build-sys: build swtpm-0.5.3
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-14 15:15:34 -04:00
Stefan Berger
4d9078878d build-sys: buid swtpm-0.5.2
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-12-26 13:33:15 -05:00
Eiichi Tsukata
62c03e02e5 build-sys: fix configure python cryptography error message
Currently it shows "python setuptools is required" if "import
cryptography" failed.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
2020-11-13 20:07:00 -05:00
Stefan Berger
20ed6f9804 build-sys: build swtpm-0.5.1
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-11-09 17:06:09 -05:00
Stefan Berger
d4c60e44ce tests: Allow 'ss' as an alternative to 'netstat'
Some distros (openSUSE) have deprecated the 'net-tools' package,
so we allow for 'ss' as an alternative tool from the
iproute/iproute2 package. This is only relevant for test cases.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-10-02 15:56:42 -04:00
Elms
8d086ee9de Use correct LDFLAGS for non-standard libtpms locations 2020-09-24 21:30:10 -04:00
Stefan Berger
b71da43026 samples: Rewrite swtpm-localca in python
Rewrite swtpm-localca in python and get rid of the bash file and the flock
dependency.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-18 12:09:11 -04:00
Jonas Witschel
fdaa6f1f1c build-sys: make pip dependency check non-fatal
The only place where pip is required is in src/swtpm_setup/Makefile.am, l. 48,
to uninstall a manually built package. Most people will have pip already
installed, since it comes bundled with Python by default. It might not be
installed by default in minimal build environments used for distribution
packaging, but these rely on the file tracking by a package manager instead of
using "make uninstall".

In conclusion, I think requiring pip is only helpful for a very limited number
of people, and is just a superfluous build dependency for distribution
packagers. Issuing a warning that the package cannot be uninstalled cleanly if
pip is not found seems enough.

Signed-off-by: Jonas Witschel <diabonas@archlinux.org>
2020-09-14 07:41:24 -04:00
Jonas Witschel
3dafa38eb7 build-sys: add configure option to disable installation of Python module
Distributions often have their own guidelines regarding installation of Python
modules (e.g. Arch Linux mandates using --optimize=1 for setup.py install,
which the Makefile in this project does not do). Add an option
"--disable-python-installation" (disabled by default) to allow skipping the
Python installation process entirely so that distributions can take care of
this process manually in their preferred way.

Signed-off-by: Jonas Witschel <diabonas@archlinux.org>
2020-09-14 07:40:31 -04:00
Stefan Berger
0586d2f55a build-sys: Use -Wl,-z,relro and -Wl,-z,now only when linking (clang)
Clang complains if eiher one of those linker flags are used during compilation:

clang-9: error: -Wl,-z,relro: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-9: error: -Wl,-z,now: 'linker' input unused [-Werror,-Wunused-command-line-argument]

This patch applies those flags only when linking.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-12 10:55:32 -04:00
Stefan Berger
2ba23cee13 build-sys: Use AC_LINK_IFELSE to check whether support for hardening flags
Cygwin's linker does not support -Wl,-z,relro and -Wl,-z,now and
AC_COMPILE_IFELSE did only compile but not link, so it wouldn't detect
whether these flags are supported. So, use AC_LINK_IFELSE to detect
support for these flags.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-11 12:23:30 -04:00
Stefan Berger
3064a72ff0 swtpm_setup: Get rid of 'c' code and support changing user in python
Get rid of the 'c' code that only changed the user and add for support of
the --runas option to change to a different user in the python part.

To get 'make distcheck' to work I needed to name the swtpm_setup python
script with the suffix .in so that it gets copied to the build directory
as swtpm_setup. We need to change execute permissions on this file after
copying.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-09 09:53:05 -04:00
Stefan Berger
3bf8f4628c build-sys: Bump up version to 0.5.0 at beginning of dev cycle
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-09 06:49:50 -04:00
Stefan Berger
cc410ca91b swtpm_setup: Switch over to new python tool and get rid of the bash script
Switch over to the new python implementation of swtpm_setup. We need to
also adjust test cases that involved the tcsd that otherwise fail for
various reasons. For in-place testing we need to adjust the PYTHONPATH
and PATH so that swtpm_setup.py can be found and so that swtpm_setup.py
then finds swtpm if it is not explicitly passed as parameter.

Adjust the man page for swtpm_setup to reflect the changes.

We now can run swtpm_setup as any user. However, libvirt still runs it
as tss:tss (for example), which is then creating the signing key as tss:tss
as well. Ideally libvirt would run it as tss:root or any other combination
since the tss group may be used for user wanting to access /dev/tpmrm0 for
example. We at least change the directory ownership of /var/lib/swtpm-localca
to tss:root and keep the world out of this directory.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-28 16:27:15 -04:00
Stefan Berger
eee8cb5dfb swtpm_setup: Rewrite swtpm_setup.sh in python
Rewrite swtpm_setup.sh in python. Use a permanent connection from the
tool to swtpm via passing file descriptors of a unix socketpair. Implement
all functionality in python so that we don't rely on trousers and tpm-tools
for swtpm_setup. This now allows any user to setup a TPM 1.2 whereas before
it had to be root or the tss user.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-28 16:27:15 -04:00
Stefan Berger
a63fe71ad5 build-sys: Check for flock tool
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-26 18:53:30 -04:00
Stefan Berger
a12b09b1ea samples: Implement script to create user config files and extend man page
Implement a script that creates the user config files in the
${XDG_CONFIG_HOME} directory and sub-directories.

Extend swtpm_setup.pod showing swtpm-create-user-config-files usage.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-20 09:49:33 -04:00
Stefan Berger
217c29cb07 Revert "samples: Implement script to create user config files"
This reverts commit d09484c02d.
2020-08-20 09:49:33 -04:00
Stefan Berger
d09484c02d samples: Implement script to create user config files
Implement a script that creates the user config files in the
${XDG_CONFIG_HOME} directory and sub-directories.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-19 14:39:31 -04:00
Stefan Berger
040c7097e0 build-sys: Have configure display swtpm version being built
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-18 16:21:32 -04:00
Jonas Witschel
609dfd873a build-sys: fix test for netstat if tcsd is not available
A typo in the condition meant that netstat was always required regardless of
whether tcsd is available or not.

Signed-off-by: Jonas Witschel <diabonas@archlinux.org>
2020-07-28 10:30:23 -04:00
Stefan Berger
aa88eebe32 build-sys: Check whether tss user and group are available
If the tcsd (trousers) is available, TPM 1.2 support should work as well.
Typically the tss user and group should be defined at this point, but
this may not always be the case, so make sure that this user and group
are available on the system.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-24 10:50:08 -04:00
Stefan Berger
3b33116d97 build-sys: Error out if libtpms.pc cannot be found and request PKG_CONFIG_PATH be set
Error out if libtpms.pc cannot be found for pkg-config. This now requires that an
in-place libtpms be accessed like this:

PKG_CONFIG_PATH=/home/stefanb/libtpms/ \
	LIBTPMS_CFLAGS=-I/home/stefanb/libtpms/include/ \
	LIBTPMS_LDFLAGS=-L/home/stefanb/libtpms/src/.libs/ \
	./configure --prefix=/usr

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-24 08:33:05 -04:00
Stefan Berger
0371b63bec build-sys: Explicitly link libswtpm_libtpms with -lcrypto (Gentoo)
This patch fixes the following linker issue reported for Gentoo in
issue #280.

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

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

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

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-07-21 20:52:34 -04:00
Stefan Berger
13cb26d846 build-sys: Enable automake silent rules
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-06-18 14:05:03 -04:00
James Bottomley
b4374c3392 build-sys: Let swtpm build with in-place libtpms
Building things like this in-place is really useful when you can't be
bothered to package and install them for your distribution but still
want to use them.  This patch allows building swtpm with libtpms in
place.  Simply specify the location to LDFLAGS and CFLAGS on the
configure line

LIBTPMS_CFLAGS=-I/home/jejb/git/libtpms/include/ LIBTPMS_LDFLAGS=-L/home/jejb/git/libtpms/src/.libs/ ./configure

It will then build a version that can run in-place.

I also think it corrects a bug in the original in that if pkg-config
had specified a non standard library location, the version check
wouldn't have used it.

Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-05-12 13:50:37 -04:00
Stefan Berger
3e3d2c82dd build-sys: Bump up version to 0.4.0 at beginning of dev cycle
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-07 11:16:49 -04:00
Stefan Berger
2e187bc299 build-sys: Set version to 0.3.0 for next release
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-02-17 12:11:31 -05:00
Stefan Berger
0232f78f0d build-sys: Display check result for build with libseccomp
Display the check result of 'yes' or 'no' for whether we build
with libseccomp.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-01-14 20:26:36 -05:00
Stefan Berger
5d35321e20 build-sys: Avoid prefix=NONE if no prefix is passed to configure
If no prefix is passed to the configure line we get prefix=NONE
in evaluations of variables that depend on prefix at this point.
If the user provides no --prefix we assume /usr/local as the
default and override the 'NONE' value we have at this point.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-03-21 16:53:49 -04:00
Stefan Berger
761df6cd63 build-sys: Add libbsecomp to configure.ac
Implement support for --with-seccomp and --without-seccomp for Linux
systems with --with-seccomp being the default. On all other systems
--without-seccomp is the implicit default.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-03-18 15:43:44 -04:00
Stefan Berger
f1a8a1cb51 Set version to 0.2.0 for next release
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-02-26 08:33:24 -05:00
Stefan Berger
44b92d43cd debian: Add post install script for swtpm-tools
Add a post install script for swtpm-tools that creates
the /var/lib/swtpm-localca directory and changes ownersip
on it.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-01-28 17:03:26 -05:00
Stefan Berger
d16b86b7b0 build-sys: Adjust localstatedir and files using it
Adjust the localstatedir variable to not have ${prefix} if
prefix is '/usr/', otherwise use ${prefix}.

Also adjust the files that were pointing to directories that
are controlled by $localstatedir.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-01-17 11:28:40 -05:00
Stefan Berger
0432b6535c build-sys: Fix hard coded /etc path and replace with @SYSCONFDIR@
When the project is configured with --prefix=/usr/local several configuration
files are installed to /usr/local/etc but not read by the programs that
need them. This patch fixes this issue by replacing @SYSCONFDIR@ in the source
code of those files with the actual used path.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-01-17 11:28:40 -05:00
Stefan Berger
ef606d4a65 build-sys: If TPM 1.2 NVRAM area tools are missing print out a warning
Allow to build without the TPM 1.2 NVRAM area tools but print out a warning
that they are needed for TPM 1.2 certificate injection.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2018-12-15 10:06:03 -05:00
Stefan Berger
b78b6af2f8 build-sys: Set action-if-found in AC_CHECK_LIB where missing
Prevent the LIBS variable from collecting all kinds of libraries
by setting the action-if-found parameter in AC_CHECK_LIB. This
avoid linking of executables with unnecessary libraries.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2018-11-17 16:37:03 -05:00
Stefan Berger
b8421f3de4 build-sys: Support --enable-test-coverage as an option
Support --enable-test-coverage as an option for compiling with
coverage instrumentation.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2018-10-25 12:30:21 -04:00
Stefan Berger
5eeea3570b build-sys: Support --disable-hardening as an option
By default the hardening compiler flags are enabled and
--disable-hardening disables them.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2018-10-25 10:32:36 -04:00
Stefan Berger
5478de0a0d build-sys: Link with -lrt if libc does not have clock_gettime()
On older system libc does not provide clock_gettime() so we need
to link with -lrt.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-10-05 22:20:49 -04:00
Stefan Berger
1389bafe3f build-sys: Pass header file to compiler for checking for supported flag
Older versions of gcc need some input file to compile so that
we learn whether -fstack-protector-strong is supported.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-10-05 22:20:49 -04:00
Stefan Berger
ebf1557dde build-sys: Move glib-2.0 dependency to CUSE TPM build
Only when the CUSE TPM is built we need the glib-2.0 dependency
(which can be removed at some point probably).

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

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-25 08:35:45 -04:00
Stefan Berger
908afaf5f8 build-sys: Replace AC_PROG_LIBTOOL with LT_INIT
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-25 08:35:45 -04:00