From 2e445ad1af7cfcbebffdec8863afac2faef748fa Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Wed, 10 Nov 2021 17:43:45 -0700 Subject: security/tpm/tcg-2.0: Handle TPM_RC_NV_RANGE return code As per the TPM spec, if offset and the size field of data add to a value that is greater than the dataSize field of the NV Index referenced by nvIndex, the TPM shall return an error (TPM_RC_NV_RANGE). Handle the TPM error and map it to an appropriate vboot error. BUG=None TEST=Build and boot to OS in Guybrush. Signed-off-by: Karthikeyan Ramasubramanian Change-Id: I8b403e2f33cc1368065cc21f73df1102695f73eb Reviewed-on: https://review.coreboot.org/c/coreboot/+/59134 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu Reviewed-by: Tim Wawrzynczak Reviewed-by: Julius Werner Reviewed-by: Raul Rangel --- src/security/tpm/tss/tcg-2.0/tss.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/security/tpm/tss/tcg-2.0/tss.c') diff --git a/src/security/tpm/tss/tcg-2.0/tss.c b/src/security/tpm/tss/tcg-2.0/tss.c index cfa533b880..8c9d12f7b0 100644 --- a/src/security/tpm/tss/tcg-2.0/tss.c +++ b/src/security/tpm/tss/tcg-2.0/tss.c @@ -242,6 +242,9 @@ uint32_t tlcl_read(uint32_t index, void *data, uint32_t length) case TPM_RC_CR50_NV_UNDEFINED: return TPM_E_BADINDEX; + case TPM_RC_NV_RANGE: + return TPM_E_RANGE; + default: return TPM_E_READ_FAILURE; } -- cgit v1.2.3