summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Coulson <chris.coulson@canonical.com>2019-06-22 15:37:29 +0100
committerPeter Jones <pjones@redhat.com>2020-07-23 20:53:24 -0400
commit9f80be9f16a854e3946568fa92edebe26eb79e78 (patch)
treed94970752f5a560057dd0e9b112c09e1d020bb6d
parent6fd8db6bb3b23b9e41f109135253f77263071f46 (diff)
downloadefi-boot-shim-9f80be9f16a854e3946568fa92edebe26eb79e78.tar.gz
efi-boot-shim-9f80be9f16a854e3946568fa92edebe26eb79e78.zip
tpm: Define EFI_VARIABLE_DATA_TREE as packed
tpm_measure_variable() calculates VarLogSize by adding the size of VarName and VarData to the size of EFI_VARIABLE_DATA_TREE, and then subtracting the size of the UnicodeName and VariableData members. This results in a calculation that is 5 bytes larger than necessary because it doesn't take in to account the padding of these members. The effect of this is that shim measures an additional 5 zero bytes when measuring UEFI variables (at least on 64-bit architectures). Byte packing EFI_VARIABLE_DATA_TREE fixes this. Upstream-commit-id: 7e4d3f1c8c7
-rw-r--r--tpm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tpm.c b/tpm.c
index 516fb876..c0617bb4 100644
--- a/tpm.c
+++ b/tpm.c
@@ -233,7 +233,7 @@ typedef struct {
UINT64 VariableDataLength;
CHAR16 UnicodeName[1];
INT8 VariableData[1];
-} EFI_VARIABLE_DATA_TREE;
+} __attribute__ ((packed)) EFI_VARIABLE_DATA_TREE;
static BOOLEAN tpm_data_measured(CHAR16 *VarName, EFI_GUID VendorGuid, UINTN VarSize, VOID *VarData)
{