
On Sat, 18 Feb 2023 at 08:27, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
As described in [0] if a command requires use of an untested algorithm or functional module, the TPM performs the test and then completes the command actions.
Since we don't check for TPM_RC_NEEDS_TEST (which is the return code of the TPM in that case) and even if we would, it would complicate our TPM code for no apparent reason, add a wrapper function that performs both the selftest and the startup sequence of the TPM.
It's worth noting that this is implemented on TPMv2.0. The code for 1.2 would look similar, but I don't have a device available to test.
[0] https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Arch... ยง12.3 Self-test modes
Signed-off-by: Ilias Apalodimas ilias.apalodimas@linaro.org
Changes since v3:
- Limit comments to 80 columns
- drop extra lines from comments
include/tpm-v2.h | 16 ++++++++++++++++ include/tpm_api.h | 8 ++++++++ lib/tpm-v2.c | 25 +++++++++++++++++++++++++ lib/tpm_api.c | 8 ++++++++ 4 files changed, 57 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
(with my two patches on top)