VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Crypto.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-01-21 00:42:53 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-01-21 00:45:31 +0100
commitee0a2659da24b4b7543f52647fb2d8cbbd12408c (patch)
tree2977c82ee2d24d4c0bfd18a30b3f0fe7b4b25601 /src/Common/Crypto.c
parent27b3fee02d5242e743f87dd15db61d89073e8caa (diff)
downloadVeraCrypt-ee0a2659da24b4b7543f52647fb2d8cbbd12408c.tar.gz
VeraCrypt-ee0a2659da24b4b7543f52647fb2d8cbbd12408c.zip
Windows driver: remove volumes master keys from CRYPTO_INFO since they are not needed after their key schedule is created
Diffstat (limited to 'src/Common/Crypto.c')
-rw-r--r--src/Common/Crypto.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c
index f63062a3..299595bd 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -532,13 +532,13 @@ int EAInit (int ea, unsigned char *key, unsigned __int8 *ks)
#ifndef TC_WINDOWS_BOOT
-BOOL EAInitMode (PCRYPTO_INFO ci)
+BOOL EAInitMode (PCRYPTO_INFO ci, unsigned char* key2)
{
switch (ci->mode)
{
case XTS:
// Secondary key schedule
- if (EAInit (ci->ea, ci->k2, ci->ks2) != ERR_SUCCESS)
+ if (EAInit (ci->ea, key2, ci->ks2) != ERR_SUCCESS)
return FALSE;
/* 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->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->k2, sizeof (cryptoInfo->k2));
+#endif
burn (&cryptoInfo->noIterations, sizeof (cryptoInfo->noIterations));
burn (&cryptoInfo->volumePim, sizeof (cryptoInfo->volumePim));
}