VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Core
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-05-27 10:21:40 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-05-27 10:25:56 +0200
commitf4b310b23f276744a1616137810c2135c7d5f736 (patch)
tree9c240f76fe25ffb7975a847757f1399ae505b499 /src/Core
parent40caafdb1be73ac645c75ef31cbbc32624b6eee3 (diff)
downloadVeraCrypt-f4b310b23f276744a1616137810c2135c7d5f736.tar.gz
VeraCrypt-f4b310b23f276744a1616137810c2135c7d5f736.zip
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.
Diffstat (limited to 'src/Core')
-rw-r--r--src/Core/RandomNumberGenerator.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Core/RandomNumberGenerator.cpp b/src/Core/RandomNumberGenerator.cpp
index 39753ee8..2473ef2f 100644
--- a/src/Core/RandomNumberGenerator.cpp
+++ b/src/Core/RandomNumberGenerator.cpp
@@ -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;