summaryrefslogtreecommitdiff
path: root/MokManager.c
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2016-08-03 16:53:51 +0800
committerPeter Jones <pjones@redhat.com>2016-09-09 12:07:26 -0400
commite21068b499c9fa4e75e84c0e0223dfb0575219e3 (patch)
tree293a3f05fe2deb84220c1cecfef49700787ea6e6 /MokManager.c
parent5597a493e291ef6335a400db520472d2fb59db1d (diff)
downloadefi-boot-shim-e21068b499c9fa4e75e84c0e0223dfb0575219e3.tar.gz
efi-boot-shim-e21068b499c9fa4e75e84c0e0223dfb0575219e3.zip
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 <glin@suse.com>
Diffstat (limited to 'MokManager.c')
-rw-r--r--MokManager.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/MokManager.c b/MokManager.c
index 3a9e7ba9..039a7474 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) {