Disable secure boot
| 176 | |
| 177 | // Disable secure boot |
| 178 | VOID DisableSecureBoot(VOID) |
| 179 | { |
| 180 | EFI_STATUS Status; |
| 181 | CHAR16 *ErrorString = NULL; |
| 182 | // Check in user mode |
| 183 | if (gSettings.SecureBootSetupMode || !gSettings.SecureBoot) { |
| 184 | return; |
| 185 | } |
| 186 | UninstallSecureBoot(); |
| 187 | // Clear the platform database |
| 188 | Status = ClearSecureBootKeys(); |
| 189 | if (EFI_ERROR(Status)) { |
| 190 | ErrorString = L"Failed to clear platform database!\nIs Clover platform database owner?"; |
| 191 | } else if (YesNoMessage(L"Disable Secure Boot", L"Do you want to clear all databases (suggested)?")) { |
| 192 | // Clear all databases if wanted |
| 193 | Status = SetSignatureDatabase(EXCHANGE_DATABASE_NAME, &EXCHANGE_DATABASE_GUID, NULL, 0); |
| 194 | if (EFI_ERROR(Status)) { |
| 195 | DisableMessage(Status, L"Failed to disable secure boot!", L"Failed to clear exchange database!"); |
| 196 | } |
| 197 | Status = ClearAuthorizedDatabase(); |
| 198 | if (EFI_ERROR(Status)) { |
| 199 | ErrorString = L"Failed to clear authorized database!"; |
| 200 | } |
| 201 | } |
| 202 | // Alert failure to user |
| 203 | if (EFI_ERROR(Status)) { |
| 204 | DisableMessage(Status, L"Failed to disable secure boot!", ErrorString); |
| 205 | } else { |
| 206 | // Reinit secure boot now |
| 207 | InitializeSecureBoot(); |
| 208 | PrintSecureBootInfo(); |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | // The previous protocol functions |
| 213 | STATIC EFI_SECURITY_FILE_AUTHENTICATION_STATE gSecurityFileAuthentication; |
no test coverage detected