diff options
author | lealem47 <60322859+lealem47@users.noreply.github.com> | 2023-11-12 16:51:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 00:51:31 +0100 |
commit | 9247ce1bb90c44d19a0069fadb12c0c480ac9b4f (patch) | |
tree | 66fb4728d502759271d03eba59d51c1a129b2ffb /src/Core/RandomNumberGenerator.cpp | |
parent | 458be85f84a097aa829658c50ce41d82791fb6a8 (diff) | |
download | VeraCrypt-9247ce1bb90c44d19a0069fadb12c0c480ac9b4f.tar.gz VeraCrypt-9247ce1bb90c44d19a0069fadb12c0c480ac9b4f.zip |
wolfCrypt as crypto backend for VeraCrypt (#1227)
* wolfCrypt as crypto backend for VeraCrypt
* Refactor to use EncryptionModeWolfCryptXTS class
Diffstat (limited to 'src/Core/RandomNumberGenerator.cpp')
-rw-r--r-- | src/Core/RandomNumberGenerator.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/Core/RandomNumberGenerator.cpp b/src/Core/RandomNumberGenerator.cpp index 6b401901..3fb6062a 100644 --- a/src/Core/RandomNumberGenerator.cpp +++ b/src/Core/RandomNumberGenerator.cpp @@ -257,7 +257,11 @@ namespace VeraCrypt void RandomNumberGenerator::Test () { shared_ptr <Hash> origPoolHash = PoolHash; - PoolHash.reset (new Blake2s()); + #ifndef WOLFCRYPT_BACKEND + PoolHash.reset (new Blake2s()); + #else + PoolHash.reset (new Sha256()); + #endif Pool.Zero(); Buffer buffer (1); @@ -267,15 +271,23 @@ namespace VeraCrypt AddToPool (buffer); } + #ifndef WOLFCRYPT_BACKEND if (Crc32::ProcessBuffer (Pool) != 0x9c743238) - throw TestFailed (SRC_POS); + #else + if (Crc32::ProcessBuffer (Pool) != 0xac95ac1a) + #endif + throw TestFailed (SRC_POS); buffer.Allocate (PoolSize); buffer.CopyFrom (PeekPool()); AddToPool (buffer); - if (Crc32::ProcessBuffer (Pool) != 0xd2d09c8d) - throw TestFailed (SRC_POS); + #ifndef WOLFCRYPT_BACKEND + if (Crc32::ProcessBuffer (Pool) != 0xd2d09c8d) + #else + if (Crc32::ProcessBuffer (Pool) != 0xb79f3c12) + #endif + throw TestFailed (SRC_POS); PoolHash = origPoolHash; } |