VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Volumes.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-09-03 19:34:52 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-09-11 13:12:45 +0200
commit335f17b72f567f1bdb9dbc84a1d42d2cf18f1245 (patch)
tree1f9f5ba97fce7448dcdaf1691d7787c75e643182 /src/Common/Volumes.c
parent735657a25478bb81ccbb7209c27679b93a2b98e4 (diff)
downloadVeraCrypt-335f17b72f567f1bdb9dbc84a1d42d2cf18f1245.tar.gz
VeraCrypt-335f17b72f567f1bdb9dbc84a1d42d2cf18f1245.zip
Windows: in case of In-Place encryption, encrypt random data instead of existing data when filling unused space like the other cases.
Diffstat (limited to 'src/Common/Volumes.c')
-rw-r--r--src/Common/Volumes.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c
index 67b072d6..178f47f0 100644
--- a/src/Common/Volumes.c
+++ b/src/Common/Volumes.c
@@ -1239,7 +1239,7 @@ BOOL WriteEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header)
// Writes randomly generated data to unused/reserved header areas.
// When bPrimaryOnly is TRUE, then only the primary header area (not the backup header area) is filled with random data.
// When bBackupOnly is TRUE, only the backup header area (not the primary header area) is filled with random data.
-int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO *cryptoInfo, uint64 dataAreaSize, BOOL bPrimaryOnly, BOOL bBackupOnly, BOOL bInPlaceEnc)
+int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO *cryptoInfo, uint64 dataAreaSize, BOOL bPrimaryOnly, BOOL bBackupOnly)
{
char temporaryKey[MASTER_KEYDATA_SIZE];
char originalK2[MASTER_KEYDATA_SIZE];
@@ -1298,12 +1298,8 @@ int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO
goto final_seq;
}
- if (backupHeaders || !bInPlaceEnc)
- {
- // encrypt random data instead of existing data for better entropy, except in case of primary
- // header of an in-place encrypted disk
- RandgetBytesFull (hwndDlg, buf + TC_VOLUME_HEADER_EFFECTIVE_SIZE, sizeof (buf) - TC_VOLUME_HEADER_EFFECTIVE_SIZE, FALSE, TRUE);
- }
+ // encrypt random data instead of existing data for better entropy
+ RandgetBytesFull (hwndDlg, buf + TC_VOLUME_HEADER_EFFECTIVE_SIZE, sizeof (buf) - TC_VOLUME_HEADER_EFFECTIVE_SIZE, FALSE, TRUE);
EncryptBuffer (buf + TC_VOLUME_HEADER_EFFECTIVE_SIZE, sizeof (buf) - TC_VOLUME_HEADER_EFFECTIVE_SIZE, cryptoInfo);