1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-12 02:34:59 +03:00

Revamp digest functions

- Hash() has been removed because it was ambiguous, Md5() and Sha0() are proper replacements.
- HMacMd5() and HMacSha1() now share a common implementation handled by the new Internal_HMac() function.
- NewMd() and MdProcess() now support plain hashing (without the key).
- NewMd(), SetMdKey() and MdProcess() now check the OpenSSL functions' return value and in case of failure a debug message is printed along with the error string, if available.
- SetMdKey()'s return value has been changed from void to bool, so that it's possible to know whether the function succeeded or not.
- MdProcess()' return value has been changed from void to UINT (unsigned int) and the function now returns the number of bytes written by HMAC_Final() or EVP_DigestFinal_ex().
This commit is contained in:
Davide Beatrici
2018-09-22 06:35:30 +02:00
parent 69b35f875a
commit 3f5f716357
41 changed files with 329 additions and 371 deletions

View File

@ -8018,7 +8018,7 @@ UINT StSetHub(ADMIN *a, RPC_CREATE_HUB *t)
{
UCHAR hash1[SHA1_SIZE], hash2[SHA1_SIZE];
HashPassword(hash1, ADMINISTRATOR_USERNAME, "");
Hash(hash2, "", 0, true);
Sha0(hash2, "", 0);
if (Cmp(t->HashedPassword, hash2, SHA1_SIZE) == 0 || Cmp(t->SecurePassword, hash1, SHA1_SIZE) == 0)
{
@ -13602,7 +13602,7 @@ void HashAdminPassword(void *hash, char *password)
return;
}
Hash(hash, password, StrLen(password), true);
Sha0(hash, password, StrLen(password));
}
// Disconnect admin connection
@ -13823,7 +13823,7 @@ bool SiIsEmptyPassword(void *hash_password)
return false;
}
Hash(hash, "", 0, true);
Sha0(hash, "", 0);
if (Cmp(hash_password, hash, SHA1_SIZE) == 0)
{