From patchwork Tue Jul 14 16:08:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 241453 List-Id: U-Boot discussion From: xypron.glpk at gmx.de (Heinrich Schuchardt) Date: Tue, 14 Jul 2020 18:08:15 +0200 Subject: [PATCH v2 1/1] efi_loader: update secure state Message-ID: <20200714160815.102524-1-xypron.glpk@gmx.de> Update the UEFI secure state when variable 'PK' is updated in the TEE variables implementation. Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- v2: simplify the logic for handling return codes --- lib/efi_loader/efi_variable_tee.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.27.0 diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c index 24e0663ebd..ddefa93f8f 100644 --- a/lib/efi_loader/efi_variable_tee.c +++ b/lib/efi_loader/efi_variable_tee.c @@ -557,6 +557,12 @@ efi_status_t efi_set_variable_int(u16 *variable_name, const efi_guid_t *vendor, var_property.maxsize = var_acc->data_size; ret = set_property_int(variable_name, name_size, vendor, &var_property); } + + if (alt_ret != EFI_SUCCESS) + goto out; + + if (!u16_strcmp(variable_name, L"PK")) + alt_ret = efi_init_secure_state(); out: free(comm_buf); return alt_ret == EFI_SUCCESS ? ret : alt_ret; @@ -716,5 +722,9 @@ efi_status_t efi_init_variables(void) MM_VARIABLE_COMMUNICATE_SIZE + max_payload_size; + ret = efi_init_secure_state(); + if (ret != EFI_SUCCESS) + return ret; + return EFI_SUCCESS; }