VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Core/MountOptions.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-30 17:01:49 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-30 17:06:20 +0100
commitc178e325b807258199ae45b2c50c265b4d7ce7af (patch)
tree905297a12e86b71d4611ff13d1df7e99c1e20b61 /src/Core/MountOptions.cpp
parent8d787dcd7128fce554f473da62e20162b0b6c9c4 (diff)
downloadVeraCrypt-c178e325b807258199ae45b2c50c265b4d7ce7af.tar.gz
VeraCrypt-c178e325b807258199ae45b2c50c265b4d7ce7af.zip
Linux/MacOSX: Implement TrueCrypt conversion and loading support. Correct many GTK issues linked to multi-threaded origine of events by implementing an automatic mechanism for handling such requests in the main thread.
Diffstat (limited to 'src/Core/MountOptions.cpp')
-rw-r--r--[-rwxr-xr-x]src/Core/MountOptions.cpp57
1 files changed, 33 insertions, 24 deletions
diff --git a/src/Core/MountOptions.cpp b/src/Core/MountOptions.cpp
index fb813bf0..844d72b4 100755..100644
--- a/src/Core/MountOptions.cpp
+++ b/src/Core/MountOptions.cpp
@@ -46,6 +46,7 @@ namespace VeraCrypt
TC_CLONE (SharedAccessAllowed);
TC_CLONE (SlotNumber);
TC_CLONE (UseBackupHeaders);
+ TC_CLONE (TrueCryptMode);
}
void MountOptions::Deserialize (shared_ptr <Stream> stream)
@@ -72,14 +73,6 @@ namespace VeraCrypt
Password = Serializable::DeserializeNew <VolumePassword> (stream);
else
Password.reset();
-
- if (!sr.DeserializeBool ("KdfNull"))
- {
- sr.Deserialize ("Kdf", nameValue);
- Kdf = Pkcs5Kdf::GetAlgorithm (nameValue);
- }
- else
- Kdf.reset();
if (!sr.DeserializeBool ("PathNull"))
Path.reset (new VolumePath (sr.DeserializeWString ("Path")));
@@ -96,19 +89,33 @@ namespace VeraCrypt
else
ProtectionPassword.reset();
- if (!sr.DeserializeBool ("ProtectionKdfNull"))
- {
- sr.Deserialize ("ProtectionKdf", nameValue);
- ProtectionKdf = Pkcs5Kdf::GetAlgorithm (nameValue);
- }
- else
- ProtectionKdf.reset();
-
ProtectionKeyfiles = Keyfile::DeserializeList (stream, "ProtectionKeyfiles");
sr.Deserialize ("Removable", Removable);
sr.Deserialize ("SharedAccessAllowed", SharedAccessAllowed);
sr.Deserialize ("SlotNumber", SlotNumber);
sr.Deserialize ("UseBackupHeaders", UseBackupHeaders);
+
+ sr.Deserialize ("TrueCryptMode", TrueCryptMode);
+
+ try
+ {
+ if (!sr.DeserializeBool ("KdfNull"))
+ {
+ sr.Deserialize ("Kdf", nameValue);
+ Kdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode);
+ }
+ }
+ catch(...) {}
+
+ try
+ {
+ if (!sr.DeserializeBool ("ProtectionKdfNull"))
+ {
+ sr.Deserialize ("ProtectionKdf", nameValue);
+ ProtectionKdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode);
+ }
+ }
+ catch(...) {}
}
void MountOptions::Serialize (shared_ptr <Stream> stream) const
@@ -133,10 +140,6 @@ namespace VeraCrypt
if (Password)
Password->Serialize (stream);
- sr.Serialize ("KdfNull", Kdf == nullptr);
- if (Kdf)
- sr.Serialize ("Kdf", Kdf->GetName());
-
sr.Serialize ("PathNull", Path == nullptr);
if (Path)
sr.Serialize ("Path", wstring (*Path));
@@ -149,15 +152,21 @@ namespace VeraCrypt
if (ProtectionPassword)
ProtectionPassword->Serialize (stream);
- sr.Serialize ("ProtectionKdfNull", ProtectionKdf == nullptr);
- if (ProtectionKdf)
- sr.Serialize ("ProtectionKdf", ProtectionKdf->GetName());
-
Keyfile::SerializeList (stream, "ProtectionKeyfiles", ProtectionKeyfiles);
sr.Serialize ("Removable", Removable);
sr.Serialize ("SharedAccessAllowed", SharedAccessAllowed);
sr.Serialize ("SlotNumber", SlotNumber);
sr.Serialize ("UseBackupHeaders", UseBackupHeaders);
+
+ sr.Serialize ("TrueCryptMode", TrueCryptMode);
+
+ sr.Serialize ("KdfNull", Kdf == nullptr);
+ if (Kdf)
+ sr.Serialize ("Kdf", Kdf->GetName());
+
+ sr.Serialize ("ProtectionKdfNull", ProtectionKdf == nullptr);
+ if (ProtectionKdf)
+ sr.Serialize ("ProtectionKdf", ProtectionKdf->GetName());
}
TC_SERIALIZER_FACTORY_ADD_CLASS (MountOptions);