From ba1e9c8f4d6d65a5d5a73f1721bf2b03e42aa50e Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 28 Feb 2015 17:01:39 +0100 Subject: Linux/MacOSX: A configuration option for default hash and default TrueCrypt mode used for mounting volumes (Menu Settings -> Default Mount Parameters). Implement priority of command line arguments over default values. --- src/Main/Forms/PreferencesDialog.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) mode change 100644 => 100755 src/Main/Forms/PreferencesDialog.cpp (limited to 'src/Main/Forms/PreferencesDialog.cpp') diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp old mode 100644 new mode 100755 index e22e304b..7e47b408 --- a/src/Main/Forms/PreferencesDialog.cpp +++ b/src/Main/Forms/PreferencesDialog.cpp @@ -48,6 +48,23 @@ namespace VeraCrypt MountRemovableCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.Removable)); FilesystemOptionsTextCtrl->SetValue (Preferences.DefaultMountOptions.FilesystemOptions); + + TrueCryptModeCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.TrueCryptMode)); + + int index, prfInitialIndex = 0; + Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]); + + foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false)) + { + index = Pkcs5PrfChoice->Append (kdf.GetName()); + if (Preferences.DefaultMountOptions.Kdf + && (Preferences.DefaultMountOptions.Kdf->GetName() == kdf.GetName()) + ) + { + prfInitialIndex = index; + } + } + Pkcs5PrfChoice->Select (prfInitialIndex); // Keyfiles TC_CHECK_BOX_VALIDATOR (UseKeyfiles); @@ -342,12 +359,29 @@ namespace VeraCrypt #endif if (!Validate()) return; + + shared_ptr selectedKdf; + if (Pkcs5PrfChoice->GetSelection () != 0) + { + try + { + selectedKdf = Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection ()), TrueCryptModeCheckBox->IsChecked ()); + } + catch (ParameterIncorrect&) + { + Gui->ShowWarning ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"); + return; + } + } TransferDataFromWindow(); Preferences.DefaultMountOptions.Protection = MountReadOnlyCheckBox->IsChecked() ? VolumeProtection::ReadOnly : VolumeProtection::None; Preferences.DefaultMountOptions.FilesystemOptions = FilesystemOptionsTextCtrl->GetValue(); Preferences.DefaultKeyfiles = *DefaultKeyfilesPanel->GetKeyfiles(); + + Preferences.DefaultMountOptions.Kdf = selectedKdf; + Preferences.DefaultMountOptions.ProtectionKdf = selectedKdf; bool securityTokenModuleChanged = (Preferences.SecurityTokenModule != wstring (Pkcs11ModulePathTextCtrl->GetValue())); Preferences.SecurityTokenModule = wstring (Pkcs11ModulePathTextCtrl->GetValue()); -- cgit v1.2.3