tpm: add TPM2_PCR_Allocate command
authorRaymond Mao <raymond.mao@linaro.org>
Mon, 27 Jan 2025 14:58:47 +0000 (06:58 -0800)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Tue, 28 Jan 2025 06:58:41 +0000 (08:58 +0200)
commit9d2bc92ba7bba25bb7827848aa4c51534aff904c
tree142b807da1741c511f568376bcdf6d97763b0e67
parent6d8e52a6e350e1dbf450d02fccdb2ac2b0c036e4
tpm: add TPM2_PCR_Allocate command

TPM2_PCR_Allocate command is required to reconfigure a TPM device
to enable or disable algorithms in run-time, thus this patch introduces
the implementation of PCR allocate APIs and adds related cmd functions
for testing.

To test the feature, ensure that TPM is started up.
Run pcr_allocate command to turn on/off an algorithm, multiple calls
are supported and all changes will be cached:
`tpm2 pcr_allocate <algorithm_name> <on|off>`
Run startup command with argument 'off' to shutdown the TPM.
`tpm2 startup TPM2_SU_CLEAR off`
Reboot the board via `reset` to activate the changes.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
cmd/tpm-v2.c
include/tpm-v2.h
lib/tpm-v2.c