VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-01-10 04:25:49 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-01-12 08:42:54 (GMT)
commite831198b3b0afbcd21cb9a4b1aef90fa8b198d69 (patch)
tree5be0a3402375068ef37ce2d5b6b084c5b01d2521
parente3d5077939898f691dcecc965e77b81a3443b662 (diff)
downloadVeraCrypt-e831198b3b0afbcd21cb9a4b1aef90fa8b198d69.zip
VeraCrypt-e831198b3b0afbcd21cb9a4b1aef90fa8b198d69.tar.gz
Windows: Fix Streebog not recognized by /hash command line switch but making hash names matching more generic.
-rw-r--r--src/Common/Crypto.c5
-rw-r--r--src/Common/Crypto.h4
-rw-r--r--src/Format/Tcformat.c18
-rw-r--r--src/Mount/Mount.c18
4 files changed, 26 insertions, 19 deletions
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c
index 808c8af..6c2b2e8 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -762,16 +762,17 @@ Hash *HashGet (int id)
return 0;
}
-
+#ifdef _WIN32
int HashGetIdByName (wchar_t *name)
{
int i;
for (i = 0; Hashes[i].Id != 0; i++)
- if (wcscmp (Hashes[i].Name, name) == 0)
+ if (_wcsicmp (Hashes[i].Name, name) == 0)
return Hashes[i].Id;
return 0;
}
+#endif
const wchar_t *HashGetName (int hashId)
{
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h
index 8e8bace..9aba0ea 100644
--- a/src/Common/Crypto.h
+++ b/src/Common/Crypto.h
@@ -363,7 +363,9 @@ BOOL EAIsModeSupported (int ea, int testedMode);
#ifndef TC_WINDOWS_BOOT
const wchar_t *HashGetName (int hash_algo_id);
-
+#ifdef _WIN32
+int HashGetIdByName (wchar_t *name);
+#endif
Hash *HashGet (int id);
void HashGetName2 (wchar_t *buf, int hashId);
BOOL HashIsDeprecated (int hashId);
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index d83d9f4..02210b1 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -9000,20 +9000,22 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
&i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
{
- if (_wcsicmp(szTmp, L"sha512") == 0 || _wcsicmp(szTmp, L"sha-512") == 0)
+ /* match against special names first */
+ if (_wcsicmp(szTmp, L"sha512") == 0)
CmdVolumePkcs5 = SHA512;
- else if (_wcsicmp(szTmp, L"whirlpool") == 0)
- CmdVolumePkcs5 = WHIRLPOOL;
- else if (_wcsicmp(szTmp, L"sha256") == 0 || _wcsicmp(szTmp, L"sha-256") == 0)
+ else if (_wcsicmp(szTmp, L"sha256") == 0)
CmdVolumePkcs5 = SHA256;
- else if (_wcsicmp(szTmp, L"ripemd160") == 0 || _wcsicmp(szTmp, L"ripemd-160") == 0)
+ else if (_wcsicmp(szTmp, L"ripemd160") == 0)
CmdVolumePkcs5 = RIPEMD160;
else
{
- CmdVolumePkcs5 = 0;
- AbortProcess ("COMMAND_LINE_ERROR");
+ /* match using internal hash names */
+ CmdVolumePkcs5 = HashGetIdByName (szTmp);
+ if (0 == CmdVolumePkcs5)
+ {
+ AbortProcess ("COMMAND_LINE_ERROR");
+ }
}
-
}
else
AbortProcess ("COMMAND_LINE_ERROR");
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 28a43ac..e90a057 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -8836,20 +8836,22 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
&i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
{
- if (_wcsicmp(szTmp, L"sha512") == 0 || _wcsicmp(szTmp, L"sha-512") == 0)
+ /* match against special names first */
+ if (_wcsicmp(szTmp, L"sha512") == 0)
CmdVolumePkcs5 = SHA512;
- else if (_wcsicmp(szTmp, L"whirlpool") == 0)
- CmdVolumePkcs5 = WHIRLPOOL;
- else if (_wcsicmp(szTmp, L"sha256") == 0 || _wcsicmp(szTmp, L"sha-256") == 0)
+ else if (_wcsicmp(szTmp, L"sha256") == 0)
CmdVolumePkcs5 = SHA256;
- else if (_wcsicmp(szTmp, L"ripemd160") == 0 || _wcsicmp(szTmp, L"ripemd-160") == 0)
+ else if (_wcsicmp(szTmp, L"ripemd160") == 0)
CmdVolumePkcs5 = RIPEMD160;
else
{
- CmdVolumePkcs5 = 0;
- AbortProcess ("COMMAND_LINE_ERROR");
+ /* match using internal hash names */
+ CmdVolumePkcs5 = HashGetIdByName (szTmp);
+ if (0 == CmdVolumePkcs5)
+ {
+ AbortProcess ("COMMAND_LINE_ERROR");
+ }
}
-
}
else
AbortProcess ("COMMAND_LINE_ERROR");