summaryrefslogtreecommitdiff
path: root/sbat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbat.c')
-rw-r--r--sbat.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sbat.c b/sbat.c
index 89c08417..7bd0e4ec 100644
--- a/sbat.c
+++ b/sbat.c
@@ -304,6 +304,14 @@ check_sbat_var_attributes(UINT32 attributes)
#endif
}
+bool
+preserve_sbat_uefi_variable(UINT8 *sbat, UINTN sbatsize, UINT32 attributes)
+{
+ return check_sbat_var_attributes(attributes) &&
+ sbatsize >= strlen(SBAT_VAR_SIG "1") &&
+ strncmp((const char *)sbat, SBAT_VAR_SIG, strlen(SBAT_VAR_SIG));
+}
+
EFI_STATUS
set_sbat_uefi_variable(void)
{
@@ -323,10 +331,7 @@ set_sbat_uefi_variable(void)
*/
if (EFI_ERROR(efi_status)) {
dprint(L"SBAT read failed %r\n", efi_status);
- } else if (check_sbat_var_attributes(attributes) &&
- sbatsize >= strlen(SBAT_VAR_SIG "1") &&
- strncmp((const char *)sbat, SBAT_VAR_SIG,
- strlen(SBAT_VAR_SIG))) {
+ } else if (preserve_sbat_uefi_variable(sbat, sbatsize, attributes)) {
dprint("SBAT variable is %d bytes, attributes are 0x%08x\n",
sbatsize, attributes);
FreePool(sbat);