mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Windows: Show only supported encryption algorithm in the system encryption wizard for MBR
This commit is contained in:
@@ -73,21 +73,21 @@ static EncryptionAlgorithm EncryptionAlgorithms[] =
|
|||||||
|
|
||||||
#ifndef TC_WINDOWS_BOOT
|
#ifndef TC_WINDOWS_BOOT
|
||||||
|
|
||||||
{ { 0, 0 }, { 0, 0}, 0 }, // Must be all-zero
|
{ { 0, 0 }, { 0, 0}, 0, 0 }, // Must be all-zero
|
||||||
{ { AES, 0 }, { XTS, 0 }, 1 },
|
{ { AES, 0 }, { XTS, 0 }, 1, 1 },
|
||||||
{ { SERPENT, 0 }, { XTS, 0 }, 1 },
|
{ { SERPENT, 0 }, { XTS, 0 }, 1, 1 },
|
||||||
{ { TWOFISH, 0 }, { XTS, 0 }, 1 },
|
{ { TWOFISH, 0 }, { XTS, 0 }, 1, 1 },
|
||||||
{ { CAMELLIA, 0 }, { XTS, 0 }, 1 },
|
{ { CAMELLIA, 0 }, { XTS, 0 }, 1, 1 },
|
||||||
#if defined(CIPHER_GOST89)
|
#if defined(CIPHER_GOST89)
|
||||||
{ { GOST89, 0 }, { XTS, 0 }, 1 },
|
{ { GOST89, 0 }, { XTS, 0 }, 0, 1 },
|
||||||
#endif // defined(CIPHER_GOST89)
|
#endif // defined(CIPHER_GOST89)
|
||||||
{ { KUZNYECHIK, 0 }, { XTS, 0 }, 1 },
|
{ { KUZNYECHIK, 0 }, { XTS, 0 }, 0, 1 },
|
||||||
{ { TWOFISH, AES, 0 }, { XTS, 0 }, 1 },
|
{ { TWOFISH, AES, 0 }, { XTS, 0 }, 1, 1 },
|
||||||
{ { SERPENT, TWOFISH, AES, 0 }, { XTS, 0 }, 1 },
|
{ { SERPENT, TWOFISH, AES, 0 }, { XTS, 0 }, 1, 1 },
|
||||||
{ { AES, SERPENT, 0 }, { XTS, 0 }, 1 },
|
{ { AES, SERPENT, 0 }, { XTS, 0 }, 1, 1 },
|
||||||
{ { AES, TWOFISH, SERPENT, 0 }, { XTS, 0 }, 1 },
|
{ { AES, TWOFISH, SERPENT, 0 }, { XTS, 0 }, 1, 1 },
|
||||||
{ { SERPENT, TWOFISH, 0 }, { XTS, 0 }, 1 },
|
{ { SERPENT, TWOFISH, 0 }, { XTS, 0 }, 1, 1 },
|
||||||
{ { 0, 0 }, { 0, 0}, 0 } // Must be all-zero
|
{ { 0, 0 }, { 0, 0}, 0, 0 } // Must be all-zero
|
||||||
|
|
||||||
#else // TC_WINDOWS_BOOT
|
#else // TC_WINDOWS_BOOT
|
||||||
|
|
||||||
@@ -684,6 +684,12 @@ int EAIsFormatEnabled (int ea)
|
|||||||
return EncryptionAlgorithms[ea].FormatEnabled;
|
return EncryptionAlgorithms[ea].FormatEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TC_WINDOWS_BOOT
|
||||||
|
int EAIsMbrSysEncEnabled (int ea)
|
||||||
|
{
|
||||||
|
return EncryptionAlgorithms[ea].MbrSysEncEnabled;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Returns TRUE if the mode of operation is supported for the encryption algorithm
|
// Returns TRUE if the mode of operation is supported for the encryption algorithm
|
||||||
BOOL EAIsModeSupported (int ea, int testedMode)
|
BOOL EAIsModeSupported (int ea, int testedMode)
|
||||||
|
|||||||
@@ -133,6 +133,9 @@ typedef struct
|
|||||||
{
|
{
|
||||||
int Ciphers[4]; // Null terminated array of ciphers used by encryption algorithm
|
int Ciphers[4]; // Null terminated array of ciphers used by encryption algorithm
|
||||||
int Modes[LAST_MODE_OF_OPERATION + 1]; // Null terminated array of modes of operation
|
int Modes[LAST_MODE_OF_OPERATION + 1]; // Null terminated array of modes of operation
|
||||||
|
#ifndef TC_WINDOWS_BOOT
|
||||||
|
BOOL MbrSysEncEnabled;
|
||||||
|
#endif
|
||||||
int FormatEnabled;
|
int FormatEnabled;
|
||||||
} EncryptionAlgorithm;
|
} EncryptionAlgorithm;
|
||||||
|
|
||||||
@@ -348,6 +351,9 @@ int EAGetLastCipher (int ea);
|
|||||||
int EAGetNextCipher (int ea, int previousCipherId);
|
int EAGetNextCipher (int ea, int previousCipherId);
|
||||||
int EAGetPreviousCipher (int ea, int previousCipherId);
|
int EAGetPreviousCipher (int ea, int previousCipherId);
|
||||||
int EAIsFormatEnabled (int ea);
|
int EAIsFormatEnabled (int ea);
|
||||||
|
#ifndef TC_WINDOWS_BOOT
|
||||||
|
int EAIsMbrSysEncEnabled (int ea);
|
||||||
|
#endif
|
||||||
BOOL EAIsModeSupported (int ea, int testedMode);
|
BOOL EAIsModeSupported (int ea, int testedMode);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4060,6 +4060,9 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
int ea, hid;
|
int ea, hid;
|
||||||
wchar_t buf[100];
|
wchar_t buf[100];
|
||||||
|
BOOL bIsGPT = FALSE;
|
||||||
|
if (SysEncInEffect ())
|
||||||
|
bIsGPT = BootEncObj->GetSystemDriveConfiguration().SystemPartition.IsGPT;
|
||||||
|
|
||||||
// Encryption algorithms
|
// Encryption algorithms
|
||||||
|
|
||||||
@@ -4072,7 +4075,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea))
|
for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea))
|
||||||
{
|
{
|
||||||
if (EAIsFormatEnabled (ea))
|
if (EAIsFormatEnabled (ea) && (!SysEncInEffect () || bIsGPT || EAIsMbrSysEncEnabled (ea)))
|
||||||
AddComboPair (GetDlgItem (hwndDlg, IDC_COMBO_BOX), EAGetName (buf, ea, 1), ea);
|
AddComboPair (GetDlgItem (hwndDlg, IDC_COMBO_BOX), EAGetName (buf, ea, 1), ea);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4086,7 +4089,6 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
if (SysEncInEffect ())
|
if (SysEncInEffect ())
|
||||||
{
|
{
|
||||||
BOOL bIsGPT = BootEncObj->GetSystemDriveConfiguration().SystemPartition.IsGPT;
|
|
||||||
hash_algo = bIsGPT? SHA512 : DEFAULT_HASH_ALGORITHM_BOOT;
|
hash_algo = bIsGPT? SHA512 : DEFAULT_HASH_ALGORITHM_BOOT;
|
||||||
RandSetHashFunction (hash_algo);
|
RandSetHashFunction (hash_algo);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user