summaryrefslogtreecommitdiff
path: root/src/security/tpm/tss/vendor/cr50/cr50.h
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2020-05-06 11:11:03 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-05-08 15:30:31 +0000
commit71a131415e2063d0e8414782b263e04bb5dc818b (patch)
tree7f2bb5292eda0bec0144d07811a7c7eb4d45e15c /src/security/tpm/tss/vendor/cr50/cr50.h
parentf8f5650873451f64eab84d4b20248419bc19a0f5 (diff)
downloadcoreboot-71a131415e2063d0e8414782b263e04bb5dc818b.tar.xz
security: tcg-2.0: Ignore data payload for errors, fix Cr50 boot mode
This patch improves the response buffer handling for TPM 2.0. Previously we would allow any command to return no payload, but if there was a payload we would always try to unmarshal it according to the normal success response. This was sort of relying on the fact that the TPM usually returns no additional data after the header for error responses, but in practice that is not always true. It also means that commands without a response payload accidentally work by default even though we did not explicitly add unmarshallig support for them, which seems undesirable. Adding explicit unmarshalling support for TPM2_SelfTest which was only supported through this loophole before. This patch changes the behavior to always accept any amount of payload data for error responses but not unmarshal any of it. None of our use cases actually care about payload data for errors, so it seems safer to not even try to interpret it. For success responses, on the other hand, we always require support for the command to be explicitly added. This fixes a problem with the Cr50 GET_BOOT_MODE command where an error response would only return the subcommand code but no data after that. Also add support for a second, slightly different NO_SUCH_COMMAND error code that was added in Cr50 recently. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ib85032d85482d5484180be6fd105f2467f393cd2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/41100 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/security/tpm/tss/vendor/cr50/cr50.h')
-rw-r--r--src/security/tpm/tss/vendor/cr50/cr50.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/security/tpm/tss/vendor/cr50/cr50.h b/src/security/tpm/tss/vendor/cr50/cr50.h
index 0f91732856..e3146a421f 100644
--- a/src/security/tpm/tss/vendor/cr50/cr50.h
+++ b/src/security/tpm/tss/vendor/cr50/cr50.h
@@ -21,6 +21,7 @@
#define VENDOR_RC_ERR 0x00000500
enum cr50_vendor_rc {
VENDOR_RC_INTERNAL_ERROR = (VENDOR_RC_ERR | 6),
+ VENDOR_RC_NO_SUCH_SUBCOMMAND = (VENDOR_RC_ERR | 8),
VENDOR_RC_NO_SUCH_COMMAND = (VENDOR_RC_ERR | 127),
};