VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 808c8af7..6c2b2e84 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -762,16 +762,17 @@ Hash *HashGet (int id)
762 return 0; 762 return 0;
763} 763}
764 764
765 765#ifdef _WIN32
766int HashGetIdByName (wchar_t *name) 766int HashGetIdByName (wchar_t *name)
767{ 767{
768 int i; 768 int i;
769 for (i = 0; Hashes[i].Id != 0; i++) 769 for (i = 0; Hashes[i].Id != 0; i++)
770 if (wcscmp (Hashes[i].Name, name) == 0) 770 if (_wcsicmp (Hashes[i].Name, name) == 0)
771 return Hashes[i].Id; 771 return Hashes[i].Id;
772 772
773 return 0; 773 return 0;
774} 774}
775#endif
775 776
776const wchar_t *HashGetName (int hashId) 777const wchar_t *HashGetName (int hashId)
777{ 778{
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h
index 8e8bace7..9aba0eae 100644
--- a/src/Common/Crypto.h
+++ b/src/Common/Crypto.h
@@ -363,7 +363,9 @@ BOOL EAIsModeSupported (int ea, int testedMode);
363 363
364#ifndef TC_WINDOWS_BOOT 364#ifndef TC_WINDOWS_BOOT
365const wchar_t *HashGetName (int hash_algo_id); 365const wchar_t *HashGetName (int hash_algo_id);
366 366#ifdef _WIN32
367int HashGetIdByName (wchar_t *name);
368#endif
367Hash *HashGet (int id); 369Hash *HashGet (int id);
368void HashGetName2 (wchar_t *buf, int hashId); 370void HashGetName2 (wchar_t *buf, int hashId);
369BOOL HashIsDeprecated (int hashId); 371BOOL HashIsDeprecated (int hashId);
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index d83d9f49..02210b15 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -9000,20 +9000,22 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
9000 if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, 9000 if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
9001 &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp))) 9001 &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
9002 { 9002 {
9003 if (_wcsicmp(szTmp, L"sha512") == 0 || _wcsicmp(szTmp, L"sha-512") == 0) 9003 /* match against special names first */
9004 if (_wcsicmp(szTmp, L"sha512") == 0)
9004 CmdVolumePkcs5 = SHA512; 9005 CmdVolumePkcs5 = SHA512;
9005 else if (_wcsicmp(szTmp, L"whirlpool") == 0) 9006 else if (_wcsicmp(szTmp, L"sha256") == 0)
9006 CmdVolumePkcs5 = WHIRLPOOL;
9007 else if (_wcsicmp(szTmp, L"sha256") == 0 || _wcsicmp(szTmp, L"sha-256") == 0)
9008 CmdVolumePkcs5 = SHA256; 9007 CmdVolumePkcs5 = SHA256;
9009 else if (_wcsicmp(szTmp, L"ripemd160") == 0 || _wcsicmp(szTmp, L"ripemd-160") == 0) 9008 else if (_wcsicmp(szTmp, L"ripemd160") == 0)
9010 CmdVolumePkcs5 = RIPEMD160; 9009 CmdVolumePkcs5 = RIPEMD160;
9011 else 9010 else
9012 { 9011 {
9013 CmdVolumePkcs5 = 0; 9012 /* match using internal hash names */
9014 AbortProcess ("COMMAND_LINE_ERROR"); 9013 CmdVolumePkcs5 = HashGetIdByName (szTmp);
9014 if (0 == CmdVolumePkcs5)
9015 {
9016 AbortProcess ("COMMAND_LINE_ERROR");
9017 }
9015 } 9018 }
9016
9017 } 9019 }
9018 else 9020 else
9019 AbortProcess ("COMMAND_LINE_ERROR"); 9021 AbortProcess ("COMMAND_LINE_ERROR");
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 28a43acf..e90a0571 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -8836,20 +8836,22 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
8836 if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, 8836 if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
8837 &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp))) 8837 &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
8838 { 8838 {
8839 if (_wcsicmp(szTmp, L"sha512") == 0 || _wcsicmp(szTmp, L"sha-512") == 0) 8839 /* match against special names first */
8840 if (_wcsicmp(szTmp, L"sha512") == 0)
8840 CmdVolumePkcs5 = SHA512; 8841 CmdVolumePkcs5 = SHA512;
8841 else if (_wcsicmp(szTmp, L"whirlpool") == 0) 8842 else if (_wcsicmp(szTmp, L"sha256") == 0)
8842 CmdVolumePkcs5 = WHIRLPOOL;
8843 else if (_wcsicmp(szTmp, L"sha256") == 0 || _wcsicmp(szTmp, L"sha-256") == 0)
8844 CmdVolumePkcs5 = SHA256; 8843 CmdVolumePkcs5 = SHA256;
8845 else if (_wcsicmp(szTmp, L"ripemd160") == 0 || _wcsicmp(szTmp, L"ripemd-160") == 0) 8844 else if (_wcsicmp(szTmp, L"ripemd160") == 0)
8846 CmdVolumePkcs5 = RIPEMD160; 8845 CmdVolumePkcs5 = RIPEMD160;
8847 else 8846 else
8848 { 8847 {
8849 CmdVolumePkcs5 = 0; 8848 /* match using internal hash names */
8850 AbortProcess ("COMMAND_LINE_ERROR"); 8849 CmdVolumePkcs5 = HashGetIdByName (szTmp);
8850 if (0 == CmdVolumePkcs5)
8851 {
8852 AbortProcess ("COMMAND_LINE_ERROR");
8853 }
8851 } 8854 }
8852
8853 } 8855 }
8854 else 8856 else
8855 AbortProcess ("COMMAND_LINE_ERROR"); 8857 AbortProcess ("COMMAND_LINE_ERROR");