Windows: Don't allow Hidden volume to have the same password, PIM and keyfiles as Outer volume
This commit is contained in:
parent
4a5d1f4f46
commit
cf449a443e
|
@ -1438,6 +1438,7 @@
|
||||||
<entry lang="en" key="IDT_BENCHMARK">Benchmark:</entry>
|
<entry lang="en" key="IDT_BENCHMARK">Benchmark:</entry>
|
||||||
<entry lang="en" key="IDC_DISABLE_MOUNT_MANAGER">Only create virtual device without mounting on selected drive letter</entry>
|
<entry lang="en" key="IDC_DISABLE_MOUNT_MANAGER">Only create virtual device without mounting on selected drive letter</entry>
|
||||||
<entry lang="en" key="LEGACY_PASSWORD_UTF8_TOO_LONG">The entered password is too long: its UTF-8 representation exceeds 64 bytes.</entry>
|
<entry lang="en" key="LEGACY_PASSWORD_UTF8_TOO_LONG">The entered password is too long: its UTF-8 representation exceeds 64 bytes.</entry>
|
||||||
|
<entry kang="en" key="HIDDEN_CREDS_SAME_AS_OUTER">The Hidden volume can't have the same password, PIM and keyfiles as the Outer volume</entry>
|
||||||
</localization>
|
</localization>
|
||||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
<xs:element name="VeraCrypt">
|
<xs:element name="VeraCrypt">
|
||||||
|
|
|
@ -233,10 +233,12 @@ BOOL bKeybLayoutAltKeyWarningShown = FALSE; /* TRUE if the user has been informe
|
||||||
BOOL bWarnOuterVolSuitableFileSys = TRUE;
|
BOOL bWarnOuterVolSuitableFileSys = TRUE;
|
||||||
|
|
||||||
Password volumePassword; /* User password */
|
Password volumePassword; /* User password */
|
||||||
|
Password outerVolumePassword; /* Outer volume user password */
|
||||||
char szVerify[MAX_PASSWORD + 1]; /* Tmp password buffer */
|
char szVerify[MAX_PASSWORD + 1]; /* Tmp password buffer */
|
||||||
char szRawPassword[MAX_PASSWORD + 1]; /* Password before keyfile was applied to it */
|
char szRawPassword[MAX_PASSWORD + 1]; /* Password before keyfile was applied to it */
|
||||||
|
|
||||||
int volumePim = 0;
|
int volumePim = 0;
|
||||||
|
int outerVolumePim = 0;
|
||||||
|
|
||||||
BOOL bHistoryCmdLine = FALSE; /* History control is always disabled */
|
BOOL bHistoryCmdLine = FALSE; /* History control is always disabled */
|
||||||
BOOL ComServerMode = FALSE;
|
BOOL ComServerMode = FALSE;
|
||||||
|
@ -411,7 +413,7 @@ static BOOL ElevateWholeWizardProcess (wstring arguments)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WipePasswordsAndKeyfiles (void)
|
static void WipePasswordsAndKeyfiles (bool bFull)
|
||||||
{
|
{
|
||||||
wchar_t tmp[MAX_PASSWORD+1];
|
wchar_t tmp[MAX_PASSWORD+1];
|
||||||
|
|
||||||
|
@ -428,6 +430,12 @@ static void WipePasswordsAndKeyfiles (void)
|
||||||
burn (&CmdVolumePassword, sizeof (CmdVolumePassword));
|
burn (&CmdVolumePassword, sizeof (CmdVolumePassword));
|
||||||
burn (&CmdVolumePim, sizeof (CmdVolumePim));
|
burn (&CmdVolumePim, sizeof (CmdVolumePim));
|
||||||
|
|
||||||
|
if (bFull)
|
||||||
|
{
|
||||||
|
burn (&outerVolumePassword, sizeof (outerVolumePassword));
|
||||||
|
burn (&outerVolumePim, sizeof (outerVolumePim));
|
||||||
|
}
|
||||||
|
|
||||||
SetWindowText (hPasswordInputField, L"");
|
SetWindowText (hPasswordInputField, L"");
|
||||||
SetWindowText (hVerifyPasswordInputField, L"");
|
SetWindowText (hVerifyPasswordInputField, L"");
|
||||||
|
|
||||||
|
@ -475,7 +483,7 @@ static void localcleanup (void)
|
||||||
WipeAbort();
|
WipeAbort();
|
||||||
|
|
||||||
|
|
||||||
WipePasswordsAndKeyfiles ();
|
WipePasswordsAndKeyfiles (true);
|
||||||
|
|
||||||
RandStop (TRUE);
|
RandStop (TRUE);
|
||||||
|
|
||||||
|
@ -709,7 +717,7 @@ static BOOL ChangeWizardMode (int newWizardMode)
|
||||||
// If the previous mode was different, the password may have been typed using a different
|
// If the previous mode was different, the password may have been typed using a different
|
||||||
// keyboard layout (which might confuse the user and cause other problems if system encryption
|
// keyboard layout (which might confuse the user and cause other problems if system encryption
|
||||||
// was or will be involved).
|
// was or will be involved).
|
||||||
WipePasswordsAndKeyfiles();
|
WipePasswordsAndKeyfiles(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newWizardMode != WIZARD_MODE_NONSYS_DEVICE)
|
if (newWizardMode != WIZARD_MODE_NONSYS_DEVICE)
|
||||||
|
@ -6619,7 +6627,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
{
|
{
|
||||||
// Keyboard layout is not standard US
|
// Keyboard layout is not standard US
|
||||||
|
|
||||||
WipePasswordsAndKeyfiles ();
|
WipePasswordsAndKeyfiles (true);
|
||||||
|
|
||||||
SetPassword (hCurPage, IDC_PASSWORD, szRawPassword);
|
SetPassword (hCurPage, IDC_PASSWORD, szRawPassword);
|
||||||
SetPassword (hCurPage, IDC_VERIFY, szVerify);
|
SetPassword (hCurPage, IDC_VERIFY, szVerify);
|
||||||
|
@ -7659,6 +7667,18 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
nNewPageNo = PIM_PAGE;
|
nNewPageNo = PIM_PAGE;
|
||||||
volumePim = 0;
|
volumePim = 0;
|
||||||
|
|
||||||
|
if (!CreatingHiddenSysVol() && bHiddenVol && !bHiddenVolHost)
|
||||||
|
{
|
||||||
|
if ( (volumePim == outerVolumePim)
|
||||||
|
&& (volumePassword.Length == outerVolumePassword.Length)
|
||||||
|
&& (0 == memcmp (volumePassword.Text, outerVolumePassword.Text, volumePassword.Length))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Warning ("HIDDEN_CREDS_SAME_AS_OUTER", hwndDlg);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (SysEncInEffect ())
|
if (SysEncInEffect ())
|
||||||
{
|
{
|
||||||
nNewPageNo = SYSENC_COLLECTING_RANDOM_DATA_PAGE - 1; // Skip irrelevant pages
|
nNewPageNo = SYSENC_COLLECTING_RANDOM_DATA_PAGE - 1; // Skip irrelevant pages
|
||||||
|
@ -7689,6 +7709,18 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CreatingHiddenSysVol() && bHiddenVol && !bHiddenVolHost)
|
||||||
|
{
|
||||||
|
if ( (volumePim == outerVolumePim)
|
||||||
|
&& (volumePassword.Length == outerVolumePassword.Length)
|
||||||
|
&& (0 == memcmp (volumePassword.Text, outerVolumePassword.Text, volumePassword.Length))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Warning ("HIDDEN_CREDS_SAME_AS_OUTER", hwndDlg);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (volumePassword.Length > 0)
|
if (volumePassword.Length > 0)
|
||||||
{
|
{
|
||||||
// Password character encoding
|
// Password character encoding
|
||||||
|
@ -7856,8 +7888,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
bHiddenVolHost = FALSE;
|
bHiddenVolHost = FALSE;
|
||||||
bHiddenVolFinished = FALSE;
|
bHiddenVolFinished = FALSE;
|
||||||
|
|
||||||
|
// save the outer volume password to use it for comparison with hidden volume one
|
||||||
|
memcpy (&outerVolumePassword, &volumePassword, sizeof (volumePassword));
|
||||||
|
outerVolumePim = volumePim;
|
||||||
|
|
||||||
// Clear the outer volume password
|
// Clear the outer volume password
|
||||||
WipePasswordsAndKeyfiles ();
|
WipePasswordsAndKeyfiles (false);
|
||||||
|
|
||||||
RestoreDefaultKeyFilesParam ();
|
RestoreDefaultKeyFilesParam ();
|
||||||
|
|
||||||
|
@ -8587,7 +8623,7 @@ retryCDDriveCheck:
|
||||||
|
|
||||||
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString ("CANCEL"));
|
SetWindowTextW (GetDlgItem (MainDlg, IDCANCEL), GetString ("CANCEL"));
|
||||||
bHiddenVolFinished = FALSE;
|
bHiddenVolFinished = FALSE;
|
||||||
WipePasswordsAndKeyfiles ();
|
WipePasswordsAndKeyfiles (true);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -8689,8 +8725,12 @@ retryCDDriveCheck:
|
||||||
|
|
||||||
nNewPageNo = HIDDEN_VOL_HOST_PRE_CIPHER_PAGE;
|
nNewPageNo = HIDDEN_VOL_HOST_PRE_CIPHER_PAGE;
|
||||||
|
|
||||||
|
// save the outer volume password to use it for comparison with hidden volume one
|
||||||
|
memcpy (&outerVolumePassword, &volumePassword, sizeof (volumePassword));
|
||||||
|
outerVolumePim = volumePim;
|
||||||
|
|
||||||
// Clear the outer volume password
|
// Clear the outer volume password
|
||||||
WipePasswordsAndKeyfiles ();
|
WipePasswordsAndKeyfiles (false);
|
||||||
|
|
||||||
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), TRUE);
|
EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), TRUE);
|
||||||
NormalCursor ();
|
NormalCursor ();
|
||||||
|
@ -10437,9 +10477,11 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
|
||||||
atexit (localcleanup);
|
atexit (localcleanup);
|
||||||
|
|
||||||
VirtualLock (&volumePassword, sizeof(volumePassword));
|
VirtualLock (&volumePassword, sizeof(volumePassword));
|
||||||
|
VirtualLock (&outerVolumePassword, sizeof(outerVolumePassword));
|
||||||
VirtualLock (szVerify, sizeof(szVerify));
|
VirtualLock (szVerify, sizeof(szVerify));
|
||||||
VirtualLock (szRawPassword, sizeof(szRawPassword));
|
VirtualLock (szRawPassword, sizeof(szRawPassword));
|
||||||
VirtualLock (&volumePim, sizeof(volumePim));
|
VirtualLock (&volumePim, sizeof(volumePim));
|
||||||
|
VirtualLock (&outerVolumePim, sizeof(outerVolumePim));
|
||||||
VirtualLock (&CmdVolumePassword, sizeof (CmdVolumePassword));
|
VirtualLock (&CmdVolumePassword, sizeof (CmdVolumePassword));
|
||||||
|
|
||||||
VirtualLock (MasterKeyGUIView, sizeof(MasterKeyGUIView));
|
VirtualLock (MasterKeyGUIView, sizeof(MasterKeyGUIView));
|
||||||
|
|
Loading…
Reference in New Issue