VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Volume
diff options
context:
space:
mode:
Diffstat (limited to 'src/Volume')
-rw-r--r--src/Volume/EncryptionTest.cpp4
-rw-r--r--src/Volume/Pkcs5Kdf.cpp30
-rw-r--r--src/Volume/Pkcs5Kdf.h35
-rw-r--r--src/Volume/Volume.cpp22
-rw-r--r--src/Volume/Volume.h20
-rw-r--r--src/Volume/VolumeHeader.cpp23
-rw-r--r--src/Volume/VolumeHeader.h4
-rw-r--r--src/Volume/VolumeInfo.cpp3
-rw-r--r--src/Volume/VolumeInfo.h1
-rw-r--r--src/Volume/VolumeLayout.cpp15
-rw-r--r--src/Volume/VolumeLayout.h4
11 files changed, 54 insertions, 107 deletions
diff --git a/src/Volume/EncryptionTest.cpp b/src/Volume/EncryptionTest.cpp
index 5c251bd5..bb9c3a0b 100644
--- a/src/Volume/EncryptionTest.cpp
+++ b/src/Volume/EncryptionTest.cpp
@@ -1086,12 +1086,12 @@ namespace VeraCrypt
if (memcmp (derivedKey.Ptr(), "\x8d\x51\xfa\x31", 4) != 0)
throw TestFailed (SRC_POS);
- Pkcs5HmacSha512 pkcs5HmacSha512(false);
+ Pkcs5HmacSha512 pkcs5HmacSha512;
pkcs5HmacSha512.DeriveKey (derivedKey, password, salt, 5);
if (memcmp (derivedKey.Ptr(), "\x13\x64\xae\xf8", 4) != 0)
throw TestFailed (SRC_POS);
- Pkcs5HmacWhirlpool pkcs5HmacWhirlpool(false);
+ Pkcs5HmacWhirlpool pkcs5HmacWhirlpool;
pkcs5HmacWhirlpool.DeriveKey (derivedKey, password, salt, 5);
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 fee057a8..ff49cefe 100644
--- a/src/Volume/Pkcs5Kdf.cpp
+++ b/src/Volume/Pkcs5Kdf.cpp
@@ -16,7 +16,7 @@
namespace VeraCrypt
{
- Pkcs5Kdf::Pkcs5Kdf (bool truecryptMode) : m_truecryptMode(truecryptMode)
+ Pkcs5Kdf::Pkcs5Kdf ()
{
}
@@ -29,9 +29,9 @@ namespace VeraCrypt
DeriveKey (key, password, salt, GetIterationCount(pim));
}
- shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const wstring &name, bool truecryptMode)
+ shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const wstring &name)
{
- foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms(truecryptMode))
+ foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms())
{
if (kdf->GetName() == name)
return kdf;
@@ -39,9 +39,9 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS);
}
- shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const Hash &hash, bool truecryptMode)
+ shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const Hash &hash)
{
- foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms(truecryptMode))
+ foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms())
{
if (typeid (*kdf->GetHash()) == typeid (hash))
return kdf;
@@ -50,23 +50,15 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS);
}
- Pkcs5KdfList Pkcs5Kdf::GetAvailableAlgorithms (bool truecryptMode)
+ Pkcs5KdfList Pkcs5Kdf::GetAvailableAlgorithms ()
{
Pkcs5KdfList l;
- if (truecryptMode)
- {
- 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 Pkcs5HmacSha256 ()));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s ()));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool (false)));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
- }
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256 ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
return l;
}
diff --git a/src/Volume/Pkcs5Kdf.h b/src/Volume/Pkcs5Kdf.h
index 25ad76e8..9071caf0 100644
--- a/src/Volume/Pkcs5Kdf.h
+++ b/src/Volume/Pkcs5Kdf.h
@@ -29,20 +29,17 @@ namespace VeraCrypt
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, int pim, const ConstBufferPtr &salt) const;
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const = 0;
- static shared_ptr <Pkcs5Kdf> GetAlgorithm (const wstring &name, bool truecryptMode);
- static shared_ptr <Pkcs5Kdf> GetAlgorithm (const Hash &hash, bool truecryptMode);
- static Pkcs5KdfList GetAvailableAlgorithms (bool truecryptMode);
+ static shared_ptr <Pkcs5Kdf> GetAlgorithm (const wstring &name);
+ static shared_ptr <Pkcs5Kdf> GetAlgorithm (const Hash &hash);
+ static Pkcs5KdfList GetAvailableAlgorithms ();
virtual shared_ptr <Hash> GetHash () const = 0;
virtual int GetIterationCount (int pim) const = 0;
virtual wstring GetName () const = 0;
virtual Pkcs5Kdf* Clone () const = 0;
virtual bool IsDeprecated () const { return GetHash()->IsDeprecated(); }
- bool GetTrueCryptMode () const { return m_truecryptMode;}
- void SetTrueCryptMode (bool truecryptMode) { m_truecryptMode = truecryptMode;}
protected:
- bool m_truecryptMode;
- Pkcs5Kdf (bool truecryptMode);
+ Pkcs5Kdf ();
void ValidateParameters (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -54,7 +51,7 @@ namespace VeraCrypt
class Pkcs5HmacBlake2s_Boot : public Pkcs5Kdf
{
public:
- Pkcs5HmacBlake2s_Boot () : Pkcs5Kdf(false) { }
+ Pkcs5HmacBlake2s_Boot () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacBlake2s_Boot () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -71,7 +68,7 @@ namespace VeraCrypt
class Pkcs5HmacBlake2s : public Pkcs5Kdf
{
public:
- Pkcs5HmacBlake2s () : Pkcs5Kdf(false) { }
+ Pkcs5HmacBlake2s () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacBlake2s () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -88,7 +85,7 @@ namespace VeraCrypt
class Pkcs5HmacSha256_Boot : public Pkcs5Kdf
{
public:
- Pkcs5HmacSha256_Boot () : Pkcs5Kdf(false) { }
+ Pkcs5HmacSha256_Boot () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacSha256_Boot () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -105,7 +102,7 @@ namespace VeraCrypt
class Pkcs5HmacSha256 : public Pkcs5Kdf
{
public:
- Pkcs5HmacSha256 () : Pkcs5Kdf(false) { }
+ Pkcs5HmacSha256 () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacSha256 () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -122,14 +119,14 @@ namespace VeraCrypt
class Pkcs5HmacSha512 : public Pkcs5Kdf
{
public:
- Pkcs5HmacSha512 (bool truecryptMode) : Pkcs5Kdf(truecryptMode) { }
+ Pkcs5HmacSha512 () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacSha512 () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Sha512); }
- virtual int GetIterationCount (int pim) const { return m_truecryptMode? 1000 : (pim <= 0 ? 500000 : (15000 + (pim * 1000))); }
+ virtual int GetIterationCount (int pim) const { return (pim <= 0 ? 500000 : (15000 + (pim * 1000))); }
virtual wstring GetName () const { return L"HMAC-SHA-512"; }
- virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacSha512(m_truecryptMode); }
+ virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacSha512(); }
private:
Pkcs5HmacSha512 (const Pkcs5HmacSha512 &);
@@ -139,14 +136,14 @@ namespace VeraCrypt
class Pkcs5HmacWhirlpool : public Pkcs5Kdf
{
public:
- Pkcs5HmacWhirlpool (bool truecryptMode) : Pkcs5Kdf(truecryptMode) { }
+ Pkcs5HmacWhirlpool () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacWhirlpool () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Whirlpool); }
- virtual int GetIterationCount (int pim) const { return m_truecryptMode? 1000 : (pim <= 0 ? 500000 : (15000 + (pim * 1000))); }
+ virtual int GetIterationCount (int pim) const { return (pim <= 0 ? 500000 : (15000 + (pim * 1000))); }
virtual wstring GetName () const { return L"HMAC-Whirlpool"; }
- virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacWhirlpool(m_truecryptMode); }
+ virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacWhirlpool(); }
private:
Pkcs5HmacWhirlpool (const Pkcs5HmacWhirlpool &);
@@ -156,7 +153,7 @@ namespace VeraCrypt
class Pkcs5HmacStreebog : public Pkcs5Kdf
{
public:
- Pkcs5HmacStreebog () : Pkcs5Kdf(false) { }
+ Pkcs5HmacStreebog () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacStreebog () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
@@ -173,7 +170,7 @@ namespace VeraCrypt
class Pkcs5HmacStreebog_Boot : public Pkcs5Kdf
{
public:
- Pkcs5HmacStreebog_Boot () : Pkcs5Kdf(false) { }
+ Pkcs5HmacStreebog_Boot () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacStreebog_Boot () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
diff --git a/src/Volume/Volume.cpp b/src/Volume/Volume.cpp
index 57707726..524f2395 100644
--- a/src/Volume/Volume.cpp
+++ b/src/Volume/Volume.cpp
@@ -30,7 +30,6 @@ namespace VeraCrypt
TopWriteOffset (0),
TotalDataRead (0),
TotalDataWritten (0),
- TrueCryptMode (false),
Pim (0),
EncryptionNotCompleted (false)
{
@@ -71,7 +70,7 @@ namespace VeraCrypt
return EA->GetMode();
}
- void Volume::Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope)
+ void Volume::Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope)
{
make_shared_auto (File, file);
@@ -102,18 +101,14 @@ namespace VeraCrypt
throw;
}
- return Open (file, password, pim, kdf, truecryptMode, keyfiles, emvSupportEnabled, protection, protectionPassword, protectionPim, protectionKdf,protectionKeyfiles, volumeType, useBackupHeaders, partitionInSystemEncryptionScope);
+ return Open (file, password, pim, kdf, keyfiles, emvSupportEnabled, protection, protectionPassword, protectionPim, protectionKdf,protectionKeyfiles, volumeType, useBackupHeaders, partitionInSystemEncryptionScope);
}
- void Volume::Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf,shared_ptr <KeyfileList> protectionKeyfiles, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope)
+ void Volume::Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf,shared_ptr <KeyfileList> protectionKeyfiles, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope)
{
if (!volumeFile)
throw ParameterIncorrect (SRC_POS);
- // TrueCrypt doesn't support SHA-256 and Streebog
- if (kdf && truecryptMode && (kdf->GetName() == L"HMAC-SHA-256" || kdf->GetName() == L"HMAC-Streebog"))
- throw UnsupportedAlgoInTrueCryptMode (SRC_POS);
-
Protection = protection;
VolumeFile = volumeFile;
SystemEncryption = partitionInSystemEncryptionScope;
@@ -190,11 +185,11 @@ namespace VeraCrypt
shared_ptr <VolumeHeader> header = layout->GetHeader();
- if (header->Decrypt (headerBuffer, *passwordKey, pim, kdf, truecryptMode, layout->GetSupportedKeyDerivationFunctions(truecryptMode), layoutEncryptionAlgorithms, layoutEncryptionModes))
+ if (header->Decrypt (headerBuffer, *passwordKey, pim, kdf, layout->GetSupportedKeyDerivationFunctions(), layoutEncryptionAlgorithms, layoutEncryptionModes))
{
// Header decrypted
- if (!truecryptMode && typeid (*layout) == typeid (VolumeLayoutV2Normal) && header->GetRequiredMinProgramVersion() < 0x10b)
+ if (typeid (*layout) == typeid (VolumeLayoutV2Normal) && header->GetRequiredMinProgramVersion() < 0x10b)
{
// VolumeLayoutV1Normal has been opened as VolumeLayoutV2Normal
layout.reset (new VolumeLayoutV1Normal);
@@ -202,7 +197,6 @@ namespace VeraCrypt
layout->SetHeader (header);
}
- TrueCryptMode = truecryptMode;
Pim = pim;
Type = layout->GetType();
SectorSize = header->GetSectorSize();
@@ -248,7 +242,7 @@ namespace VeraCrypt
Volume protectedVolume;
protectedVolume.Open (VolumeFile,
- protectionPassword, protectionPim, protectionKdf, truecryptMode, protectionKeyfiles,
+ protectionPassword, protectionPim, protectionKdf, protectionKeyfiles,
emvSupportEnabled,
VolumeProtection::ReadOnly,
shared_ptr <VolumePassword> (), 0, shared_ptr <Pkcs5Kdf> (),shared_ptr <KeyfileList> (),
@@ -287,8 +281,8 @@ namespace VeraCrypt
Buffer mbr (VolumeFile->GetDeviceSectorSize());
driveDevice.ReadAt (mbr, 0);
- // Search for the string "VeraCrypt" or "TrueCrypt"
- const char* bootSignature = truecryptMode? "TrueCrypt" : TC_APP_NAME;
+ // Search for the string "VeraCrypt"
+ const char* bootSignature = TC_APP_NAME;
size_t nameLen = strlen (bootSignature);
for (size_t i = 0; i < mbr.Size() - nameLen; ++i)
{
diff --git a/src/Volume/Volume.h b/src/Volume/Volume.h
index e50dd0e7..c816da58 100644
--- a/src/Volume/Volume.h
+++ b/src/Volume/Volume.h
@@ -52,20 +52,6 @@ namespace VeraCrypt
return Data.substr (pos + 1);
}
}
-
- bool HasTrueCryptExtension () const
- {
- wstring sExt = GetExtension ();
- if ((sExt.size () == 2)
- && (sExt[0] == L't' || sExt[0] == L'T')
- && (sExt[1] == L'c' || sExt[1] == L'C')
- )
- {
- return true;
- }
- else
- return false;
- }
protected:
wstring Data;
@@ -118,13 +104,12 @@ namespace VeraCrypt
uint64 GetTotalDataRead () const { return TotalDataRead; }
uint64 GetTotalDataWritten () const { return TotalDataWritten; }
VolumeType::Enum GetType () const { return Type; }
- bool GetTrueCryptMode() const { return TrueCryptMode; }
int GetPim() const { return Pim;}
uint64 GetVolumeCreationTime () const { return Header->GetVolumeCreationTime(); }
bool IsHiddenVolumeProtectionTriggered () const { return HiddenVolumeProtectionTriggered; }
bool IsInSystemEncryptionScope () const { return SystemEncryption; }
- void Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (),shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false);
- void Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false);
+ void Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (),shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false);
+ void Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false);
void ReadSectors (const BufferPtr &buffer, uint64 byteOffset);
void ReEncryptHeader (bool backupHeader, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr <Pkcs5Kdf> newPkcs5Kdf);
void WriteSectors (const ConstBufferPtr &buffer, uint64 byteOffset);
@@ -152,7 +137,6 @@ namespace VeraCrypt
uint64 TopWriteOffset;
uint64 TotalDataRead;
uint64 TotalDataWritten;
- bool TrueCryptMode;
int Pim;
bool EncryptionNotCompleted;
diff --git a/src/Volume/VolumeHeader.cpp b/src/Volume/VolumeHeader.cpp
index faed1fcb..d8527ed5 100644
--- a/src/Volume/VolumeHeader.cpp
+++ b/src/Volume/VolumeHeader.cpp
@@ -82,7 +82,7 @@ namespace VeraCrypt
EncryptNew (headerBuffer, options.Salt, options.HeaderKey, options.Kdf);
}
- bool VolumeHeader::Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes)
+ bool VolumeHeader::Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes)
{
if (password.Size() < 1)
throw PasswordEmpty (SRC_POS);
@@ -125,7 +125,7 @@ namespace VeraCrypt
header.CopyFrom (encryptedData.GetRange (EncryptedHeaderDataOffset, EncryptedHeaderDataSize));
ea->Decrypt (header);
- if (Deserialize (header, ea, mode, truecryptMode))
+ if (Deserialize (header, ea, mode))
{
EA = ea;
Pkcs5 = pkcs5;
@@ -138,18 +138,12 @@ namespace VeraCrypt
return false;
}
- bool VolumeHeader::Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode, bool truecryptMode)
+ bool VolumeHeader::Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode)
{
if (header.Size() != EncryptedHeaderDataSize)
throw ParameterIncorrect (SRC_POS);
- if (truecryptMode && (header[0] != 'T' ||
- header[1] != 'R' ||
- header[2] != 'U' ||
- header[3] != 'E'))
- return false;
-
- if (!truecryptMode && (header[0] != 'V' ||
+ if ((header[0] != 'V' ||
header[1] != 'E' ||
header[2] != 'R' ||
header[3] != 'A'))
@@ -173,16 +167,9 @@ namespace VeraCrypt
RequiredMinProgramVersion = DeserializeEntry <uint16> (header, offset);
- if (!truecryptMode && (RequiredMinProgramVersion > Version::Number()))
+ if ((RequiredMinProgramVersion > Version::Number()))
throw HigherVersionRequired (SRC_POS);
- if (truecryptMode)
- {
- if (RequiredMinProgramVersion < 0x600 || RequiredMinProgramVersion > 0x71a)
- throw UnsupportedTrueCryptFormat (SRC_POS);
- RequiredMinProgramVersion = CurrentRequiredMinProgramVersion;
- }
-
VolumeKeyAreaCrc32 = DeserializeEntry <uint32> (header, offset);
VolumeCreationTime = DeserializeEntry <uint64> (header, offset);
HeaderCreationTime = DeserializeEntry <uint64> (header, offset);
diff --git a/src/Volume/VolumeHeader.h b/src/Volume/VolumeHeader.h
index 191547e3..85908711 100644
--- a/src/Volume/VolumeHeader.h
+++ b/src/Volume/VolumeHeader.h
@@ -60,7 +60,7 @@ namespace VeraCrypt
virtual ~VolumeHeader ();
void Create (const BufferPtr &headerBuffer, VolumeHeaderCreationOptions &options);
- bool Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes);
+ bool Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes);
void EncryptNew (const BufferPtr &newHeaderBuffer, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr <Pkcs5Kdf> newPkcs5Kdf);
uint64 GetEncryptedAreaStart () const { return EncryptedAreaStart; }
uint64 GetEncryptedAreaLength () const { return EncryptedAreaLength; }
@@ -78,7 +78,7 @@ namespace VeraCrypt
void SetSize (uint32 headerSize);
protected:
- bool Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode, bool truecryptMode);
+ bool Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode);
template <typename T> T DeserializeEntry (const ConstBufferPtr &header, size_t &offset) const;
template <typename T> T DeserializeEntryAt (const ConstBufferPtr &header, const size_t &offset) const;
void Init ();
diff --git a/src/Volume/VolumeInfo.cpp b/src/Volume/VolumeInfo.cpp
index b30dafa2..699e203f 100644
--- a/src/Volume/VolumeInfo.cpp
+++ b/src/Volume/VolumeInfo.cpp
@@ -54,7 +54,6 @@ namespace VeraCrypt
Type = static_cast <VolumeType::Enum> (sr.DeserializeInt32 ("Type"));
VirtualDevice = sr.DeserializeWString ("VirtualDevice");
sr.Deserialize ("VolumeCreationTime", VolumeCreationTime);
- sr.Deserialize ("TrueCryptMode", TrueCryptMode);
sr.Deserialize ("Pim", Pim);
}
@@ -95,7 +94,6 @@ namespace VeraCrypt
sr.Serialize ("Type", static_cast <uint32> (Type));
sr.Serialize ("VirtualDevice", wstring (VirtualDevice));
sr.Serialize ("VolumeCreationTime", VolumeCreationTime);
- sr.Serialize ("TrueCryptMode", TrueCryptMode);
sr.Serialize ("Pim", Pim);
}
@@ -120,7 +118,6 @@ namespace VeraCrypt
TopWriteOffset = volume.GetTopWriteOffset();
TotalDataRead = volume.GetTotalDataRead();
TotalDataWritten = volume.GetTotalDataWritten();
- TrueCryptMode = volume.GetTrueCryptMode();
Pim = volume.GetPim ();
}
diff --git a/src/Volume/VolumeInfo.h b/src/Volume/VolumeInfo.h
index f9e07a2e..1adc87e3 100644
--- a/src/Volume/VolumeInfo.h
+++ b/src/Volume/VolumeInfo.h
@@ -60,7 +60,6 @@ namespace VeraCrypt
VolumeType::Enum Type;
DevicePath VirtualDevice;
VolumeTime VolumeCreationTime;
- bool TrueCryptMode;
int Pim;
private:
diff --git a/src/Volume/VolumeLayout.cpp b/src/Volume/VolumeLayout.cpp
index 3045ba83..efb77649 100644
--- a/src/Volume/VolumeLayout.cpp
+++ b/src/Volume/VolumeLayout.cpp
@@ -222,17 +222,14 @@ namespace VeraCrypt
return volumeHostSize;
}
- Pkcs5KdfList VolumeLayoutSystemEncryption::GetSupportedKeyDerivationFunctions (bool truecryptMode) const
+ Pkcs5KdfList VolumeLayoutSystemEncryption::GetSupportedKeyDerivationFunctions () const
{
Pkcs5KdfList l;
- if (!truecryptMode)
- {
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256_Boot ()));
- l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s_Boot ()));
- 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 Pkcs5HmacStreebog ()));
- }
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256_Boot ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s_Boot ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool ()));
+ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
return l;
}
}
diff --git a/src/Volume/VolumeLayout.h b/src/Volume/VolumeLayout.h
index 40a8643d..32b646ad 100644
--- a/src/Volume/VolumeLayout.h
+++ b/src/Volume/VolumeLayout.h
@@ -38,7 +38,7 @@ namespace VeraCrypt
virtual uint32 GetHeaderSize () const { return HeaderSize; }
virtual uint64 GetMaxDataSize (uint64 volumeSize) const = 0;
virtual EncryptionAlgorithmList GetSupportedEncryptionAlgorithms () const { return SupportedEncryptionAlgorithms; }
- virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions (bool truecryptMode) const { return Pkcs5Kdf::GetAvailableAlgorithms(truecryptMode); }
+ virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions () const { return Pkcs5Kdf::GetAvailableAlgorithms(); }
virtual EncryptionModeList GetSupportedEncryptionModes () const { return SupportedEncryptionModes; }
virtual VolumeType::Enum GetType () const { return Type; }
virtual bool HasBackupHeader () const = 0;
@@ -126,7 +126,7 @@ namespace VeraCrypt
virtual uint64 GetDataOffset (uint64 volumeHostSize) const;
virtual uint64 GetDataSize (uint64 volumeHostSize) const;
virtual uint64 GetMaxDataSize (uint64 volumeSize) const { throw NotApplicable (SRC_POS); }
- virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions (bool truecryptMode) const;
+ virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions () const;
virtual bool HasBackupHeader () const { return false; }
virtual bool HasDriveHeader () const { return true; }