mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-10 21:23:40 +01: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:
parent
f02882ce60
commit
3c18d54d1e
@ -246,7 +246,7 @@ typedef struct CRYPTO_INFO_t
|
||||
uint16 HeaderVersion;
|
||||
|
||||
#ifdef TC_WINDOWS_DRIVER
|
||||
unsigned __int8 master_keydata_hash[SHA512_DIGESTSIZE];
|
||||
unsigned __int8 master_keydata_hash[RIPEMD160_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 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. */
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user