1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-12 03:18:26 -06:00

Linux/macOS: explicitely initialize hash algo before hashing random pool

The lack of explicit hash initialization was causing issue with Blake2s
because it doesn't allow further processing once a digest value was
returned.
Other hash algorithms don't have this restriction.
Not we explicitely initialize all hash algorithms which is the correct
way to do things.
This commit is contained in:
Mounir IDRASSI
2023-05-27 10:21:40 +02:00
parent 40caafdb1b
commit f4b310b23f

View File

@@ -192,6 +192,7 @@ namespace VeraCrypt
{
// Compute the message digest of the entire pool using the selected hash function
SecureBuffer digest (PoolHash->GetDigestSize());
PoolHash->Init();
PoolHash->ProcessData (Pool);
PoolHash->GetDigest (digest);
@@ -262,14 +263,14 @@ namespace VeraCrypt
AddToPool (buffer);
}
if (Crc32::ProcessBuffer (Pool) != 0x9ae2fff8)
if (Crc32::ProcessBuffer (Pool) != 0x21CED8B7)
throw TestFailed (SRC_POS);
buffer.Allocate (PoolSize);
buffer.CopyFrom (PeekPool());
AddToPool (buffer);
if (Crc32::ProcessBuffer (Pool) != 0x391135a7)
if (Crc32::ProcessBuffer (Pool) != 0xDCFD0A83)
throw TestFailed (SRC_POS);
PoolHash = origPoolHash;