diff options
author | kavsrf <kavsrf@gmail.com> | 2016-12-04 13:04:18 +0300 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2016-12-08 17:55:09 +0100 |
commit | c7040ebd2619e4d73b98bc113941f86f2f08992d (patch) | |
tree | 69afd97f267e25310cb8b84abd8e787d9c2d18d6 | |
parent | 97ad654e93f820d19e51bd45ea55fb3c071aac80 (diff) | |
download | VeraCrypt-DCS-c7040ebd2619e4d73b98bc113941f86f2f08992d.tar.gz VeraCrypt-DCS-c7040ebd2619e4d73b98bc113941f86f2f08992d.zip |
decrypt bug fix
-rw-r--r-- | DcsCfg/DcsCfgCrypt.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/DcsCfg/DcsCfgCrypt.c b/DcsCfg/DcsCfgCrypt.c index 7e8192e..61cf87d 100644 --- a/DcsCfg/DcsCfgCrypt.c +++ b/DcsCfg/DcsCfgCrypt.c @@ -121,9 +121,9 @@ TryHeaderDecrypt( return EFI_INVALID_PARAMETER;
}
OUT_PRINT(L"%H" L"Success\n" L"%N", vcres);
- OUT_PRINT(L"Start %lld length %lld\nVolumeSize %lld\nhiddenVolumeSize %lld\nflags 0x%x\n",
+ OUT_PRINT(L"Start %lld length %lld\nVolumeSize %lld\nHiddenVolumeSize %lld\nflags 0x%x\n",
cryptoInfo->EncryptedAreaStart.Value, (uint64)cryptoInfo->EncryptedAreaLength.Value,
- cryptoInfo->VolumeSize,
+ cryptoInfo->VolumeSize.Value,
cryptoInfo->hiddenVolumeSize,
cryptoInfo->HeaderFlags
);
@@ -247,7 +247,6 @@ CreateVolumeHeader( encSectorEnd = AskUINT64("encryption end (sector):", encSectorEnd);
VolumeSize = AskUINT64("volume total (sectors):", VolumeSize);
hiddenVolumeSize = AskUINT64("hidden volume total (sectors):", hiddenVolumeSize);
- gAuthBoot = AskConfirm("Boot mode[N]?", 1);
HeaderFlags = (UINT32)AskUINTN("flags:", gAuthBoot ? TC_HEADER_FLAG_ENCRYPTED_SYSTEM : 0);
vcres = CreateVolumeHeaderInMemory(
@@ -393,6 +392,7 @@ RangeCrypt( if (encrypt) {
remains = size - enSize;
pos = start + enSize;
+ rd = (UINTN)((remains > CRYPT_BUF_SECTORS) ? CRYPT_BUF_SECTORS : remains);
} else {
remains = enSize;
rd = (UINTN)((remains > CRYPT_BUF_SECTORS) ? CRYPT_BUF_SECTORS : remains);
@@ -461,12 +461,12 @@ RangeCrypt( }
} while (EFI_ERROR(res));
+ remains -= rd;
if (encrypt) {
pos += rd;
} else {
- pos -= rd;
+ pos -= (rd > remains) ? remains : rd;
}
- remains -= rd;
// Update header
if (headerInfo != NULL) {
@@ -999,12 +999,20 @@ CreateVolumeHeaderOnDisk( BioPrintDevicePath(index);
OUT_PRINT(L"\n");
+ gAuthBoot = AskConfirm("Boot mode[N]?", 1);
isPart = EfiIsPartition(gBIOHandles[index]);
if (isPart) {
res = EfiGetPartDetails(gBIOHandles[index], &hdp, &hDisk);
if (!EFI_ERROR(res)) {
- encSectorEnd = hdp.PartitionSize - encSectorStart - 256;
- VolumeSize = hdp.PartitionSize;
+ if (gAuthBoot) {
+ encSectorStart = hdp.PartitionStart;
+ encSectorEnd = hdp.PartitionSize + encSectorStart - 1;
+ VolumeSize = hdp.PartitionSize;
+ }
+ else {
+ encSectorEnd = hdp.PartitionSize - encSectorStart - 256;
+ VolumeSize = hdp.PartitionSize;
+ }
}
}
|