diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-01-26 10:14:09 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-02-08 10:07:33 +0100 |
commit | d01fa1198337f0f088c2b61484eb6678bb363598 (patch) | |
tree | 1d00add99f768d398265f9e8f5f8fb2211880b93 /src/Main | |
parent | 3d8d088b0646688fe567a36d5ab4a033e2d4505a (diff) | |
download | VeraCrypt-d01fa1198337f0f088c2b61484eb6678bb363598.tar.gz VeraCrypt-d01fa1198337f0f088c2b61484eb6678bb363598.zip |
Linux/MacOSX: use command line values of TrueCryptMode and PRF as defaults for the password dialog
Diffstat (limited to 'src/Main')
-rw-r--r-- | src/Main/Forms/ChangePasswordDialog.cpp | 4 | ||||
-rw-r--r-- | src/Main/Forms/MainFrame.cpp | 10 | ||||
-rw-r--r-- | src/Main/Forms/MountOptionsDialog.cpp | 4 | ||||
-rw-r--r-- | src/Main/Forms/VolumePasswordPanel.cpp | 20 | ||||
-rw-r--r-- | src/Main/Forms/VolumePasswordPanel.h | 2 | ||||
-rw-r--r-- | src/Main/Forms/VolumePasswordWizardPage.cpp | 2 |
6 files changed, 33 insertions, 9 deletions
diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp index 1889e5cb..d4a8853f 100644 --- a/src/Main/Forms/ChangePasswordDialog.cpp +++ b/src/Main/Forms/ChangePasswordDialog.cpp @@ -48,11 +48,11 @@ namespace VeraCrypt throw ParameterIncorrect (SRC_POS); } - CurrentPasswordPanel = new VolumePasswordPanel (this, password, false, keyfiles, false, true, true, false, true, true); + CurrentPasswordPanel = new VolumePasswordPanel (this, NULL, password, false, keyfiles, false, true, true, false, true, true); CurrentPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND); - NewPasswordPanel = new VolumePasswordPanel (this, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf); + NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf); NewPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); NewPasswordPanelSizer->Add (NewPasswordPanel, 1, wxALL | wxEXPAND); diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp index ca4d7d63..08184005 100644 --- a/src/Main/Forms/MainFrame.cpp +++ b/src/Main/Forms/MainFrame.cpp @@ -664,6 +664,11 @@ namespace VeraCrypt MountOptions mountOptions (GetPreferences().DefaultMountOptions); mountOptions.SlotNumber = SelectedSlotNumber; mountOptions.Path = GetSelectedVolumePath(); + mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; + if (CmdLine->ArgHash) + { + mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, CmdLine->ArgTrueCryptMode); + } try { @@ -881,6 +886,11 @@ namespace VeraCrypt SetVolumePath (favorite.Path); MountOptions mountOptions (GetPreferences().DefaultMountOptions); + mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; + if (CmdLine->ArgHash) + { + mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, CmdLine->ArgTrueCryptMode); + } favorite.ToMountOptions (mountOptions); shared_ptr <VolumeInfo> volume = Gui->MountVolume (mountOptions); diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp index d4c78cb6..e60492e1 100644 --- a/src/Main/Forms/MountOptionsDialog.cpp +++ b/src/Main/Forms/MountOptionsDialog.cpp @@ -30,7 +30,7 @@ namespace VeraCrypt if (disableMountOptions) OptionsButton->Show (false); - PasswordPanel = new VolumePasswordPanel (this, options.Password, disableMountOptions, options.Keyfiles, !disableMountOptions, true, true, false, true, true); + PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, disableMountOptions, options.Keyfiles, !disableMountOptions, true, true, false, true, true); PasswordPanel->SetCacheCheckBoxValidator (wxGenericValidator (&Options.CachePassword)); PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND); @@ -61,7 +61,7 @@ namespace VeraCrypt OptionsButton->SetLabel (OptionsButtonLabel + L" >"); OptionsPanel->Show (false); - ProtectionPasswordPanel = new VolumePasswordPanel (OptionsPanel, options.ProtectionPassword, true, options.ProtectionKeyfiles, false, true, true, false, true, true, _("P&assword to hidden volume:")); + ProtectionPasswordPanel = new VolumePasswordPanel (OptionsPanel, &options, options.ProtectionPassword, true, options.ProtectionKeyfiles, false, true, true, false, true, true, _("P&assword to hidden volume:")); ProtectionPasswordSizer->Add (ProtectionPasswordPanel, 1, wxALL | wxEXPAND); UpdateDialog(); diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp index e4582763..deab2803 100644 --- a/src/Main/Forms/VolumePasswordPanel.cpp +++ b/src/Main/Forms/VolumePasswordPanel.cpp @@ -14,7 +14,7 @@ namespace VeraCrypt { - VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel) + VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel) : VolumePasswordPanelBase (parent), Keyfiles (new KeyfileList) { if (keyfiles) @@ -67,8 +67,14 @@ namespace VeraCrypt HeaderWipeCountText->Show (enablePkcs5Prf && !isMountPassword); HeaderWipeCount->Show (enablePkcs5Prf && !isMountPassword); + if (options && !disableTruecryptMode) + { + TrueCryptModeCheckBox->SetValue (options->TrueCryptMode); + } + if (enablePkcs5Prf) { + int index, prfInitialIndex = 0; if (isMountPassword) { // case of password for mounting @@ -78,9 +84,17 @@ namespace VeraCrypt foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false)) { if (!kdf.IsDeprecated() || isMountPassword) - Pkcs5PrfChoice->Append (kdf.GetName()); + { + index = Pkcs5PrfChoice->Append (kdf.GetName()); + if (isMountPassword && options && options->Kdf + && (options->Kdf->GetName() == kdf.GetName()) + ) + { + prfInitialIndex = index; + } + } } - Pkcs5PrfChoice->Select (0); + Pkcs5PrfChoice->Select (prfInitialIndex); } if (!enablePkcs5Prf || (!enablePassword && !enableKeyfiles)) diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h index c3e59da1..4cd338c5 100644 --- a/src/Main/Forms/VolumePasswordPanel.h +++ b/src/Main/Forms/VolumePasswordPanel.h @@ -18,7 +18,7 @@ namespace VeraCrypt class VolumePasswordPanel : public VolumePasswordPanelBase { public: - VolumePasswordPanel (wxWindow* parent, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, bool isMountPassword = false, const wxString &passwordLabel = wxString()); + VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, bool isMountPassword = false, const wxString &passwordLabel = wxString()); virtual ~VolumePasswordPanel (); void AddKeyfile (shared_ptr <Keyfile> keyfile); diff --git a/src/Main/Forms/VolumePasswordWizardPage.cpp b/src/Main/Forms/VolumePasswordWizardPage.cpp index 0f80ce8d..c1f91604 100644 --- a/src/Main/Forms/VolumePasswordWizardPage.cpp +++ b/src/Main/Forms/VolumePasswordWizardPage.cpp @@ -15,7 +15,7 @@ namespace VeraCrypt VolumePasswordWizardPage::VolumePasswordWizardPage (wxPanel* parent, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableConfirmation) : VolumePasswordWizardPageBase (parent), ConfirmationMode (enableConfirmation) { - PasswordPanel = new VolumePasswordPanel (this, password, true, keyfiles, false, true, true, enableConfirmation, !enableConfirmation, !enableConfirmation); + PasswordPanel = new VolumePasswordPanel (this, NULL, password, true, keyfiles, false, true, true, enableConfirmation, !enableConfirmation, !enableConfirmation); PasswordPanel->UpdateEvent.Connect (EventConnector <VolumePasswordWizardPage> (this, &VolumePasswordWizardPage::OnPasswordPanelUpdate)); PasswordPanelSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND); |