VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms/VolumeCreationWizard.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2020-06-21 23:54:28 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2020-06-23 14:48:24 (GMT)
commitb4465b80e6039ef3b0bf5e93089fabf3d50f501d (patch)
tree82cf2c2038e13b4b6f5ea3906cf545e2813b46f3 /src/Main/Forms/VolumeCreationWizard.cpp
parenta29c750030da0aa258ecefb514beb5e833f8c5fd (diff)
downloadVeraCrypt-b4465b80e6039ef3b0bf5e93089fabf3d50f501d.zip
VeraCrypt-b4465b80e6039ef3b0bf5e93089fabf3d50f501d.tar.gz
Linux/MacOSX: take into account keyfiles when comparing Outer and Hidden volumes passwords
Diffstat (limited to 'src/Main/Forms/VolumeCreationWizard.cpp')
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 66556e3..240f08d 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -774,16 +774,31 @@ namespace VeraCrypt
Kdf = page->GetPkcs5Kdf();
Keyfiles = page->GetKeyfiles();
- if (forward && Password && !Password->IsEmpty())
+ if (forward && !OuterVolume && SelectedVolumeType == VolumeType::Hidden)
{
- if (!OuterVolume && SelectedVolumeType == VolumeType::Hidden)
+ shared_ptr <VolumePassword> hiddenPassword;
+ try
{
- if (*(OuterPassword.get()) == *(Password.get()))
- {
- Gui->ShowError (_("The Hidden volume password can not be identical to the Outer volume password"));
- return GetCurrentStep();
- }
+ hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password);
}
+ catch (...)
+ {
+ hiddenPassword = Password;
+ }
+
+ // check if Outer and Hidden passwords are the same
+ if ( (hiddenPassword && !hiddenPassword->IsEmpty() && OuterPassword && !OuterPassword->IsEmpty() && (*(OuterPassword.get()) == *(hiddenPassword.get())))
+ ||
+ ((!hiddenPassword || hiddenPassword->IsEmpty()) && (!OuterPassword || OuterPassword->IsEmpty()))
+ )
+ {
+ Gui->ShowError (_("The Hidden volume password can not be identical to the Outer volume password"));
+ return GetCurrentStep();
+ }
+ }
+
+ if (forward && Password && !Password->IsEmpty())
+ {
if (Password->Size() < VolumePassword::WarningSizeThreshold)
{
if (!Gui->AskYesNo (LangString["PASSWORD_LENGTH_WARNING"], false, true))
@@ -1088,8 +1103,15 @@ namespace VeraCrypt
MaxHiddenVolumeSize -= MaxHiddenVolumeSize % outerVolume->GetSectorSize(); // Must be a multiple of the sector size
- // remember Outer password in order to be able to compare it with Hidden password
- OuterPassword = Password;
+ // remember Outer password and keyfiles in order to be able to compare it with those of Hidden volume
+ try
+ {
+ OuterPassword = Keyfile::ApplyListToPassword (Keyfiles, Password);
+ }
+ catch (...)
+ {
+ OuterPassword = Password;
+ }
}
catch (exception &e)
{