[PATCH] tpm2: table size can be 76 when "LAML" & "LASA" are used

ivanhu ivan.hu at canonical.com
Thu Jul 23 02:21:32 UTC 2020



On 7/23/20 2:21 AM, Alex Hung wrote:
> TCG ACPI Specification released in 2017 added two fields, "Log Area
> Minimum Length" and "Log Area Start Address". When they are used, the
> table size will be 76.
> 
> Buglink: https://bugs.launchpad.net/bugs/1888189
> 
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
>  src/acpi/tpm2/tpm2.c | 35 +++++++++++++++++++----------------
>  1 file changed, 19 insertions(+), 16 deletions(-)
> 
> diff --git a/src/acpi/tpm2/tpm2.c b/src/acpi/tpm2/tpm2.c
> index bca5cb8a..56b35a1c 100644
> --- a/src/acpi/tpm2/tpm2.c
> +++ b/src/acpi/tpm2/tpm2.c
> @@ -72,22 +72,25 @@ static int tpm2_test1(fwts_framework *fw)
>  			tpm2->start_method);
>  	}
>  
> -	if (tpm2->start_method == 2 && table->length != sizeof(fwts_acpi_table_tpm2) + 4) {
> -		passed = false;
> -		fwts_failed(fw, LOG_LEVEL_HIGH,
> -			"TPM2BadPlatformParameters",
> -			"Table length must be 0x%" PRIx32 " if Start method equals 2, got 0x%" PRIx32,
> -			(uint32_t) sizeof(fwts_acpi_table_tpm2) + 4,
> -			(uint32_t) table->length);
> -	}
> -
> -	if (tpm2->start_method == 11 && table->length < sizeof(fwts_acpi_table_tpm2) + 12) {
> -		passed = false;
> -		fwts_failed(fw, LOG_LEVEL_HIGH,
> -			"TPM2BadPlatformParameters",
> -			"Table length must be atleast 0x%" PRIx32 " if Start method equals 11, got 0x%" PRIx32,
> -			(uint32_t) sizeof(fwts_acpi_table_tpm2) + 12,
> -			(uint32_t) table->length);
> +	/* When TPM2 includes fields "LAML" & "LASA", table size will be fixed to 76. */
> +	if (table->length != 76) {

>From the Spec, we shouldn't check the fixed size 76, the Start Method
Specific Parameters is variable, and both LAML and LASA are optional.

I think we should check the sizes of Start Method Specific Parameters,
LAML and LASA included or not.

Cheers,
Ivan

> +		if (tpm2->start_method == 2 && table->length != sizeof(fwts_acpi_table_tpm2) + 4) {
> +			passed = false;
> +			fwts_failed(fw, LOG_LEVEL_HIGH,
> +				"TPM2BadPlatformParameters",
> +				"Table length must be 0x%" PRIx32 " if Start Method equals 2, "
> +				"got 0x%" PRIx32, (uint32_t) sizeof(fwts_acpi_table_tpm2) + 4,
> +				(uint32_t) table->length);
> +		}
> +
> +		if (tpm2->start_method == 11 && table->length < sizeof(fwts_acpi_table_tpm2) + 12) {
> +			passed = false;
> +			fwts_failed(fw, LOG_LEVEL_HIGH,
> +				"TPM2BadPlatformParameters",
> +				"Table length must be at least 0x%" PRIx32 " if Start Method equals 11, "
> +				"got 0x%" PRIx32, (uint32_t) sizeof(fwts_acpi_table_tpm2) + 12,
> +				(uint32_t) table->length);
> +		}
>  	}
>  
>  	if (passed)
> 



More information about the fwts-devel mailing list