Windows: Fix Streebog not recognized by /hash command line switch but making hash names matching more generic.
This commit is contained in:
parent
e3d5077939
commit
e831198b3b
|
@ -762,16 +762,17 @@ Hash *HashGet (int id)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
int HashGetIdByName (wchar_t *name)
|
int HashGetIdByName (wchar_t *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; Hashes[i].Id != 0; 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 Hashes[i].Id;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const wchar_t *HashGetName (int hashId)
|
const wchar_t *HashGetName (int hashId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -363,7 +363,9 @@ BOOL EAIsModeSupported (int ea, int testedMode);
|
||||||
|
|
||||||
#ifndef TC_WINDOWS_BOOT
|
#ifndef TC_WINDOWS_BOOT
|
||||||
const wchar_t *HashGetName (int hash_algo_id);
|
const wchar_t *HashGetName (int hash_algo_id);
|
||||||
|
#ifdef _WIN32
|
||||||
|
int HashGetIdByName (wchar_t *name);
|
||||||
|
#endif
|
||||||
Hash *HashGet (int id);
|
Hash *HashGet (int id);
|
||||||
void HashGetName2 (wchar_t *buf, int hashId);
|
void HashGetName2 (wchar_t *buf, int hashId);
|
||||||
BOOL HashIsDeprecated (int hashId);
|
BOOL HashIsDeprecated (int hashId);
|
||||||
|
|
|
@ -9000,20 +9000,22 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
|
||||||
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
|
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
|
||||||
&i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
|
&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;
|
CmdVolumePkcs5 = SHA512;
|
||||||
else if (_wcsicmp(szTmp, L"whirlpool") == 0)
|
else if (_wcsicmp(szTmp, L"sha256") == 0)
|
||||||
CmdVolumePkcs5 = WHIRLPOOL;
|
|
||||||
else if (_wcsicmp(szTmp, L"sha256") == 0 || _wcsicmp(szTmp, L"sha-256") == 0)
|
|
||||||
CmdVolumePkcs5 = SHA256;
|
CmdVolumePkcs5 = SHA256;
|
||||||
else if (_wcsicmp(szTmp, L"ripemd160") == 0 || _wcsicmp(szTmp, L"ripemd-160") == 0)
|
else if (_wcsicmp(szTmp, L"ripemd160") == 0)
|
||||||
CmdVolumePkcs5 = RIPEMD160;
|
CmdVolumePkcs5 = RIPEMD160;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CmdVolumePkcs5 = 0;
|
/* match using internal hash names */
|
||||||
AbortProcess ("COMMAND_LINE_ERROR");
|
CmdVolumePkcs5 = HashGetIdByName (szTmp);
|
||||||
|
if (0 == CmdVolumePkcs5)
|
||||||
|
{
|
||||||
|
AbortProcess ("COMMAND_LINE_ERROR");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AbortProcess ("COMMAND_LINE_ERROR");
|
AbortProcess ("COMMAND_LINE_ERROR");
|
||||||
|
|
|
@ -8836,20 +8836,22 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
|
||||||
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
|
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
|
||||||
&i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)))
|
&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;
|
CmdVolumePkcs5 = SHA512;
|
||||||
else if (_wcsicmp(szTmp, L"whirlpool") == 0)
|
else if (_wcsicmp(szTmp, L"sha256") == 0)
|
||||||
CmdVolumePkcs5 = WHIRLPOOL;
|
|
||||||
else if (_wcsicmp(szTmp, L"sha256") == 0 || _wcsicmp(szTmp, L"sha-256") == 0)
|
|
||||||
CmdVolumePkcs5 = SHA256;
|
CmdVolumePkcs5 = SHA256;
|
||||||
else if (_wcsicmp(szTmp, L"ripemd160") == 0 || _wcsicmp(szTmp, L"ripemd-160") == 0)
|
else if (_wcsicmp(szTmp, L"ripemd160") == 0)
|
||||||
CmdVolumePkcs5 = RIPEMD160;
|
CmdVolumePkcs5 = RIPEMD160;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CmdVolumePkcs5 = 0;
|
/* match using internal hash names */
|
||||||
AbortProcess ("COMMAND_LINE_ERROR");
|
CmdVolumePkcs5 = HashGetIdByName (szTmp);
|
||||||
|
if (0 == CmdVolumePkcs5)
|
||||||
|
{
|
||||||
|
AbortProcess ("COMMAND_LINE_ERROR");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AbortProcess ("COMMAND_LINE_ERROR");
|
AbortProcess ("COMMAND_LINE_ERROR");
|
||||||
|
|
Loading…
Reference in New Issue