Commit Graph

59 Commits

Author SHA1 Message Date
Stefan Berger
1f4c70cd3c tpm2: ACT: Extend TPM2_Getcapability with TPM_CAP_ACT
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
fd41faa54a tpm2: ACT: Add data structures, defines, and un/marshalling code
Disable ACT via the TpmProfile.h's RH_ACT_{0,1,A) settings of NO.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
bb84bfbf36 tpm2: Move CLOCK #defines into PlatformClock.h
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
5148fe63d3 tpm2: Rename OIDS.h to OIDs.h
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
eabcd048c4 tpm2: Add SEED_COMPAT_LEVEL to seeds in PERSISTENT_DATA
Add a variable seedCompatLevel to the each seed in the PERSISTENT_DATA
that allows us to track the age of the seed. Whenever a new seed
is created the seedCompatLevel is also written and set to the latest
version. This seedCompatLevel then influences the crypto algorithm that
can be used for deriving keys so that previously derived keys
are now still generated in the same way. When the seed is changed
the old keys are all useless and newly derived keys can then use
the new algorithm.

This patch only sets the variables to the current compatibility
level SEED_COMPAT_LEVEL_ORIGINAL and writes it out as part of the state
file. This makes the state file not downgradeable.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
b1bac6d212 tpm2: rev155: Add DebugHelpers and header file
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
a5866291ca tpm2: rev155: Implement new command TPM2_CertifyX509
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
77f452fd14 tpm2: rev155: Add code to create X509 RSA and EC key certificates
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
83221ed68e tpm2: rev155: Add ASN.1 related code
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
e5a67ccde9 tpm2: rev155: Remove old hash related code and definitions
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
f402d39d66 tpm2: rev155: Add OIDS.h 2020-04-14 16:03:45 -04:00
Stefan Berger
3dcaa01d0a tpm2: rev155: Major refactoring of header files
- Introduce Platform.h and replace usage of PlatformData.h and
  Platform_fp.h
- Drop Implementation.h since we now use TpmProfile.h (which we
  prepared previously); many #defines were moved to TpmTypes.h

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
ba240b3cca tpm2: rev155: Add TpmAlgorithmDefines.h (no users yet)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
a3f7213f75 tpm2: rev155: Add Platform.h (no users yet)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
d216a724c1 tpm2: rev155: Add TpmProfile.h and adjust for libtpms
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
8a0af9b12a tpm2: rev155: Add new file MinMax.h (no users yet)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-14 16:03:45 -04:00
Stefan Berger
c5ba5e1291 tpm2: Remove duplicate CryptUtil_fp.h
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-06-10 11:19:58 -04:00
Stefan Berger
8de7f334c7 tpm2: Implement helper for getting OpenSSL crypto functions
Implement helper for getting OpenSSL crypto functions from
crytpo algorithm IDs, encryption modes, and key sizes.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-05-30 12:23:05 -04:00
Stefan Berger
10d4e5fd9d tpm2: Rename NV_ROUNDUP to TPM2_ROUNDUP and move to new Utils.h
Move NV_ROUNDUP to Utils.h and call it TPM2_ROUNDUP for reuse by
other functions.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-05-23 11:39:24 -04:00
Stefan Berger
639243d60d build-sys: Remove cruft from 'check'
Remove some cruft that was useful when TPM 2 code was still in the
works but now that things have settled don't need it anymore.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-04-04 13:19:16 -04:00
Marc-André Lureau
3e591832c4 build-sys: fix grep warnings when building out-of-tree
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-04-01 11:22:03 -04:00
Stefan Berger
402fc2b1e1 tpm12: Build without support for maintentance commands
Introduce TPM_NOMAINTENANCE_COMMANDS #define to build the TPM 1.2 code
without maintenance commands support. The state for the maintenance
commands has been written out so far, so we have to leave this part
alive even though nothing can be done with the maintenance key anymore.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-04-01 10:16:25 -04:00
Marc-André Lureau
8373f09854 build-sys: add oss-fuzz support
This script will permit integration with Google OSS-FUZZ
https://github.com/google/oss-fuzz

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-03-27 14:19:37 -04: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
37196ce15a rev150: Remove obsolete CryptoHashData.h
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-01-03 13:15:44 -05:00
Stefan Berger
c8ef72d930 rev150: Replace BnEccData.c with CryptEccData.c 2019-01-03 13:15:44 -05:00
Stefan Berger
cd93aacfab tpm2: Remove NVRAM marshalling/unmarshalling test code
The test code for marshalling and unmarshalling the NVRAM hasn't
been used anymore, so remove it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2019-01-03 13:15:44 -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
e8e57e1d22 rev148: Remove unused include file
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2019-01-03 13:15:44 -05:00
Stefan Berger
67c3f36419 rev148: Add files for Cmac and Smac
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2019-01-03 13:15:44 -05:00
Stefan Berger
fcbd854ffc rev148: Some fixes to AlgorithmTest.c
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2019-01-03 13:15:44 -05:00
Stefan Berger
a48ea0a23d tpm2: Move callback invocations into their own file
Move all handling of callback invokcations in the TPM 2 code into
their own file so that we have less mixing of TPM 2 headers and
TPM 1.2 headers from the library.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2018-10-05 21:47:15 -04:00
Stefan Berger
1fe484ce67 scripting: Use #!/usr/bin/env bash rather than /bin/bash
On some systems /bin/bash does not exists but is somewhere else and can
be invoked with /usr/bin/env.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-10 16:33:34 +00:00
Stefan Berger
7a0e7052be build-sys: Pick up user-provided LDFLAGS
Pick up the user-provided LDFLAGS by assigning LDFLAGS using +=.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-10 12:22:07 -04:00
Stefan Berger
3300bbbcae build-sys: Make 'make check' work on FreeBSD
On FreeBSD we need to set the SHELL explicitly to /bin/bash since csh
is used otherwise and wouldn't allow us to run the check-local rule.
Besides that we need -shared for the check to pass. However, the FreeBSD
compiler doesn't allow us to recognize undefined symbols, which seem
to get suppressed with the -shared parameter. If the -shared is not passed
we get error messages due to undefined symbols _progname and environ from
libc.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-05 22:33:14 +00:00
Stefan Berger
314f8080d3 build-sys: Fix undefined symbol check on Darwin (OS X)
OS X needs the -shared parameter when running the undefined symbol
check.

Do not fail if a.out was not created, like on Cygwin.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-04 08:43:16 -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
b52c19e171 build-sys: Remove libtpms_tpm2_la_LDFLAGS
Remove libtpms_tpm2_la_LDFLAGS since they are not needed.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-30 17:42:29 -04: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
Marc-André Lureau
bb5d837cf8 build-sys: fix make distcheck
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-08-02 12:53:20 -04:00
Stefan Berger
1a24bcc550 build: Add missing header files for building RPM from tar file
2 header files were missing in the tar file and the RPM build failed.
This patch adds them.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-15 18:07:49 -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
37ca75c707 build-sys: remove -Wstrict-aliasing=3
The option doesn't exist with clang, and is default with gcc -Wall
already.

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
63c4a78edd tpm2: Revert NVChip memory layout to native
Get rid of all the changes to have the NvChip written in big
endian format. Remove test case.

Now the NvChip in memory holds data in native format.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-15 18:07:48 -04:00
Stefan Berger
4213dfa2d3 tpm2: Implement TPM2_ValidateState
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-15 18:07:48 -04:00
Stefan Berger
8fb8816c3c tpm2: add missing header filenames
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-15 18:07:48 -04:00
Stefan Berger
055f7f313c tpm2: make I/O buffer sizes adjustable
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-15 18:07:48 -04:00
Stefan Berger
c55d458d7c tpm2: add test for checking proper offsets in NVRAM
Add a test for checking for proper offsets in the NVRAM that
must never change.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-15 18:07:48 -04:00
Stefan Berger
fad1e91698 tpm2: Add functions to write state in big endian format
Add functions to marshal the volatile state of the TPM. We write it in
big endian format.

Add functions to write the data structure in big endian format
into NVRAM.

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