Skip to content

"Delete System76 and Microsoft keys (Use your own)" doesn't actually delete them #40

@gentoo-root

Description

@gentoo-root

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:


case KEY_SECURE_BOOT_DELETE_PK:
Status = DeletePlatformKey();
break;

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:

// 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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions