summaryrefslogtreecommitdiff
path: root/lib/variables.c
diff options
context:
space:
mode:
authorGary Ching-Pang Lin <glin@suse.com>2014-06-25 10:55:12 -0400
committerPeter Jones <pjones@redhat.com>2014-06-25 10:55:12 -0400
commit7a72592b75879542e9ebd808868f83a78bdfbbc6 (patch)
tree91a742bd16007f364dd5a4b278e221a699c9ca69 /lib/variables.c
parent3b414422277f5a47c5fdd2d260eff8329d280ce8 (diff)
downloadefi-boot-shim-7a72592b75879542e9ebd808868f83a78bdfbbc6.tar.gz
efi-boot-shim-7a72592b75879542e9ebd808868f83a78bdfbbc6.zip
Check the secure variables with the lib functions
There are functions defined in lib to check the secure variables. Use the functions to shun the duplicate code. Signed-off-by: Gary Ching-Pang Lin <glin@suse.com> Conflicts: shim.c
Diffstat (limited to 'lib/variables.c')
-rw-r--r--lib/variables.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/variables.c b/lib/variables.c
index 3a9735e6..4c64d7e4 100644
--- a/lib/variables.c
+++ b/lib/variables.c
@@ -284,9 +284,12 @@ variable_is_setupmode(void)
/* set to 1 because we return true if SetupMode doesn't exist */
UINT8 SetupMode = 1;
UINTN DataSize = sizeof(SetupMode);
+ EFI_STATUS status;
- uefi_call_wrapper(RT->GetVariable, 5, L"SetupMode", &GV_GUID, NULL,
- &DataSize, &SetupMode);
+ status = uefi_call_wrapper(RT->GetVariable, 5, L"SetupMode", &GV_GUID, NULL,
+ &DataSize, &SetupMode);
+ if (EFI_ERROR(status))
+ return 1;
return SetupMode;
}
@@ -297,10 +300,13 @@ variable_is_secureboot(void)
/* return false if variable doesn't exist */
UINT8 SecureBoot = 0;
UINTN DataSize;
+ EFI_STATUS status;
DataSize = sizeof(SecureBoot);
- uefi_call_wrapper(RT->GetVariable, 5, L"SecureBoot", &GV_GUID, NULL,
- &DataSize, &SecureBoot);
+ status = uefi_call_wrapper(RT->GetVariable, 5, L"SecureBoot", &GV_GUID, NULL,
+ &DataSize, &SecureBoot);
+ if (EFI_ERROR(status))
+ return 0;
return SecureBoot;
}