diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2018-04-23 12:56:02 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2018-04-23 16:59:40 +0200 |
commit | 4f0d1c02bdf4adf56caf48de967c41d2d4d9ff2d (patch) | |
tree | 360d2be90e73133d06037922c6267617ab77d9ff /src/Common/BaseCom.cpp | |
parent | 42e7da2e8aa86eff54667fa1e76a64b1787d68e5 (diff) | |
download | VeraCrypt-4f0d1c02bdf4adf56caf48de967c41d2d4d9ff2d.tar.gz VeraCrypt-4f0d1c02bdf4adf56caf48de967c41d2d4d9ff2d.zip |
Windows: Don't start EFI system encryption process if SecureBoot is enabled and VeraCrypt-DCS custom keys were not loaded in the machine firmware.
Diffstat (limited to 'src/Common/BaseCom.cpp')
-rw-r--r-- | src/Common/BaseCom.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp index 738e44cf..7a74e293 100644 --- a/src/Common/BaseCom.cpp +++ b/src/Common/BaseCom.cpp @@ -336,6 +336,10 @@ DWORD BaseCom::BackupEfiSystemLoader () { return GetLastError(); } + catch (UserAbort&) + { + return ERROR_CANCELLED; + } catch (Exception &e) { e.Show (NULL); @@ -400,6 +404,33 @@ DWORD BaseCom::GetEfiBootDeviceNumber (BSTR* pSdn) return ERROR_SUCCESS; } +DWORD BaseCom::GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded) +{ + if (!pSecureBootEnabled || !pVeraCryptKeysLoaded) + return ERROR_INVALID_PARAMETER; + + try + { + BootEncryption bootEnc (NULL); + bootEnc.GetSecureBootConfig (pSecureBootEnabled, pVeraCryptKeysLoaded); + } + catch (SystemException &) + { + return GetLastError(); + } + catch (Exception &e) + { + e.Show (NULL); + return ERROR_EXCEPTION_IN_SERVICE; + } + catch (...) + { + return ERROR_EXCEPTION_IN_SERVICE; + } + + return ERROR_SUCCESS; +} + DWORD BaseCom::WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg) { if (!customUserMessage) |