-
Notifications
You must be signed in to change notification settings - Fork 3
Description
After choosing "Delete System76 and Microsoft keys (Use your own)" in the firmware setup menu, both System76 and Microsoft keys can still be seen with sbkeysync from Linux.
The code hints that only PK is deleted and the computer is immediately rebooted, but the keys of System76 and Microsoft are not actually deleted:
| key = KEY_SECURE_BOOT_DELETE_PK; |
edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
Lines 4521 to 4523 in 42a443d
| case KEY_SECURE_BOOT_DELETE_PK: | |
| Status = DeletePlatformKey(); | |
| break; |
edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
Lines 4842 to 4858 in 42a443d
| case KEY_SECURE_BOOT_DELETE_PK: | |
| //GetVariable2 (EFI_SETUP_MODE_NAME, &gEfiGlobalVariableGuid, (VOID**)&SetupMode, NULL); | |
| //if (SetupMode == NULL || (*SetupMode) == SETUP_MODE) { | |
| // IfrNvData->DeletePk = TRUE; | |
| // IfrNvData->HasPk = FALSE; | |
| // *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; | |
| //} else { | |
| // IfrNvData->DeletePk = FALSE; | |
| // IfrNvData->HasPk = TRUE; | |
| // *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY; | |
| //} | |
| //if (SetupMode != NULL) { | |
| // FreePool (SetupMode); | |
| //} | |
| // XXX: Is this safe? | |
| gRT->ResetSystem(EfiResetCold, Status, 0, NULL); | |
| break; |
I would expect all these steps to be performed to actually delete vendor keys:
edk2/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
Lines 4181 to 4210 in 42a443d
| // Clear all the keys and databases | |
| Status = DeleteDb (); | |
| if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { | |
| DEBUG ((DEBUG_ERROR, "Fail to clear DB: %r\n", Status)); | |
| return Status; | |
| } | |
| Status = DeleteDbx (); | |
| if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { | |
| DEBUG ((DEBUG_ERROR, "Fail to clear DBX: %r\n", Status)); | |
| return Status; | |
| } | |
| Status = DeleteDbt (); | |
| if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { | |
| DEBUG ((DEBUG_ERROR, "Fail to clear DBT: %r\n", Status)); | |
| return Status; | |
| } | |
| Status = DeleteKEK (); | |
| if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { | |
| DEBUG ((DEBUG_ERROR, "Fail to clear KEK: %r\n", Status)); | |
| return Status; | |
| } | |
| Status = DeletePlatformKey (); | |
| if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { | |
| DEBUG ((DEBUG_ERROR, "Fail to clear PK: %r\n", Status)); | |
| return Status; | |
| } |