summaryrefslogtreecommitdiff
path: root/shim.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 /shim.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 'shim.c')
-rw-r--r--shim.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/shim.c b/shim.c
index 210e778a..14fb601c 100644
--- a/shim.c
+++ b/shim.c
@@ -475,44 +475,16 @@ static EFI_STATUS check_whitelist (WIN_CERTIFICATE_EFI_PKCS *cert,
static BOOLEAN secure_mode (void)
{
- EFI_STATUS status;
- EFI_GUID global_var = EFI_GLOBAL_VARIABLE;
- UINTN len;
- UINT8 *Data;
- UINT8 sb, setupmode;
-
if (user_insecure_mode)
return FALSE;
- status = get_variable(L"SecureBoot", &Data, &len, global_var);
- if (status != EFI_SUCCESS) {
+ if (variable_is_secureboot() != 1) {
if (verbose && !in_protocol)
console_notify(L"Secure boot not enabled");
return FALSE;
}
- sb = *Data;
- FreePool(Data);
-
- if (sb != 1) {
- if (verbose && !in_protocol)
- console_notify(L"Secure boot not enabled");
- return FALSE;
- }
-
- /* If we /do/ have "SecureBoot", but /don't/ have "SetupMode",
- * then the implementation is bad, but we assume that secure boot is
- * enabled according to the status of "SecureBoot". If we have both
- * of them, then "SetupMode" may tell us additional data, and we need
- * to consider it.
- */
- status = get_variable(L"SetupMode", &Data, &len, global_var);
- if (status != EFI_SUCCESS)
- return TRUE;
-
- setupmode = *Data;
- FreePool(Data);
- if (setupmode == 1) {
+ if (variable_is_setupmode() == 1) {
if (verbose && !in_protocol)
console_notify(L"Platform is in setup mode");
return FALSE;