Implement TPMLIB_ValidateState(), which is supposed to be used
for checking usability of state blobs before TPMLIB_MainInit()
is called or TPM_Startup has been sent to the TPM.
This function is useful to be called once TPM state blobs
have been migrated to a destination and we need to check
whether libtpms can use these state blobs and if not
we have a chance to fall back to the migration source host.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Extend the previous support of a fixed buffer size to work
with a minimum of 3k and a maximum of 4k.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Also allow to get the minimum and maximum supported buffer size
with the TPMLIB_SetBufferSize() call.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Implement TPMLIB_SetBufferSize() for setting the size of the I/O buffer
that the TPM may advertise. For TPM 1.2 the size remains fixed since the
TIS interface can handle the current 4096 bytes.
This function will be important for TPM 2 with a CRB interface that cannot
handle 4096 bytes.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
When checking for missing symbols we need to add -lc to the libraries
passed to gcc otherwise we always see lots of missing symbols even if
there aren't any.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
LibreSSL on OpenBSD seems to not support the new API of OpenSSL 1.1.
So create a new #define OPENSSL_OLD_API that is set if the old API
is to be used.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Integrate the Travis CI automated build & test with Coverity Scan.
Automatically submit a Coverity Scan if we push to the coverity_scan
branch.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Ignore *.log and *.trs files from the test suite.
Ignore compile and the 'missing' file.
Remove the depcomp file.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Fix the dprintf call to use a format parameter that otherwise causes
errors with gcc on certain platforms.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Fix compilation problems like the following:
/usr/local/lib/libtpms.so: undefined reference to `va_start'
/usr/local/lib/libtpms.so: undefined reference to `va_end'
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
vdprintf with a NULL parameter on the 3rd position crashes
on Linux. Replace it with dprintf.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Add API calls TPMLIB_SetDebugFD(), TPMLIB_SetDebugLevel(),
TPMLIB_SetDebugPrefix().
Convert the internal printing of debugging strings to
correspond to the log level. Print the prefix in front
of every line.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Use 'rpmbuild -ba --define "crypto_subsystem openssl" dist/libtpms.spec'
to build libtpms with openssl.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Add debian build files to enable building of Debian package using for example
debuild -b or dpkg-buildpackage -us -uc
Extend the .gitignore.
The debhelper checks show warnings and errors that will need to be addressed
some other time. For some I don't know how to solve them at the moment.
Signed-off-by: Stefan Berger <stefanb@linux.watson.ibm.com>
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>
Introduce an internal interface that allows us to reach TPM functionality
from the libary's API layer. This prepares the code for the addition
of a new API function that lets us choose which TPM to use, TPM 1.2 or
TPM2. Currently only TPM 1.2 functionality is available.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
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>
Add a virtual provide libtpms-freebl or libtpms-openssl to
indicate which crypto library libtpms is using.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Disable the volatile storage debug for a debug build since this
causes the volatile state file to be written and this changes
the behavior upon a restart of the TPM. This may cause the TPM to
not work correctly then.
Print out some more build parameters.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>