diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-02-28 17:01:39 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-02-28 17:03:38 +0100 |
commit | ba1e9c8f4d6d65a5d5a73f1721bf2b03e42aa50e (patch) | |
tree | c78b35836248155ef8f2c2e6e98e93495b6b3ec1 /src/Main/UserPreferences.cpp | |
parent | 6e73a8a393e2cee5fb76d201d89dda542b6c4a97 (diff) | |
download | VeraCrypt-ba1e9c8f4d6d65a5d5a73f1721bf2b03e42aa50e.tar.gz VeraCrypt-ba1e9c8f4d6d65a5d5a73f1721bf2b03e42aa50e.zip |
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.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Main/UserPreferences.cpp b/src/Main/UserPreferences.cpp index b8a4d704..f66d8bef 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); |