mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Windows driver: remove volumes master keys from CRYPTO_INFO since they are not needed after their key schedule is created
This commit is contained in:
@@ -532,13 +532,13 @@ int EAInit (int ea, unsigned char *key, unsigned __int8 *ks)
|
|||||||
|
|
||||||
#ifndef TC_WINDOWS_BOOT
|
#ifndef TC_WINDOWS_BOOT
|
||||||
|
|
||||||
BOOL EAInitMode (PCRYPTO_INFO ci)
|
BOOL EAInitMode (PCRYPTO_INFO ci, unsigned char* key2)
|
||||||
{
|
{
|
||||||
switch (ci->mode)
|
switch (ci->mode)
|
||||||
{
|
{
|
||||||
case XTS:
|
case XTS:
|
||||||
// Secondary key schedule
|
// Secondary key schedule
|
||||||
if (EAInit (ci->ea, ci->k2, ci->ks2) != ERR_SUCCESS)
|
if (EAInit (ci->ea, key2, ci->ks2) != ERR_SUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Note: XTS mode could potentially be initialized with a weak key causing all blocks in one data unit
|
/* Note: XTS mode could potentially be initialized with a weak key causing all blocks in one data unit
|
||||||
@@ -889,8 +889,12 @@ void crypto_eraseKeys (PCRYPTO_INFO cryptoInfo)
|
|||||||
{
|
{
|
||||||
burn (cryptoInfo->ks, sizeof (cryptoInfo->ks));
|
burn (cryptoInfo->ks, sizeof (cryptoInfo->ks));
|
||||||
burn (cryptoInfo->ks2, sizeof (cryptoInfo->ks2));
|
burn (cryptoInfo->ks2, sizeof (cryptoInfo->ks2));
|
||||||
|
#ifdef TC_WINDOWS_DRIVER
|
||||||
|
burn (cryptoInfo->master_keydata_hash, sizeof (cryptoInfo->master_keydata_hash));
|
||||||
|
#else
|
||||||
burn (cryptoInfo->master_keydata, sizeof (cryptoInfo->master_keydata));
|
burn (cryptoInfo->master_keydata, sizeof (cryptoInfo->master_keydata));
|
||||||
burn (cryptoInfo->k2, sizeof (cryptoInfo->k2));
|
burn (cryptoInfo->k2, sizeof (cryptoInfo->k2));
|
||||||
|
#endif
|
||||||
burn (&cryptoInfo->noIterations, sizeof (cryptoInfo->noIterations));
|
burn (&cryptoInfo->noIterations, sizeof (cryptoInfo->noIterations));
|
||||||
burn (&cryptoInfo->volumePim, sizeof (cryptoInfo->volumePim));
|
burn (&cryptoInfo->volumePim, sizeof (cryptoInfo->volumePim));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,8 +245,12 @@ typedef struct CRYPTO_INFO_t
|
|||||||
#ifndef TC_WINDOWS_BOOT
|
#ifndef TC_WINDOWS_BOOT
|
||||||
uint16 HeaderVersion;
|
uint16 HeaderVersion;
|
||||||
|
|
||||||
|
#ifdef TC_WINDOWS_DRIVER
|
||||||
|
unsigned __int8 master_keydata_hash[SHA512_DIGESTSIZE];
|
||||||
|
#else
|
||||||
CRYPTOPP_ALIGN_DATA(16) unsigned __int8 master_keydata[MASTER_KEYDATA_SIZE]; /* This holds the volume header area containing concatenated master key(s) and secondary key(s) (XTS mode). For LRW (deprecated/legacy), it contains the tweak key before the master key(s). For CBC (deprecated/legacy), it contains the IV seed before the master key(s). */
|
CRYPTOPP_ALIGN_DATA(16) unsigned __int8 master_keydata[MASTER_KEYDATA_SIZE]; /* This holds the volume header area containing concatenated master key(s) and secondary key(s) (XTS mode). For LRW (deprecated/legacy), it contains the tweak key before the master key(s). For CBC (deprecated/legacy), it contains the IV seed before the master key(s). */
|
||||||
CRYPTOPP_ALIGN_DATA(16) unsigned __int8 k2[MASTER_KEYDATA_SIZE]; /* For XTS, this contains the secondary key (if cascade, multiple concatenated). For LRW (deprecated/legacy), it contains the tweak key. For CBC (deprecated/legacy), it contains the IV seed. */
|
CRYPTOPP_ALIGN_DATA(16) unsigned __int8 k2[MASTER_KEYDATA_SIZE]; /* For XTS, this contains the secondary key (if cascade, multiple concatenated). For LRW (deprecated/legacy), it contains the tweak key. For CBC (deprecated/legacy), it contains the IV seed. */
|
||||||
|
#endif
|
||||||
|
|
||||||
int noIterations;
|
int noIterations;
|
||||||
BOOL bTrueCryptMode;
|
BOOL bTrueCryptMode;
|
||||||
@@ -320,7 +324,7 @@ int EAInit (int ea, unsigned char *key, unsigned char *ks);
|
|||||||
#else
|
#else
|
||||||
int EAInit (unsigned char *key, unsigned char *ks);
|
int EAInit (unsigned char *key, unsigned char *ks);
|
||||||
#endif
|
#endif
|
||||||
BOOL EAInitMode (PCRYPTO_INFO ci);
|
BOOL EAInitMode (PCRYPTO_INFO ci, unsigned char* key2);
|
||||||
void EncipherBlock(int cipher, void *data, void *ks);
|
void EncipherBlock(int cipher, void *data, void *ks);
|
||||||
void DecipherBlock(int cipher, void *data, void *ks);
|
void DecipherBlock(int cipher, void *data, void *ks);
|
||||||
#ifndef TC_WINDOWS_BOOT
|
#ifndef TC_WINDOWS_BOOT
|
||||||
|
|||||||
@@ -5724,7 +5724,7 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg)
|
|||||||
if (!EAInit (ci->ea, ci->master_keydata, ci->ks))
|
if (!EAInit (ci->ea, ci->master_keydata, ci->ks))
|
||||||
{
|
{
|
||||||
ci->mode = FIRST_MODE_OF_OPERATION_ID;
|
ci->mode = FIRST_MODE_OF_OPERATION_ID;
|
||||||
if (EAInitMode (ci))
|
if (EAInitMode (ci, ci->k2))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -5745,7 +5745,7 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg)
|
|||||||
goto counter_error;
|
goto counter_error;
|
||||||
|
|
||||||
ci->mode = FIRST_MODE_OF_OPERATION_ID;
|
ci->mode = FIRST_MODE_OF_OPERATION_ID;
|
||||||
if (!EAInitMode (ci))
|
if (!EAInitMode (ci, ci->k2))
|
||||||
goto counter_error;
|
goto counter_error;
|
||||||
|
|
||||||
if (QueryPerformanceCounter (&performanceCountStart) == 0)
|
if (QueryPerformanceCounter (&performanceCountStart) == 0)
|
||||||
@@ -6931,7 +6931,7 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memcpy (&ci->k2, secondaryKey, sizeof (secondaryKey));
|
memcpy (&ci->k2, secondaryKey, sizeof (secondaryKey));
|
||||||
if (!EAInitMode (ci))
|
if (!EAInitMode (ci, ci->k2))
|
||||||
{
|
{
|
||||||
crypto_close (ci);
|
crypto_close (ci);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
|
|||||||
burn (temporaryKey, sizeof(temporaryKey));
|
burn (temporaryKey, sizeof(temporaryKey));
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
if (!EAInitMode (cryptoInfo))
|
if (!EAInitMode (cryptoInfo, cryptoInfo->k2))
|
||||||
{
|
{
|
||||||
burn (temporaryKey, sizeof(temporaryKey));
|
burn (temporaryKey, sizeof(temporaryKey));
|
||||||
return ERR_MODE_INIT_FAILED;
|
return ERR_MODE_INIT_FAILED;
|
||||||
|
|||||||
@@ -801,7 +801,7 @@ int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors,
|
|||||||
if (retVal != ERR_SUCCESS)
|
if (retVal != ERR_SUCCESS)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!EAInitMode (cryptoInfo))
|
if (!EAInitMode (cryptoInfo, cryptoInfo->k2))
|
||||||
{
|
{
|
||||||
retVal = ERR_MODE_INIT_FAILED;
|
retVal = ERR_MODE_INIT_FAILED;
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -829,7 +829,7 @@ int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors,
|
|||||||
retVal = EAInit (cryptoInfo->ea, cryptoInfo->master_keydata, cryptoInfo->ks);
|
retVal = EAInit (cryptoInfo->ea, cryptoInfo->master_keydata, cryptoInfo->ks);
|
||||||
if (retVal != ERR_SUCCESS)
|
if (retVal != ERR_SUCCESS)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (!EAInitMode (cryptoInfo))
|
if (!EAInitMode (cryptoInfo, cryptoInfo->k2))
|
||||||
{
|
{
|
||||||
retVal = ERR_MODE_INIT_FAILED;
|
retVal = ERR_MODE_INIT_FAILED;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|||||||
@@ -275,9 +275,7 @@ BOOL XTSAesTest (PCRYPTO_INFO ci)
|
|||||||
if (EAInit (ci->ea, XTS_vectors[i].key1, ci->ks) != ERR_SUCCESS)
|
if (EAInit (ci->ea, XTS_vectors[i].key1, ci->ks) != ERR_SUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
memcpy (&ci->k2, XTS_vectors[i].key2, sizeof (XTS_vectors[i].key2));
|
if (!EAInitMode (ci, XTS_vectors[i].key2))
|
||||||
|
|
||||||
if (!EAInitMode (ci))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
memcpy (p, XTS_vectors[i].plaintext, sizeof (p));
|
memcpy (p, XTS_vectors[i].plaintext, sizeof (p));
|
||||||
@@ -685,6 +683,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
|||||||
0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
|
0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
|
||||||
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13
|
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13
|
||||||
};
|
};
|
||||||
|
CRYPTOPP_ALIGN_DATA(16) unsigned __int8 key2[MASTER_KEYDATA_SIZE];
|
||||||
|
|
||||||
|
|
||||||
/* Encryption/decryption of data units (typically, volume data sectors) */
|
/* Encryption/decryption of data units (typically, volume data sectors) */
|
||||||
@@ -713,12 +712,12 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
|||||||
if (EAInit (ci->ea, key1, ci->ks) != ERR_SUCCESS)
|
if (EAInit (ci->ea, key1, ci->ks) != ERR_SUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
for (i = 0; i < sizeof (ci->k2); i++)
|
for (i = 0; i < sizeof (key2); i++)
|
||||||
ci->k2[i] = (unsigned char) i;
|
key2[i] = (unsigned char) i;
|
||||||
|
|
||||||
memcpy (&ci->k2, XTS_vectors[XTS_TEST_COUNT-1].key2, sizeof (XTS_vectors[XTS_TEST_COUNT-1].key2));
|
memcpy (key2, XTS_vectors[XTS_TEST_COUNT-1].key2, sizeof (XTS_vectors[XTS_TEST_COUNT-1].key2));
|
||||||
|
|
||||||
if (!EAInitMode (ci))
|
if (!EAInitMode (ci, key2))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Each data unit will contain the same plaintext
|
// Each data unit will contain the same plaintext
|
||||||
@@ -1189,9 +1188,9 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
|||||||
if (EAInit (ci->ea, key1, ci->ks) != ERR_SUCCESS)
|
if (EAInit (ci->ea, key1, ci->ks) != ERR_SUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
memcpy (&ci->k2, XTS_vectors[XTS_TEST_COUNT-1].key2, sizeof (XTS_vectors[XTS_TEST_COUNT-1].key2));
|
memcpy (key2, XTS_vectors[XTS_TEST_COUNT-1].key2, sizeof (XTS_vectors[XTS_TEST_COUNT-1].key2));
|
||||||
|
|
||||||
if (!EAInitMode (ci))
|
if (!EAInitMode (ci, key2))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Each data unit will contain the same plaintext
|
// Each data unit will contain the same plaintext
|
||||||
|
|||||||
@@ -392,11 +392,12 @@ KeyReady: ;
|
|||||||
|
|
||||||
if (cryptoInfo->mode == XTS)
|
if (cryptoInfo->mode == XTS)
|
||||||
{
|
{
|
||||||
|
#ifndef TC_WINDOWS_DRIVER
|
||||||
// Copy the secondary key (if cascade, multiple concatenated)
|
// Copy the secondary key (if cascade, multiple concatenated)
|
||||||
memcpy (cryptoInfo->k2, dk + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea));
|
memcpy (cryptoInfo->k2, dk + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea));
|
||||||
|
#endif
|
||||||
// Secondary key schedule
|
// Secondary key schedule
|
||||||
if (!EAInitMode (cryptoInfo))
|
if (!EAInitMode (cryptoInfo, dk + EAGetKeySize (cryptoInfo->ea)))
|
||||||
{
|
{
|
||||||
status = ERR_MODE_INIT_FAILED;
|
status = ERR_MODE_INIT_FAILED;
|
||||||
goto err;
|
goto err;
|
||||||
@@ -526,8 +527,17 @@ KeyReady: ;
|
|||||||
|
|
||||||
// Master key data
|
// Master key data
|
||||||
memcpy (keyInfo.master_keydata, header + HEADER_MASTER_KEYDATA_OFFSET, MASTER_KEYDATA_SIZE);
|
memcpy (keyInfo.master_keydata, header + HEADER_MASTER_KEYDATA_OFFSET, MASTER_KEYDATA_SIZE);
|
||||||
|
#ifdef TC_WINDOWS_DRIVER
|
||||||
|
{
|
||||||
|
sha512_ctx sha2;
|
||||||
|
sha512_begin (&sha2);
|
||||||
|
sha512_hash (keyInfo.master_keydata, MASTER_KEYDATA_SIZE, &sha2);
|
||||||
|
sha512_hash (header, sizeof(header), &sha2);
|
||||||
|
sha512_end (cryptoInfo->master_keydata_hash, &sha2);
|
||||||
|
}
|
||||||
|
#else
|
||||||
memcpy (cryptoInfo->master_keydata, keyInfo.master_keydata, MASTER_KEYDATA_SIZE);
|
memcpy (cryptoInfo->master_keydata, keyInfo.master_keydata, MASTER_KEYDATA_SIZE);
|
||||||
|
#endif
|
||||||
// PKCS #5
|
// PKCS #5
|
||||||
cryptoInfo->pkcs5 = pkcs5_prf;
|
cryptoInfo->pkcs5 = pkcs5_prf;
|
||||||
cryptoInfo->noIterations = keyInfo.noIterations;
|
cryptoInfo->noIterations = keyInfo.noIterations;
|
||||||
@@ -538,17 +548,11 @@ KeyReady: ;
|
|||||||
status = EAInit (cryptoInfo->ea, keyInfo.master_keydata + primaryKeyOffset, cryptoInfo->ks);
|
status = EAInit (cryptoInfo->ea, keyInfo.master_keydata + primaryKeyOffset, cryptoInfo->ks);
|
||||||
if (status == ERR_CIPHER_INIT_FAILURE)
|
if (status == ERR_CIPHER_INIT_FAILURE)
|
||||||
goto err;
|
goto err;
|
||||||
|
#ifndef TC_WINDOWS_DRIVER
|
||||||
switch (cryptoInfo->mode)
|
// The secondary master key (if cascade, multiple concatenated)
|
||||||
{
|
memcpy (cryptoInfo->k2, keyInfo.master_keydata + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea));
|
||||||
|
#endif
|
||||||
default:
|
if (!EAInitMode (cryptoInfo, keyInfo.master_keydata + EAGetKeySize (cryptoInfo->ea)))
|
||||||
// The secondary master key (if cascade, multiple concatenated)
|
|
||||||
memcpy (cryptoInfo->k2, keyInfo.master_keydata + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EAInitMode (cryptoInfo))
|
|
||||||
{
|
{
|
||||||
status = ERR_MODE_INIT_FAILED;
|
status = ERR_MODE_INIT_FAILED;
|
||||||
goto err;
|
goto err;
|
||||||
@@ -1031,14 +1035,11 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
|
|||||||
|
|
||||||
/* Header encryption */
|
/* Header encryption */
|
||||||
|
|
||||||
switch (mode)
|
#ifndef TC_WINDOWS_DRIVER
|
||||||
{
|
// The secondary key (if cascade, multiple concatenated)
|
||||||
|
memcpy (cryptoInfo->k2, dk + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea));
|
||||||
default:
|
primaryKeyOffset = 0;
|
||||||
// The secondary key (if cascade, multiple concatenated)
|
#endif
|
||||||
memcpy (cryptoInfo->k2, dk + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea));
|
|
||||||
primaryKeyOffset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
retVal = EAInit (cryptoInfo->ea, dk + primaryKeyOffset, cryptoInfo->ks);
|
retVal = EAInit (cryptoInfo->ea, dk + primaryKeyOffset, cryptoInfo->ks);
|
||||||
if (retVal != ERR_SUCCESS)
|
if (retVal != ERR_SUCCESS)
|
||||||
@@ -1048,7 +1049,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mode of operation
|
// Mode of operation
|
||||||
if (!EAInitMode (cryptoInfo))
|
if (!EAInitMode (cryptoInfo, dk + EAGetKeySize (cryptoInfo->ea)))
|
||||||
{
|
{
|
||||||
crypto_close (cryptoInfo);
|
crypto_close (cryptoInfo);
|
||||||
retVal = ERR_OUTOFMEMORY;
|
retVal = ERR_OUTOFMEMORY;
|
||||||
@@ -1074,16 +1075,13 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
|
|||||||
|
|
||||||
memcpy (cryptoInfo->master_keydata, keyInfo.master_keydata, MASTER_KEYDATA_SIZE);
|
memcpy (cryptoInfo->master_keydata, keyInfo.master_keydata, MASTER_KEYDATA_SIZE);
|
||||||
|
|
||||||
switch (cryptoInfo->mode)
|
#ifndef TC_WINDOWS_DRIVER
|
||||||
{
|
// The secondary master key (if cascade, multiple concatenated)
|
||||||
|
memcpy (cryptoInfo->k2, keyInfo.master_keydata + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea));
|
||||||
default:
|
#endif
|
||||||
// The secondary master key (if cascade, multiple concatenated)
|
|
||||||
memcpy (cryptoInfo->k2, keyInfo.master_keydata + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mode of operation
|
// Mode of operation
|
||||||
if (!EAInitMode (cryptoInfo))
|
if (!EAInitMode (cryptoInfo, keyInfo.master_keydata + EAGetKeySize (cryptoInfo->ea)))
|
||||||
{
|
{
|
||||||
crypto_close (cryptoInfo);
|
crypto_close (cryptoInfo);
|
||||||
retVal = ERR_OUTOFMEMORY;
|
retVal = ERR_OUTOFMEMORY;
|
||||||
@@ -1282,7 +1280,7 @@ int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO
|
|||||||
if (nStatus != ERR_SUCCESS)
|
if (nStatus != ERR_SUCCESS)
|
||||||
goto final_seq;
|
goto final_seq;
|
||||||
|
|
||||||
if (!EAInitMode (cryptoInfo))
|
if (!EAInitMode (cryptoInfo, cryptoInfo->k2))
|
||||||
{
|
{
|
||||||
nStatus = ERR_MODE_INIT_FAILED;
|
nStatus = ERR_MODE_INIT_FAILED;
|
||||||
goto final_seq;
|
goto final_seq;
|
||||||
@@ -1344,7 +1342,7 @@ int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO
|
|||||||
if (nStatus != ERR_SUCCESS)
|
if (nStatus != ERR_SUCCESS)
|
||||||
goto final_seq;
|
goto final_seq;
|
||||||
|
|
||||||
if (!EAInitMode (cryptoInfo))
|
if (!EAInitMode (cryptoInfo, cryptoInfo->k2))
|
||||||
{
|
{
|
||||||
nStatus = ERR_MODE_INIT_FAILED;
|
nStatus = ERR_MODE_INIT_FAILED;
|
||||||
goto final_seq;
|
goto final_seq;
|
||||||
|
|||||||
@@ -2181,10 +2181,8 @@ static VOID DecoySystemWipeThreadProc (PVOID threadArg)
|
|||||||
DecoySystemWipeResult = STATUS_INVALID_PARAMETER;
|
DecoySystemWipeResult = STATUS_INVALID_PARAMETER;
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy (wipeCryptoInfo->k2, WipeDecoyRequest.WipeKey + EAGetKeySize (ea), EAGetKeySize (ea));
|
|
||||||
|
|
||||||
if (!EAInitMode (wipeCryptoInfo))
|
if (!EAInitMode (wipeCryptoInfo, WipeDecoyRequest.WipeKey + EAGetKeySize (ea)))
|
||||||
{
|
{
|
||||||
DecoySystemWipeResult = STATUS_INVALID_PARAMETER;
|
DecoySystemWipeResult = STATUS_INVALID_PARAMETER;
|
||||||
goto err;
|
goto err;
|
||||||
|
|||||||
@@ -663,7 +663,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
|
|||||||
if (Extension->cryptoInfo->hiddenVolume && IsHiddenSystemRunning())
|
if (Extension->cryptoInfo->hiddenVolume && IsHiddenSystemRunning())
|
||||||
{
|
{
|
||||||
// Prevent mount of a hidden system partition if the system hosted on it is currently running
|
// Prevent mount of a hidden system partition if the system hosted on it is currently running
|
||||||
if (memcmp (Extension->cryptoInfo->master_keydata, GetSystemDriveCryptoInfo()->master_keydata, EAGetKeySize (Extension->cryptoInfo->ea)) == 0)
|
if (memcmp (Extension->cryptoInfo->master_keydata_hash, GetSystemDriveCryptoInfo()->master_keydata_hash, sizeof(Extension->cryptoInfo->master_keydata_hash)) == 0)
|
||||||
{
|
{
|
||||||
mount->nReturnCode = ERR_VOL_ALREADY_MOUNTED;
|
mount->nReturnCode = ERR_VOL_ALREADY_MOUNTED;
|
||||||
ntStatus = STATUS_SUCCESS;
|
ntStatus = STATUS_SUCCESS;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors,
|
|||||||
if (retVal != ERR_SUCCESS)
|
if (retVal != ERR_SUCCESS)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!EAInitMode (cryptoInfo))
|
if (!EAInitMode (cryptoInfo, cryptoInfo->k2))
|
||||||
{
|
{
|
||||||
retVal = ERR_MODE_INIT_FAILED;
|
retVal = ERR_MODE_INIT_FAILED;
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -125,7 +125,7 @@ int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors,
|
|||||||
retVal = EAInit (cryptoInfo->ea, cryptoInfo->master_keydata, cryptoInfo->ks);
|
retVal = EAInit (cryptoInfo->ea, cryptoInfo->master_keydata, cryptoInfo->ks);
|
||||||
if (retVal != ERR_SUCCESS)
|
if (retVal != ERR_SUCCESS)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (!EAInitMode (cryptoInfo))
|
if (!EAInitMode (cryptoInfo, cryptoInfo->k2))
|
||||||
{
|
{
|
||||||
retVal = ERR_MODE_INIT_FAILED;
|
retVal = ERR_MODE_INIT_FAILED;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|||||||
@@ -10500,7 +10500,7 @@ noHidden:
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EAInit (volume.CryptoInfo->ea, temporaryKey, volume.CryptoInfo->ks) != ERR_SUCCESS || !EAInitMode (volume.CryptoInfo))
|
if (EAInit (volume.CryptoInfo->ea, temporaryKey, volume.CryptoInfo->ks) != ERR_SUCCESS || !EAInitMode (volume.CryptoInfo, volume.CryptoInfo->k2))
|
||||||
{
|
{
|
||||||
nStatus = ERR_PARAMETER_INCORRECT;
|
nStatus = ERR_PARAMETER_INCORRECT;
|
||||||
goto error;
|
goto error;
|
||||||
@@ -10509,7 +10509,7 @@ noHidden:
|
|||||||
EncryptBuffer (backup, backupFileSize, volume.CryptoInfo);
|
EncryptBuffer (backup, backupFileSize, volume.CryptoInfo);
|
||||||
|
|
||||||
memcpy (volume.CryptoInfo->k2, originalK2, sizeof (volume.CryptoInfo->k2));
|
memcpy (volume.CryptoInfo->k2, originalK2, sizeof (volume.CryptoInfo->k2));
|
||||||
if (EAInit (volume.CryptoInfo->ea, volume.CryptoInfo->master_keydata, volume.CryptoInfo->ks) != ERR_SUCCESS || !EAInitMode (volume.CryptoInfo))
|
if (EAInit (volume.CryptoInfo->ea, volume.CryptoInfo->master_keydata, volume.CryptoInfo->ks) != ERR_SUCCESS || !EAInitMode (volume.CryptoInfo, volume.CryptoInfo->k2))
|
||||||
{
|
{
|
||||||
nStatus = ERR_PARAMETER_INCORRECT;
|
nStatus = ERR_PARAMETER_INCORRECT;
|
||||||
goto error;
|
goto error;
|
||||||
|
|||||||
Reference in New Issue
Block a user