[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GRUB PATCH RFC 11/18] efi: Add a function to read EFI variables with at
From: |
Daniel Kiper |
Subject: |
[GRUB PATCH RFC 11/18] efi: Add a function to read EFI variables with attributes |
Date: |
Tue, 5 May 2020 01:21:25 +0200 |
It will be used to properly detect and report UEFI Secure Boot status to
the x86 Linux kernel. The functionality will be added by subsequent patches.
Signed-off-by: Ignat Korchagin <address@hidden>
Signed-off-by: Daniel Kiper <address@hidden>
---
grub-core/kern/efi/efi.c | 16 +++++++++++++---
include/grub/efi/efi.h | 5 +++++
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 81bc49f84..7eeac6019 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -223,8 +223,11 @@ grub_efi_set_variable(const char *var, const
grub_efi_guid_t *guid,
}
grub_efi_status_t
-grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
- grub_size_t *datasize_out, void **data_out)
+grub_efi_get_variable_with_attributes (const char *var,
+ const grub_efi_guid_t *guid,
+ grub_size_t *datasize_out,
+ void **data_out,
+ grub_efi_uint32_t *attributes)
{
grub_efi_status_t status;
grub_efi_uintn_t datasize = 0;
@@ -261,7 +264,7 @@ grub_efi_get_variable (const char *var, const
grub_efi_guid_t *guid,
return GRUB_EFI_OUT_OF_RESOURCES;
}
- status = efi_call_5 (r->get_variable, var16, guid, NULL, &datasize, data);
+ status = efi_call_5 (r->get_variable, var16, guid, attributes, &datasize,
data);
grub_free (var16);
if (status == GRUB_EFI_SUCCESS)
@@ -275,6 +278,13 @@ grub_efi_get_variable (const char *var, const
grub_efi_guid_t *guid,
return status;
}
+grub_efi_status_t
+grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
+ grub_size_t *datasize_out, void **data_out)
+{
+ return grub_efi_get_variable_with_attributes (var, guid, datasize_out,
data_out, NULL);
+}
+
#pragma GCC diagnostic ignored "-Wcast-align"
/* Search the mods section from the PE32/PE32+ image. This code uses
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 8b2a0f1f5..83d958f99 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -74,6 +74,11 @@ grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map)
(grub_efi_uintn_t memo
grub_efi_uintn_t
descriptor_size,
grub_efi_uint32_t
descriptor_version,
grub_efi_memory_descriptor_t *virtual_map);
+grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable_with_attributes) (const
char *variable,
+ const
grub_efi_guid_t *guid,
+
grub_size_t *datasize_out,
+ void
**data_out,
+
grub_efi_uint32_t *attributes);
grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable) (const char *variable,
const grub_efi_guid_t
*guid,
grub_size_t
*datasize_out,
--
2.11.0
- [GRUB PATCH RFC 00/18] i386: Intel TXT secure launcher, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 03/18] i386/msr: Extract and improve MSR support detection code, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 05/18] i386/memory: Rename PAGE_SIZE to GRUB_PAGE_SIZE and make it global, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 04/18] i386/memory: Rename PAGE_SHIFT to GRUB_PAGE_SHIFT, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 01/18] i386/msr: Merge rdmsr.h and wrmsr.h into msr.h, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 06/18] mmap: Add grub_mmap_get_lowest() and grub_mmap_get_highest(), Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 09/18] efi: Make shim_lock GUID and protocol type public, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 10/18] efi: Return grub_efi_status_t from grub_efi_get_variable(), Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 11/18] efi: Add a function to read EFI variables with attributes,
Daniel Kiper <=
- [GRUB PATCH RFC 13/18] i386/slaunch: Add basic platform support for secure launch, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 14/18] i386/txt: Add Intel TXT definitions header file, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 17/18] i386/txt: Add Intel TXT verification routines, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 16/18] i386/txt: Add Intel TXT ACM module support, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 18/18] i386/slaunch: Add secure launch framework and commands, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 02/18] i386/msr: Rename grub_msr_read() and grub_msr_write(), Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 07/18] i386/tpm: Rename tpm module to tpm_verifier, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 08/18] i386/tpm: Add TPM TIS and CRB driver, Daniel Kiper, 2020/05/04
- [GRUB PATCH RFC 12/18] i386/efi: Report UEFI Secure Boot status to the Linux kernel, Daniel Kiper, 2020/05/04