VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/UserPreferences.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/UserPreferences.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/UserPreferences.cpp')
-rwxr-xr-x[-rw-r--r--]src/Main/UserPreferences.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Main/UserPreferences.cpp b/src/Main/UserPreferences.cpp
index b8a4d70..f66d8be 100644..100755
--- a/src/Main/UserPreferences.cpp
+++ b/src/Main/UserPreferences.cpp
@@ -104,6 +104,24 @@ namespace VeraCrypt
TC_CONFIG_SET (UseKeyfiles);
TC_CONFIG_SET (WipeCacheOnAutoDismount);
TC_CONFIG_SET (WipeCacheOnClose);
+
+ SetValue (configMap[L"DefaultTrueCryptMode"], DefaultMountOptions.TrueCryptMode);
+
+ wstring defaultPrf;
+ SetValue (configMap[L"DefaultPRF"], defaultPrf);
+
+ shared_ptr <Pkcs5Kdf> savedKdf;
+ try
+ {
+ if (defaultPrf != L"autodetection")
+ savedKdf = Pkcs5Kdf::GetAlgorithm (defaultPrf, DefaultMountOptions.TrueCryptMode);
+ }
+ catch (ParameterIncorrect&)
+ {
+ }
+
+ DefaultMountOptions.Kdf = savedKdf;
+ DefaultMountOptions.ProtectionKdf = savedKdf;
}
// Default keyfiles
@@ -200,6 +218,13 @@ namespace VeraCrypt
TC_CONFIG_ADD (UseKeyfiles);
TC_CONFIG_ADD (WipeCacheOnAutoDismount);
TC_CONFIG_ADD (WipeCacheOnClose);
+
+ formatter.AddEntry (L"DefaultTrueCryptMode", DefaultMountOptions.TrueCryptMode);
+
+ wstring defaultPrf = L"autodetection";
+ if (DefaultMountOptions.Kdf)
+ defaultPrf = DefaultMountOptions.Kdf->GetName ();
+ formatter.AddEntry (L"DefaultPRF", defaultPrf);
XmlWriter writer (Application::GetConfigFilePath (GetPreferencesFileName(), true));
writer.WriteNode (formatter.XmlConfig);