VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-20 15:04:07 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-20 15:31:24 +0100
commit4b9f8b232b956149850fc1c8b47f826a09044efa (patch)
treec083d57ad145d28cfb58b98fedfce2ab68e82eed /src
parent02cbecff6450f37498c558c1352550d647bffdfa (diff)
downloadVeraCrypt-4b9f8b232b956149850fc1c8b47f826a09044efa.tar.gz
VeraCrypt-4b9f8b232b956149850fc1c8b47f826a09044efa.zip
Reduce time for reporting wrong password by removing support for legacy hidden format because it was never functional and it was superseded by current hidden format.
Diffstat (limited to 'src')
-rw-r--r--src/Common/Common.h1
-rw-r--r--src/Common/Dlgcode.c12
-rw-r--r--src/Common/Password.c8
-rw-r--r--src/Driver/Ntvol.c25
-rwxr-xr-xsrc/Main/GraphicUserInterface.cpp4
-rwxr-xr-xsrc/Volume/Volume.cpp10
-rw-r--r--src/Volume/VolumeLayout.cpp30
-rw-r--r--src/Volume/VolumeLayout.h18
8 files changed, 5 insertions, 103 deletions
diff --git a/src/Common/Common.h b/src/Common/Common.h
index d4375b5d..3e68f402 100644
--- a/src/Common/Common.h
+++ b/src/Common/Common.h
@@ -43,7 +43,6 @@ enum
{
TC_VOLUME_TYPE_NORMAL = 0,
TC_VOLUME_TYPE_HIDDEN,
- TC_VOLUME_TYPE_HIDDEN_LEGACY,
TC_VOLUME_TYPE_COUNT
};
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 0105de4f..9020b402 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -9024,18 +9024,6 @@ int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *pa
headerOffset.QuadPart = useBackupHeader ? context->HostSize - TC_VOLUME_HEADER_SIZE : TC_HIDDEN_VOLUME_HEADER_OFFSET;
break;
- case TC_VOLUME_TYPE_HIDDEN_LEGACY:
- if (useBackupHeader)
- {
- status = ERR_PASSWORD_WRONG;
- goto error;
- }
-
- if (context->IsDevice && deviceGeometry.BytesPerSector != TC_SECTOR_SIZE_LEGACY)
- continue;
-
- headerOffset.QuadPart = context->HostSize - TC_HIDDEN_VOLUME_HEADER_OFFSET_LEGACY;
- break;
}
if (!SetFilePointerEx ((HANDLE) context->HostFileHandle, headerOffset, NULL, FILE_BEGIN))
diff --git a/src/Common/Password.c b/src/Common/Password.c
index 921ce02e..e5e9f9d8 100644
--- a/src/Common/Password.c
+++ b/src/Common/Password.c
@@ -258,12 +258,6 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, Pas
headerOffset.QuadPart = TC_HIDDEN_VOLUME_HEADER_OFFSET;
break;
- case TC_VOLUME_TYPE_HIDDEN_LEGACY:
- if (bDevice && driveInfo.BytesPerSector != TC_SECTOR_SIZE_LEGACY)
- continue;
-
- headerOffset.QuadPart = hostSize - TC_HIDDEN_VOLUME_HEADER_OFFSET_LEGACY;
- break;
}
if (!SetFilePointerEx ((HANDLE) dev, headerOffset, NULL, FILE_BEGIN))
@@ -356,7 +350,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, Pas
cryptoInfo->master_keydata,
&ci,
cryptoInfo->VolumeSize.Value,
- (volumeType == TC_VOLUME_TYPE_HIDDEN || volumeType == TC_VOLUME_TYPE_HIDDEN_LEGACY) ? cryptoInfo->hiddenVolumeSize : 0,
+ (volumeType == TC_VOLUME_TYPE_HIDDEN) ? cryptoInfo->hiddenVolumeSize : 0,
cryptoInfo->EncryptedAreaStart.Value,
cryptoInfo->EncryptedAreaLength.Value,
cryptoInfo->RequiredProgramVersion,
diff --git a/src/Driver/Ntvol.c b/src/Driver/Ntvol.c
index a8bcc14a..5690ac65 100644
--- a/src/Driver/Ntvol.c
+++ b/src/Driver/Ntvol.c
@@ -319,10 +319,6 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
{
Dump ("Trying to open volume type %d\n", volumeType);
- if (mount->bPartitionInInactiveSysEncScope
- && volumeType == TC_VOLUME_TYPE_HIDDEN_LEGACY)
- continue;
-
/* Read the volume header */
if (!mount->bPartitionInInactiveSysEncScope
@@ -348,16 +344,6 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
headerOffset.QuadPart = mount->UseBackupHeader ? lDiskLength.QuadPart - TC_HIDDEN_VOLUME_HEADER_OFFSET : TC_HIDDEN_VOLUME_HEADER_OFFSET;
break;
-
- case TC_VOLUME_TYPE_HIDDEN_LEGACY:
- if (mount->UseBackupHeader)
- continue;
-
- if (bRawDevice && Extension->HostBytesPerSector != TC_SECTOR_SIZE_LEGACY)
- continue;
-
- headerOffset.QuadPart = lDiskLength.QuadPart - TC_HIDDEN_VOLUME_HEADER_OFFSET_LEGACY;
- break;
}
Dump ("Reading volume header at %I64d\n", headerOffset.QuadPart);
@@ -455,7 +441,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
ReadVolumeHeaderRecoveryMode = mount->RecoveryMode;
- if ((volumeType == TC_VOLUME_TYPE_HIDDEN || volumeType == TC_VOLUME_TYPE_HIDDEN_LEGACY) && mount->bProtectHiddenVolume)
+ if ((volumeType == TC_VOLUME_TYPE_HIDDEN) && mount->bProtectHiddenVolume)
{
mount->nReturnCode = ReadVolumeHeaderWCache (
FALSE,
@@ -577,14 +563,10 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
break;
case TC_VOLUME_TYPE_HIDDEN:
- case TC_VOLUME_TYPE_HIDDEN_LEGACY:
cryptoInfoPtr = mount->bProtectHiddenVolume ? tmpCryptoInfo : Extension->cryptoInfo;
- if (volumeType == TC_VOLUME_TYPE_HIDDEN_LEGACY)
- Extension->cryptoInfo->hiddenVolumeOffset = lDiskLength.QuadPart - cryptoInfoPtr->hiddenVolumeSize - TC_HIDDEN_VOLUME_HEADER_OFFSET_LEGACY;
- else
- Extension->cryptoInfo->hiddenVolumeOffset = cryptoInfoPtr->EncryptedAreaStart.Value;
+ Extension->cryptoInfo->hiddenVolumeOffset = cryptoInfoPtr->EncryptedAreaStart.Value;
Dump ("Hidden volume offset = %I64d\n", Extension->cryptoInfo->hiddenVolumeOffset);
Dump ("Hidden volume size = %I64d\n", cryptoInfoPtr->hiddenVolumeSize);
@@ -613,9 +595,6 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
Extension->cryptoInfo->hiddenVolumeProtectedSize = tmpCryptoInfo->hiddenVolumeSize;
- if (volumeType == TC_VOLUME_TYPE_HIDDEN_LEGACY)
- Extension->cryptoInfo->hiddenVolumeProtectedSize += TC_VOLUME_HEADER_SIZE_LEGACY;
-
Dump ("Hidden volume protection active: %I64d-%I64d (%I64d)\n", Extension->cryptoInfo->hiddenVolumeOffset, Extension->cryptoInfo->hiddenVolumeProtectedSize + Extension->cryptoInfo->hiddenVolumeOffset - 1, Extension->cryptoInfo->hiddenVolumeProtectedSize);
}
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index 889d49c5..8ff05c4e 100755
--- a/src/Main/GraphicUserInterface.cpp
+++ b/src/Main/GraphicUserInterface.cpp
@@ -232,7 +232,7 @@ namespace VeraCrypt
if (hiddenVolume)
{
- if (typeid (*normalVolume->GetLayout()) == typeid (VolumeLayoutV1Normal) && typeid (*hiddenVolume->GetLayout()) != typeid (VolumeLayoutV1Hidden))
+ if (typeid (*normalVolume->GetLayout()) == typeid (VolumeLayoutV1Normal))
throw ParameterIncorrect (SRC_POS);
if (typeid (*normalVolume->GetLayout()) == typeid (VolumeLayoutV2Normal) && typeid (*hiddenVolume->GetLayout()) != typeid (VolumeLayoutV2Hidden))
@@ -1281,7 +1281,7 @@ namespace VeraCrypt
}
shared_ptr <VolumeLayout> layout = volume->GetLayout();
- if (typeid (*layout) == typeid (VolumeLayoutV1Normal) || typeid (*layout) == typeid (VolumeLayoutV1Hidden))
+ if (typeid (*layout) == typeid (VolumeLayoutV1Normal))
{
ShowError ("VOLUME_HAS_NO_BACKUP_HEADER");
return;
diff --git a/src/Volume/Volume.cpp b/src/Volume/Volume.cpp
index 12bc9a14..362b342c 100755
--- a/src/Volume/Volume.cpp
+++ b/src/Volume/Volume.cpp
@@ -129,13 +129,6 @@ namespace VeraCrypt
if (useBackupHeaders && !layout->HasBackupHeader())
continue;
- if (typeid (*layout) == typeid (VolumeLayoutV1Hidden)
- && deviceHosted
- && hostDeviceSectorSize != TC_SECTOR_SIZE_LEGACY)
- {
- continue;
- }
-
SecureBuffer headerBuffer (layout->GetHeaderSize());
if (layout->HasDriveHeader())
@@ -249,9 +242,6 @@ namespace VeraCrypt
ProtectedRangeStart = protectedVolume.VolumeDataOffset;
ProtectedRangeEnd = protectedVolume.VolumeDataOffset + protectedVolume.VolumeDataSize;
-
- if (typeid (*protectedVolume.Layout) == typeid (VolumeLayoutV1Hidden))
- ProtectedRangeEnd += protectedVolume.Layout->GetHeaderSize();
}
catch (PasswordException&)
{
diff --git a/src/Volume/VolumeLayout.cpp b/src/Volume/VolumeLayout.cpp
index fb75a869..21c00b54 100644
--- a/src/Volume/VolumeLayout.cpp
+++ b/src/Volume/VolumeLayout.cpp
@@ -28,7 +28,6 @@ namespace VeraCrypt
layouts.push_back (shared_ptr <VolumeLayout> (new VolumeLayoutV2Normal ()));
layouts.push_back (shared_ptr <VolumeLayout> (new VolumeLayoutV1Normal ()));
layouts.push_back (shared_ptr <VolumeLayout> (new VolumeLayoutV2Hidden ()));
- layouts.push_back (shared_ptr <VolumeLayout> (new VolumeLayoutV1Hidden ()));
layouts.push_back (shared_ptr <VolumeLayout> (new VolumeLayoutSystemEncryption ()));
if (type != VolumeType::Unknown)
@@ -85,35 +84,6 @@ namespace VeraCrypt
}
- VolumeLayoutV1Hidden::VolumeLayoutV1Hidden ()
- {
- Type = VolumeType::Hidden;
- HeaderOffset = -TC_HIDDEN_VOLUME_HEADER_OFFSET_LEGACY;
- HeaderSize = TC_VOLUME_HEADER_SIZE_LEGACY;
-
- SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AES ()));
- SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Serpent ()));
- SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
- SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AESTwofish ()));
- SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AESTwofishSerpent ()));
- SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentAES ()));
- SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
- SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
-
- SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
- }
-
- uint64 VolumeLayoutV1Hidden::GetDataOffset (uint64 volumeHostSize) const
- {
- return volumeHostSize - GetDataSize (volumeHostSize) + HeaderOffset;
- }
-
- uint64 VolumeLayoutV1Hidden::GetDataSize (uint64 volumeHostSize) const
- {
- return Header->GetHiddenVolumeDataSize ();
- }
-
-
VolumeLayoutV2Normal::VolumeLayoutV2Normal ()
{
Type = VolumeType::Normal;
diff --git a/src/Volume/VolumeLayout.h b/src/Volume/VolumeLayout.h
index 57d278cc..e49f74b6 100644
--- a/src/Volume/VolumeLayout.h
+++ b/src/Volume/VolumeLayout.h
@@ -78,24 +78,6 @@ namespace VeraCrypt
};
- class VolumeLayoutV1Hidden : public VolumeLayout
- {
- public:
- VolumeLayoutV1Hidden ();
- virtual ~VolumeLayoutV1Hidden () { }
-
- virtual int GetBackupHeaderOffset () const { throw NotApplicable (SRC_POS); }
- virtual uint64 GetDataOffset (uint64 volumeHostSize) const;
- virtual uint64 GetDataSize (uint64 volumeHostSize) const;
- virtual uint64 GetMaxDataSize (uint64 volumeSize) const { throw NotApplicable (SRC_POS); }
- virtual bool HasBackupHeader () const { return false; }
-
- private:
- VolumeLayoutV1Hidden (const VolumeLayoutV1Hidden &);
- VolumeLayoutV1Hidden &operator= (const VolumeLayoutV1Hidden &);
- };
-
-
class VolumeLayoutV2Normal : public VolumeLayout
{
public: