From 54a23eeacb0839ebb016359940af68e07019c851 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 14 Jun 2026 12:10:55 +0900 Subject: [PATCH] Linux/macOS: expose BLAKE2b-512 as PRF in hash selection dialogs The Blake2b hash class (BLAKE2b-512) was fully implemented but never registered in Hash::GetAvailableAlgorithms(), so it was absent from the Random Pool Enrichment, Keyfile Generator and Benchmark dialogs on Linux/macOS. In particular, when Argon2 is selected as the volume PRF, the RNG pool hash is set to BLAKE2b-512, but the Random Pool Enrichment dialog could neither display nor pre-select it, diverging from Windows which offers BLAKE2b-512 in the same dialog. Register Blake2b after Streebog (matching the Crypto.c PRF order). Its 64-byte digest divides RNG_POOL_SIZE (320), so the HashMixPool size constraint holds, and blake2b.o is always built in non-wolfCrypt builds. Also make Pkcs5Kdf::GetAlgorithm(const Hash&) Argon2-aware by removing the unconditional skip of the Argon2 KDF, so a BLAKE2b-512 hash now maps to the Argon2 KDF instead of throwing. --- src/Volume/Hash.cpp | 1 + src/Volume/Pkcs5Kdf.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Volume/Hash.cpp b/src/Volume/Hash.cpp index ed95b741..aeece9ab 100644 --- a/src/Volume/Hash.cpp +++ b/src/Volume/Hash.cpp @@ -30,6 +30,7 @@ namespace VeraCrypt l.push_back (shared_ptr (new Blake2s ())); l.push_back (shared_ptr (new Whirlpool ())); l.push_back (shared_ptr (new Streebog ())); + l.push_back (shared_ptr (new Blake2b ())); #endif return l; } diff --git a/src/Volume/Pkcs5Kdf.cpp b/src/Volume/Pkcs5Kdf.cpp index ad589aae..8134ad20 100644 --- a/src/Volume/Pkcs5Kdf.cpp +++ b/src/Volume/Pkcs5Kdf.cpp @@ -62,11 +62,11 @@ namespace VeraCrypt shared_ptr Pkcs5Kdf::GetAlgorithm (const Hash &hash) { + // Match the KDF whose underlying hash is the requested one. Argon2 + // (whose underlying hash is BLAKE2b-512) is included, so a BLAKE2b-512 + // hash maps to the Argon2 KDF. foreach (shared_ptr kdf, GetAvailableAlgorithms()) { - if (kdf->IsArgon2()) - continue; - if (typeid (*kdf->GetHash()) == typeid (hash)) return kdf; }