1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 02:58:02 -06:00

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

This commit is contained in:
Mounir IDRASSI
2019-01-30 11:48:07 +01:00
parent f02882ce60
commit 3c18d54d1e
2 changed files with 7 additions and 6 deletions

View File

@@ -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);