From e21068b499c9fa4e75e84c0e0223dfb0575219e3 Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Wed, 3 Aug 2016 16:53:51 +0800 Subject: [PATCH] MokManager: Try APPEND_WRITE first Try to append the MOK/MOKX list first and then fallback to the normal SetVariable if the firmware doesn't support EFI_VARIABLE_APPEND_WRITE. Signed-off-by: Gary Lin --- MokManager.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MokManager.c b/MokManager.c index 3a9e7ba..039a747 100644 --- a/MokManager.c +++ b/MokManager.c @@ -872,6 +872,16 @@ static EFI_STATUS write_db (CHAR16 *db_name, void *MokNew, UINTN MokNewSize) UINTN old_size; UINTN new_size; + status = uefi_call_wrapper(RT->SetVariable, 5, db_name, + &shim_lock_guid, + EFI_VARIABLE_NON_VOLATILE + | EFI_VARIABLE_BOOTSERVICE_ACCESS + | EFI_VARIABLE_APPEND_WRITE, + MokNewSize, MokNew); + if (status == EFI_SUCCESS || status != EFI_INVALID_PARAMETER) { + return status; + } + status = get_variable_attr(db_name, (UINT8 **)&old_data, &old_size, shim_lock_guid, &attributes); if (EFI_ERROR(status) && status != EFI_NOT_FOUND) {