VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Volumes.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-01-30 11:48:07 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-02-01 00:35:33 +0100
commit3c18d54d1e3f10462ccdb2d44f220db1ee021477 (patch)
treeb9ed7432b407d72c563ef196ff94953240d2fc35 /src/Common/Volumes.c
parentf02882ce60b0646168cd4d561293cf489c205866 (diff)
downloadVeraCrypt-3c18d54d1e3f10462ccdb2d44f220db1ee021477.tar.gz
VeraCrypt-3c18d54d1e3f10462ccdb2d44f220db1ee021477.zip
Windows driver: replace SHA512 by RIPEMD160 when calculating internal hash of master key to avoid calling KeSaveFloatingPointState/KeSaveExtendedProcessorState since SHA512 implementation uses SSE2/AVX and RIPEMD160 is pure C
Diffstat (limited to 'src/Common/Volumes.c')
-rw-r--r--src/Common/Volumes.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c
index 111a2287..53734abb 100644
--- a/src/Common/Volumes.c
+++ b/src/Common/Volumes.c
@@ -529,11 +529,12 @@ KeyReady: ;
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);
+ RMD160_CTX ctx;
+ RMD160Init (&ctx);
+ RMD160Update (&ctx, keyInfo.master_keydata, MASTER_KEYDATA_SIZE);
+ RMD160Update (&ctx, header, sizeof(header));
+ RMD160Final (cryptoInfo->master_keydata_hash, &ctx);
+ burn(&ctx, sizeof (ctx));
}
#else
memcpy (cryptoInfo->master_keydata, keyInfo.master_keydata, MASTER_KEYDATA_SIZE);