diff options
| author | Jan Setje-Eilers <jan.setjeeilers@oracle.com> | 2021-03-26 21:19:14 -0700 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2021-03-27 18:47:31 -0400 |
| commit | 08a0ce01dbe9945287f37a9b139b25f46c53f878 (patch) | |
| tree | 6cdf4a08eaa95153c1706dfa769fbfd0a428b9b5 /sbat.c | |
| parent | ab934ec5874235aaf2204570c1e0dc6a1ab75d26 (diff) | |
| download | efi-boot-shim-08a0ce01dbe9945287f37a9b139b25f46c53f878.tar.gz efi-boot-shim-08a0ce01dbe9945287f37a9b139b25f46c53f878.zip | |
Move the check for the SBAT variable properties to its own function.
This moves the check for the SBAT variable's attributes and contents
into its own function, so that test cases can be written against it.
Signed-off-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
Diffstat (limited to 'sbat.c')
| -rw-r--r-- | sbat.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -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); |
