From 305d327c25490bb51a39580126ac2ff500519f76 Mon Sep 17 00:00:00 2001 From: Vadim Sukhomlinov Date: Fri, 28 Apr 2023 09:37:20 -0700 Subject: cr50: set EPS seed length in NV state upon creation Currently EPS seed when created during endorsement is immediately stored to flash and copied to global state of TPM. However, its length in state is not set. It seems that it was ok as state eventually was reloaded from NV and size updated. But if TPM receives command shortly after boot this may not be the case. BUG=b:278028110,b:262324344 TEST=make; TCG tests Change-Id: Ifac259ea3817d6d139d9b5ba2af4fc66d07df4ef Signed-off-by: Vadim Sukhomlinov Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4489113 Commit-Queue: Vadim Sukhomlinov Auto-Submit: Vadim Sukhomlinov Reviewed-by: Vadim Bendebury Commit-Queue: Vadim Bendebury Code-Coverage: Vadim Sukhomlinov Reviewed-by: Andrey Pronin Reviewed-by: Vadim Sukhomlinov Commit-Queue: Andrey Pronin Tested-by: Vadim Sukhomlinov --- board/cr50/tpm2/endorsement.c | 1 + 1 file changed, 1 insertion(+) diff --git a/board/cr50/tpm2/endorsement.c b/board/cr50/tpm2/endorsement.c index 9c066e10be..20cdf24715 100644 --- a/board/cr50/tpm2/endorsement.c +++ b/board/cr50/tpm2/endorsement.c @@ -489,6 +489,7 @@ static int store_eps(const uint8_t eps[PRIMARY_SEED_SIZE]) { /* gp is a TPM global state structure, declared in Global.h. */ memcpy(gp.EPSeed.t.buffer, eps, PRIMARY_SEED_SIZE); + gp.EPSeed.t.size = PRIMARY_SEED_SIZE; /* Persist the seed to flash. */ NvWriteReserved(NV_EP_SEED, &gp.EPSeed); -- cgit v1.2.1