summaryrefslogtreecommitdiffstats
path: root/lib/sha1.c
diff options
context:
space:
mode:
authorAlexander Steffen <Alexander.Steffen@infineon.com>2017-08-31 19:18:58 +0200
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2017-10-18 17:28:47 +0200
commit125a2210541079e8e7c69e629ad06cabed788f8c (patch)
tree74ea7471ab12e431ff67c2faf3f2080dbff463bd /lib/sha1.c
parenttpm: Use dynamic delay to wait for TPM 2.0 self test result (diff)
downloadlinux-125a2210541079e8e7c69e629ad06cabed788f8c.tar.xz
linux-125a2210541079e8e7c69e629ad06cabed788f8c.zip
tpm: React correctly to RC_TESTING from TPM 2.0 self tests
The TPM can choose one of two ways to react to the TPM2_SelfTest command. It can either run all self tests synchronously and then return RC_SUCCESS once all tests were successful. Or it can choose to run the tests asynchronously and return RC_TESTING immediately while the self tests still execute in the background. The previous implementation apparently was not aware of those possibilities and attributed RC_TESTING to some prototype chips instead. With this change the return code of TPM2_SelfTest is interpreted correctly, i.e. the self test result is polled if and only if RC_TESTING is received. Unfortunately, the polling cannot be done in the most straightforward way. If RC_TESTING is received, ideally the code should now poll the selfTestDone bit in the STS register, as this avoids sending more commands, that might interrupt self tests executing in the background and thus prevent them from ever completing. But it cannot be guaranteed that this bit is correctly implemented for all devices, so the next best thing would be to use TPM2_GetTestResult to query the test result. But the response to that command can be very long, and the code currently lacks the capabilities for efficient unmarshalling, so it is difficult to execute this command. Therefore, we simply run the TPM2_SelfTest command in a loop, which should complete eventually, since we only request the execution of self tests that have not yet been done. Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'lib/sha1.c')
0 files changed, 0 insertions, 0 deletions