]> git.proxmox.com Git - libtpms.git/commit
tpm2: Handle failures better
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Sat, 11 Nov 2017 04:02:28 +0000 (23:02 -0500)
committerStefan Berger <stefanb@linux.vnet.ibm.com>
Fri, 15 Jun 2018 22:07:48 +0000 (18:07 -0400)
commitd4b9d10ce9663e947442b163f99e15a9e7ec1a86
tree009cb76ffdca7677f17e401bf53af685808cbd51
parent055f7f313c26c3ebb07a31ac93b89b2d8feeb797
tpm2: Handle failures better

The current TpmFail() implementation invokes longjmp() at the end
and crashes with a segmentation fault if setjmp() wasn't called before.
To avoid this we implement TpmSetFailureMode() that logs the failure and
sets the TPM into failure mode. Since NVRAM may set failure mode before
the CryptInit() is called, we need to make sure we don't reset the failure
mode variable in case CryptInit() succeeds. In this case we now call the
FAIL_NOCMD() macro.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
src/tpm2/GpMacros.h
src/tpm2/NVReserved.c
src/tpm2/StartupCommands.c
src/tpm2/TpmFail.c
src/tpm2/TpmFail_fp.h