Commit Graph

60 Commits

Author SHA1 Message Date
Stefan Berger
48b8f35b3e build-sys: Build libtpms v0.7.11
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-10-15 15:19:21 -04:00
Stefan Berger
a1ff5b1cb9 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-21 16:51:59 -04:00
Stefan Berger
be7e9f6585 build-sys: Test for functions if #defines are not found (OSSL 3)
OpenSSL 3.0 has converted several RSA-related #defines to functions, so
that AX_CHECK_DEFINE only works for OpenSSL 1.1.0 but for OpenSSL 3.0.0
we have to also use AC_CHECK_LIB to determine whether the function is
available.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-09-21 16:51:59 -04:00
Stefan Berger
9c46c6fe76 build-sys: Build libtpms v0.7.10
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-09-21 16:51:59 -04:00
Stefan Berger
fb908ef3c9 build-sys: Build libtpms v0.7.9
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-08-02 07:55:48 -04:00
Stefan Berger
3d27110964 build-sys: Run autoupdate on configure.ac for autoconf 2.71
Run autoupdate on configure.ac and address the following issues:

configure.ac:10: warning: 'AM_CONFIG_HEADER': this macro is obsolete.
configure.ac:10: You should use the 'AC_CONFIG_HEADERS' macro instead.
./lib/autoconf/general.m4:2434: AC_DIAGNOSE is expanded from...
aclocal.m4:1071: AM_CONFIG_HEADER is expanded from...
configure.ac:10: the top level
configure.ac:31: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:31: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:31: the top level
configure.ac:72: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:72: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:72: the top level
configure.ac:90: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:90: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:90: the top level
configure.ac:253: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:253: You should run autoupdate.
m4/libtool.m4:99: AC_PROG_LIBTOOL is expanded from...
configure.ac:253: the top level
configure.ac:258: warning: The macro `AC_HEADER_STDC' is obsolete.
configure.ac:258: You should run autoupdate.
./lib/autoconf/headers.m4:704: AC_HEADER_STDC is expanded from...
configure.ac:258: the top level

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-24 12:07:38 -04:00
Stefan Berger
c1fce830bf build-sys: Build libtpms v0.7.8
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-24 12:07:38 -04:00
Stefan Berger
68aa19dac7 tpm2: CryptSym: fix AES output IV
The TPM is supposed to provide the output IV in the ivInOut parameter in
CryptSymmetricEncrypt. In the case of using the openssl routines, the
output IV is missed, and the resulting output from the TPM is in the
input IV.

OpenSSL unfortunately does not export EVP_CIPHER_CTX_iv() until
tags/OpenSSL_1_1_0, so we have to fall back to the reference code for
previous OpenSSL versions.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-03-01 13:17:11 -05:00
Stefan Berger
f926190b89 build-sys: Build libtpms v0.7.7
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-03-01 13:17:11 -05:00
Stefan Berger
8b6b49ed7e build-sys: Build libtpms v0.7.6
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-02-26 21:43:46 -05:00
Stefan Berger
ff8af1d9e1 build-sys: Build libtpms v0.7.5
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-11-25 12:21:48 -05:00
Stefan Berger
937cdade6d build-sys: Build libtpms v0.7.4
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-10-30 15:24:40 -04:00
Stefan Berger
998323fe37 build-sys: Build libtpms v0.7.3 2020-06-29 08:48:04 -04:00
Stefan Berger
6050bf5899 build-sys: Build libtpms 0.7.2
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-05-23 09:37:05 -04:00
Stefan Berger
6e34b07ca6 build-sys: Build libtpms 0.7.1
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-05-18 12:18:57 -04:00
Stefan Berger
763d7a89de build-sys: Implement AX_CHECK_DEFINE and use for OpenSSL #define's
Some of the functions that OpenSSL uses are #define's for which
we need to check using a new AX_CHECK_DEFINE. We need to check for
them also because they were added at different points in time.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-06-20 12:42:58 -04:00
Stefan Berger
6ae0d8c52c tpm2: Implement key creation with OpenSSL for rand == NULL
Implement key creation with OpenSSL if rand == NULL, meaning
that we create a non-KDF-derived key, so a purely random key.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-06-20 12:23:29 -04:00
Stefan Berger
6c901e3270 build-sys: Check for RSA functions needed in OpenSSL libcrypto
Check for RSA functions we need for calling the cryto lib for
doing RSA operations. Set the environment variable
USE_OPENSSL_FUNCTIONS_RSA to '1' if found, to '0' otherwise.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-06-19 13:57:45 -04:00
Stefan Berger
73264c8442 build-sys: Add missing space at end of string
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-06-19 13:57:45 -04:00
Stefan Berger
fee2ae97bc tpm2: Use OpenSSL to create TDES keys if rand == NULL
Use OpenSSL function to create TDES keys if rand == NULL,
which indicates that a truely random key needs to be generated
rather than one derived from a KDF.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-06-19 10:12:24 -04:00
Stefan Berger
afbb327423 Implement EC key generation using OpenSSL functions if rand == NULL
Use OpenSSL functions to create EC keys only for the case that
rand == NULL in which case no KDF is being used and where we can
create a truly random key. This doesn't break the upgrade path.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-06-10 11:19:58 -04:00
Stefan Berger
55f5988781 tpm2: Switch ECDSA signature creation to OpenSSL
Use OpenSSL crypto library now also for the ECDSA signature creation.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-06-04 15:36:10 -04:00
Stefan Berger
46869d307e Switch ECDSA signature verification to OpenSSL
Switch the ECDSA signature verification to OpenSSL. Do the signature
creation in the next step so we can verify the creation / verification
against the original TPM 2 code.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-06-03 18:18:13 -04:00
Stefan Berger
4e1cd261ef build-sys: Add support for --disable-use-openssl-functions
OpenSSL's crypto library does not support all crypto functionality
we need in all versions. Elliptic curve support via EVP seems to
have been added much later than for example symmetric crypto support.
So, we move the USE_OPENSSL_FUNCTIONS out of Implementation.h
into configure.ac and let the build system detect what functionality
is available in the crypto library. In this patch we now also rename
USE_OPENSSL_FUNCTIONS to USE_OPENSSL_FUNCTIONS_SYMMETRIC to indicate
that we can use the symmetric crypto functions of the crypto lib.

Using the OpenSSL crypto support is enabled by default, so one has
to use --disable-use-openssl-functions, which we do for Travis now.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-05-30 16:25:15 -04:00
Marc-André Lureau
b214dabfc8 fuzz: better oss-fuzz integration
There were a few issues with the oss-fuzz integration from commit
8373f09854 ("build-sys: add oss-fuzz
support").

When building on OSS-Fuzz, the projects should use the provided CFLAGS
and CXXFLAGS and don't append any extra sanitization / fuzzing flags.

$LIB_FUZZING_ENGINE is defined to set the library to link to, and it
is a c++ library, so we should build fuzzer with c++...

Now --enable-fuzzer is only used for -fsanitize=fuzzer.

Add a tests/fuzz-main.c as fallback, to run the corpus on other builds.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-04-01 11:22:03 -04:00
Stefan Berger
af7e924372 Bump up the revision of the library for next version to 0.7.0
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-03-18 21:14:49 -04:00
Stefan Berger
d9ea4ea3c3 build-sys: Allow user to pass CFLAGS
Allow the user to pass in the CFLAGS. Previously they were overwritten
with -O2 -g, which are the default CFLAGS if none are passed.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-01-09 11:51:41 -05:00
Stefan Berger
139925229d build-sys: Add support for --enable-test-coverage to configure
Add support for --enable-test-coverage that sets additional CFLAGS
and LDFLAGS.

gcov creates files with suffixes .gcov, .gcno, and .gcda that we
need clean up in a few directories.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-01-09 11:51:41 -05:00
Stefan Berger
6b444ad3ff rev148: Rework how the TPM internal clock works
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2019-01-03 13:15:44 -05:00
Stefan Berger
be9b50f1f8 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-29 19:50:35 -04:00
Stefan Berger
dd9c2f2138 build-sys: Only use AX_CHECK_LINK_FLAG with autoconf >= 2.64
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-10-06 11:00:26 -04:00
Stefan Berger
79275ce87c 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 21:47:15 -04:00
Stefan Berger
59f46464d5 build-sys: work around broken linker when testing --version-script support
The linker on FreeBSD seems to be broken and fails for other reasons
when testing for support of the --version-script flag. The error
that is reported is:

local symbol 'environ' in /usr/lib/crt1.o is referenced by DSO.

Also __progname is needed.

To work around this problem we add a test.syms file that only has
these two symbols in it, which is enough for the test in
configure.ac and gives version script support in case of the
broken linker.

On FreeBSD TPM 1.2 related tests were failing due to test case 6
failures in case no linker script was used. (Very odd.) This patch
fixes this problem.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 21:45:16 +00:00
Stefan Berger
27904459e3 build-sys: Check for supported linker flag --version-script
Check whether the linker supports the linker flag --version-script.
The OS X linkwer does not seem to support it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 13:24:54 -04:00
Stefan Berger
b6a89b2f55 build-sys: Use X="$X ..." rather than X+="..." in configure.ac
Some configure interpreters do not like X+="...", so we have to
use X="$X ..." instead.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-29 17:47:25 +00:00
Stefan Berger
83ca1948bc configure.ac: Replace tests with '==' through '='
On NetBSD configure.ac cannot have '==' in tests. So we have to replace them
with '='.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-29 12:12:57 +00:00
Stefan Berger
38a7d1951f pkg-config: add cryptolib to libtpms.pc
Add the cryptolib libtpms has been compiled with to libtpms.pc[.in]

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-03 13:06:29 -04:00
Marc-André Lureau
48dabdbdef tests: add fuzz test
See README for details on how to use.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-06-15 18:07:49 -04:00
Marc-André Lureau
ec0f7ed195 build-sys: move hardening linker flags to ldflags
Fixes unusued flags warnings with clang.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-06-15 18:07:49 -04:00
Stefan Berger
88dfea52cf tpm2: Build libtpms with TPM 2 code now
Now that patches for writing the state into files and extensions
to their headers have all been applied we can build the TPM 2
code into the library.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-15 18:07:48 -04:00
Stefan Berger
3cf528aaac Integrate the TPM 2 into the library; do not compile with TPM 2 yet
Introduce --with-tpm2 for ./configure to enable building with
TPM 2 functionality. Delay the building of TPM 2 code until more
patches are applied and the vTPM state that's created has a chance
of being backwards compatible.

Extend the libtpms API to allow user to choose version of TPM.

Missing functionality at this point:
- TPM 2 needs to be extended to serialize and deserialize its volatile state
- Handling of the establishment bit

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-15 18:07:47 -04:00
Stefan Berger
b19b6ed343 Fix compilation errors in the TPM 2 code
Fix compilation errors in the TPM 2 code.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-15 18:07:47 -04:00
Stefan Berger
ccce8b5f49 Add TPM 2 code
Add TPM 2 code.

This is rev. 142 code.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-15 18:07:47 -04:00
Stefan Berger
d9d83de2d3 build-sys: Add AC_CONFIG_AUX_DIR to configure.ac
The Travis build of swtpm now has a problem due to missing ltmain.sh. Add
AC_CONFIG_AUX_DIR to configure.ac to resolve the issue.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-05-27 20:37:34 -04:00
Stefan Berger
1279e39eb8 build: Only add -Wall -Werror etc. if user did not set CFLAGS explicitly
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-10-12 12:46:34 -04:00
Stefan Berger
a1cde166f9 build: disable -Wstack-protector
Some version of gcc fail with -Wstack-protector due to some functions
not being protectable. Disable this option.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-01-12 15:40:32 -05:00
Stefan Berger
23b958af05 Move TPM1.2 code to src/tpm12 directory
Move all TPM1.2 code to src/tpm12 directory. Adapt the Makefile.am
to point to tpm12 directory for the TPM1.2 sources.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-07 19:14:30 -05:00
Stefan Berger
61ee460356 Version bump to 0.6.0
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-07 19:14:30 -05:00
Stefan Berger
769fb37a25 build: Simplify the check for -fstack-protector-strong
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-10-26 11:28:25 -04:00
Stefan Berger
3251bfba69 build: Check for -fstack-protector-strong before using it
Import AX_CHECK_COMPILE_FLAG to help check for compiler option
-fstack-protector-strong.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-10-26 09:50:46 -04:00