util/smmstoretool: Properly initialise the authenticated variable header

MonotonicCount is required, or UEFITool fails to parse the store.
TimeStamp is required for variables with authenticated attributes.

Change-Id: Iea933c9943ec18ea773700cdf1e3bede0e8ef292
Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88424
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Benjamin Doron 2025-07-11 17:11:40 -04:00 committed by Matt DeVillier
commit 2181b02765
2 changed files with 4 additions and 1 deletions

View file

@ -73,7 +73,6 @@ bool fv_init(struct mem_range_t fv)
++vol_hdr_dst->Checksum;
const VARIABLE_STORE_HEADER var_store_hdr = {
// Authentication-related fields will be filled with 0xff.
.Signature = EfiAuthenticatedVariableGuid,
// Actual size of the storage is block size, the rest is
// Fault Tolerant Write (FTW) space and the FTW spare space.

View file

@ -110,6 +110,10 @@ static void store_var(const struct var_t *var, bool is_auth_var_store, uint8_t *
hdr.NameSize = var->name_size;
hdr.DataSize = var->data_size;
hdr.MonotonicCount = 0;
memset(&hdr.TimeStamp, 0, sizeof(hdr.TimeStamp));
//hdr.PubKeyIndex = 0;
memcpy(data, &hdr, sizeof(hdr));
data += sizeof(hdr);
} else {