mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2025-07-07 00:04:57 +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:
@ -9384,7 +9384,7 @@ UINT GetFreeDhcpIpAddressByRandom(VH *v, UCHAR *mac)
|
||||
WRITE_UINT(&rand_seed[0], i);
|
||||
Copy(rand_seed + sizeof(UINT), mac, 6);
|
||||
|
||||
Hash(hash, rand_seed, sizeof(rand_seed), false);
|
||||
Md5(hash, rand_seed, sizeof(rand_seed));
|
||||
|
||||
rand_int = READ_UINT(hash);
|
||||
|
||||
@ -10300,7 +10300,7 @@ void GenMacAddress(UCHAR *mac)
|
||||
WriteBuf(b, rand_data, sizeof(rand_data));
|
||||
|
||||
// Hash
|
||||
Hash(hash, b->Buf, b->Size, true);
|
||||
Sha0(hash, b->Buf, b->Size);
|
||||
|
||||
// Generate a MAC address
|
||||
mac[0] = 0x5E;
|
||||
|
Reference in New Issue
Block a user