VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms/PreferencesDialog.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-02-28 16:01:39 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-02-28 16:03:38 (GMT)
commitba1e9c8f4d6d65a5d5a73f1721bf2b03e42aa50e (patch)
treec78b35836248155ef8f2c2e6e98e93495b6b3ec1 /src/Main/Forms/PreferencesDialog.cpp
parent6e73a8a393e2cee5fb76d201d89dda542b6c4a97 (diff)
downloadVeraCrypt-ba1e9c8f4d6d65a5d5a73f1721bf2b03e42aa50e.zip
VeraCrypt-ba1e9c8f4d6d65a5d5a73f1721bf2b03e42aa50e.tar.gz
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.
Diffstat (limited to 'src/Main/Forms/PreferencesDialog.cpp')
-rwxr-xr-x[-rw-r--r--]src/Main/Forms/PreferencesDialog.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp
index e22e304..7e47b40 100644..100755
--- 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 <Pkcs5Kdf> 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());