VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Volume/Pkcs5Kdf.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/Volume/Pkcs5Kdf.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/Volume/Pkcs5Kdf.cpp')
-rw-r--r--src/Volume/Pkcs5Kdf.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/Volume/Pkcs5Kdf.cpp b/src/Volume/Pkcs5Kdf.cpp
index abf45720..beccd62b 100644
--- a/src/Volume/Pkcs5Kdf.cpp
+++ b/src/Volume/Pkcs5Kdf.cpp
@@ -12,7 +12,7 @@
namespace VeraCrypt
{
- Pkcs5Kdf::Pkcs5Kdf ()
+ Pkcs5Kdf::Pkcs5Kdf (bool truecryptMode) : m_truecryptMode(truecryptMode)
{
}
@@ -25,9 +25,9 @@ namespace VeraCrypt
DeriveKey (key, password, salt, GetIterationCount());
}
- shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const wstring &name)
+ shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const wstring &name, bool truecryptMode)
{
- foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms())
+ foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms(truecryptMode))
{
if (kdf->GetName() == name)
return kdf;
@@ -35,9 +35,9 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS);
}
- shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const Hash &hash)
+ shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const Hash &hash, bool truecryptMode)
{
- foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms())
+ foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms(truecryptMode))
{
if (typeid (*kdf->GetHash()) == typeid (hash))
return kdf;
@@ -46,14 +46,23 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS);
}
- Pkcs5KdfList Pkcs5Kdf::GetAvailableAlgorithms ()
+ Pkcs5KdfList Pkcs5Kdf::GetAvailableAlgorithms (bool truecryptMode)
{
Pkcs5KdfList l;
-
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 ()));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool ()));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256 ()));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacRipemd160 ()));
+
+ if (truecryptMode)
+ {
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacRipemd160 (true)));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 (true)));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool (true)));
+ }
+ else
+ {
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 (false)));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool (false)));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256 ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacRipemd160 (false)));
+ }
return l;
}