VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Volume
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-06-07 22:01:29 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-11-08 23:19:27 +0100
commitc386beb69c2bb2475316c085f66a91ac0d9bdc73 (patch)
tree99a410fbd06d824e3a34434959626ed2dbfdfb16 /src/Volume
parentbe4ca4bac6db00538d1990ca865b55ecf2357926 (diff)
downloadVeraCrypt-c386beb69c2bb2475316c085f66a91ac0d9bdc73.tar.gz
VeraCrypt-c386beb69c2bb2475316c085f66a91ac0d9bdc73.zip
Adapt newly added Linux/MacOSX code to the modification of key derivation introduced by VeraCrypt
Diffstat (limited to 'src/Volume')
-rw-r--r--src/Volume/EncryptionTest.cpp8
-rw-r--r--src/Volume/Pkcs5Kdf.cpp18
-rw-r--r--src/Volume/Pkcs5Kdf.h14
3 files changed, 20 insertions, 20 deletions
diff --git a/src/Volume/EncryptionTest.cpp b/src/Volume/EncryptionTest.cpp
index cfede524..c07bbb20 100644
--- a/src/Volume/EncryptionTest.cpp
+++ b/src/Volume/EncryptionTest.cpp
@@ -868,22 +868,22 @@ namespace TrueCrypt
Buffer derivedKey (4);
Pkcs5HmacRipemd160 pkcs5HmacRipemd160;
- pkcs5HmacRipemd160.DeriveKey (derivedKey, password, salt, 5);
+ pkcs5HmacRipemd160.DeriveKey (derivedKey, password, salt, 5, FALSE);
if (memcmp (derivedKey.Ptr(), "\x7a\x3d\x7c\x03", 4) != 0)
throw TestFailed (SRC_POS);
Pkcs5HmacSha1 pkcs5HmacSha1;
- pkcs5HmacSha1.DeriveKey (derivedKey, password, salt, 5);
+ pkcs5HmacSha1.DeriveKey (derivedKey, password, salt, 5, FALSE);
if (memcmp (derivedKey.Ptr(), "\x5c\x75\xce\xf0", 4) != 0)
throw TestFailed (SRC_POS);
Pkcs5HmacSha512 pkcs5HmacSha512;
- pkcs5HmacSha512.DeriveKey (derivedKey, password, salt, 5);
+ pkcs5HmacSha512.DeriveKey (derivedKey, password, salt, 5, FALSE);
if (memcmp (derivedKey.Ptr(), "\x13\x64\xae\xf8", 4) != 0)
throw TestFailed (SRC_POS);
Pkcs5HmacWhirlpool pkcs5HmacWhirlpool;
- pkcs5HmacWhirlpool.DeriveKey (derivedKey, password, salt, 5);
+ pkcs5HmacWhirlpool.DeriveKey (derivedKey, password, salt, 5, FALSE);
if (memcmp (derivedKey.Ptr(), "\x50\x7c\x36\x6f", 4) != 0)
throw TestFailed (SRC_POS);
}
diff --git a/src/Volume/Pkcs5Kdf.cpp b/src/Volume/Pkcs5Kdf.cpp
index 9f9a4d96..8f501976 100644
--- a/src/Volume/Pkcs5Kdf.cpp
+++ b/src/Volume/Pkcs5Kdf.cpp
@@ -20,9 +20,9 @@ namespace TrueCrypt
{
}
- void Pkcs5Kdf::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt) const
+ void Pkcs5Kdf::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, BOOL bNotTest) const
{
- DeriveKey (key, password, salt, GetIterationCount());
+ DeriveKey (key, password, salt, GetIterationCount(), bNoTest);
}
shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const wstring &name)
@@ -64,31 +64,31 @@ namespace TrueCrypt
throw ParameterIncorrect (SRC_POS);
}
- void Pkcs5HmacRipemd160::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const
+ void Pkcs5HmacRipemd160::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest) const
{
ValidateParameters (key, password, salt, iterationCount);
- derive_key_ripemd160 ((char *) password.DataPtr(), (int) password.Size(), (char *) salt.Get(), (int) salt.Size(), iterationCount, (char *) key.Get(), (int) key.Size());
+ derive_key_ripemd160 (bNoTest, (char *) password.DataPtr(), (int) password.Size(), (char *) salt.Get(), (int) salt.Size(), iterationCount, (char *) key.Get(), (int) key.Size());
}
- void Pkcs5HmacRipemd160_1000::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const
+ void Pkcs5HmacRipemd160_1000::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest) const
{
ValidateParameters (key, password, salt, iterationCount);
- derive_key_ripemd160 ((char *) password.DataPtr(), (int) password.Size(), (char *) salt.Get(), (int) salt.Size(), iterationCount, (char *) key.Get(), (int) key.Size());
+ derive_key_ripemd160 (bNoTest, (char *) password.DataPtr(), (int) password.Size(), (char *) salt.Get(), (int) salt.Size(), iterationCount, (char *) key.Get(), (int) key.Size());
}
- void Pkcs5HmacSha1::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const
+ void Pkcs5HmacSha1::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest) const
{
ValidateParameters (key, password, salt, iterationCount);
derive_key_sha1 ((char *) password.DataPtr(), (int) password.Size(), (char *) salt.Get(), (int) salt.Size(), iterationCount, (char *) key.Get(), (int) key.Size());
}
- void Pkcs5HmacSha512::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const
+ void Pkcs5HmacSha512::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest) const
{
ValidateParameters (key, password, salt, iterationCount);
derive_key_sha512 ((char *) password.DataPtr(), (int) password.Size(), (char *) salt.Get(), (int) salt.Size(), iterationCount, (char *) key.Get(), (int) key.Size());
}
- void Pkcs5HmacWhirlpool::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const
+ void Pkcs5HmacWhirlpool::DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest) const
{
ValidateParameters (key, password, salt, iterationCount);
derive_key_whirlpool ((char *) password.DataPtr(), (int) password.Size(), (char *) salt.Get(), (int) salt.Size(), iterationCount, (char *) key.Get(), (int) key.Size());
diff --git a/src/Volume/Pkcs5Kdf.h b/src/Volume/Pkcs5Kdf.h
index d8c1a112..5e7648fa 100644
--- a/src/Volume/Pkcs5Kdf.h
+++ b/src/Volume/Pkcs5Kdf.h
@@ -23,8 +23,8 @@ namespace TrueCrypt
public:
virtual ~Pkcs5Kdf ();
- virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt) const;
- virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const = 0;
+ virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, BOOL bNotTest = TRUE) const;
+ virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest = TRUE) const = 0;
static shared_ptr <Pkcs5Kdf> GetAlgorithm (const wstring &name);
static shared_ptr <Pkcs5Kdf> GetAlgorithm (const Hash &hash);
static Pkcs5KdfList GetAvailableAlgorithms ();
@@ -49,7 +49,7 @@ namespace TrueCrypt
Pkcs5HmacRipemd160 () { }
virtual ~Pkcs5HmacRipemd160 () { }
- virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
+ virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest = TRUE) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Ripemd160); }
virtual int GetIterationCount () const { return 655340; }
virtual wstring GetName () const { return L"HMAC-RIPEMD-160"; }
@@ -65,7 +65,7 @@ namespace TrueCrypt
Pkcs5HmacRipemd160_1000 () { }
virtual ~Pkcs5HmacRipemd160_1000 () { }
- virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
+ virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest = TRUE) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Ripemd160); }
virtual int GetIterationCount () const { return 327670; }
virtual wstring GetName () const { return L"HMAC-RIPEMD-160"; }
@@ -81,7 +81,7 @@ namespace TrueCrypt
Pkcs5HmacSha1 () { }
virtual ~Pkcs5HmacSha1 () { }
- virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
+ virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest = TRUE) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Sha1); }
virtual int GetIterationCount () const { return 500000; }
virtual wstring GetName () const { return L"HMAC-SHA-1"; }
@@ -97,7 +97,7 @@ namespace TrueCrypt
Pkcs5HmacSha512 () { }
virtual ~Pkcs5HmacSha512 () { }
- virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
+ virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest = TRUE) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Sha512); }
virtual int GetIterationCount () const { return 500000; }
virtual wstring GetName () const { return L"HMAC-SHA-512"; }
@@ -113,7 +113,7 @@ namespace TrueCrypt
Pkcs5HmacWhirlpool () { }
virtual ~Pkcs5HmacWhirlpool () { }
- virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
+ virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount, BOOL bNotTest = TRUE) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Whirlpool); }
virtual int GetIterationCount () const { return 500000; }
virtual wstring GetName () const { return L"HMAC-Whirlpool"; }