1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-09-25 20:59:20 +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

@ -509,7 +509,7 @@ void NsGenMacAddressSignatureForMachine(UCHAR *dst_last_2, UCHAR *src_mac_addr_4
WriteBuf(b, src_mac_addr_4, 4);
WriteBufStr(b, machine_name);
HashSha1(hash, b->Buf, b->Size);
Sha1(hash, b->Buf, b->Size);
FreeBuf(b);
@ -533,7 +533,7 @@ void NsGenMacAddress(void *dest, char *mac_address_seed, char *device_name)
StrLower(tmp);
HashSha1(hash, tmp, StrLen(tmp));
Sha1(hash, tmp, StrLen(tmp));
mac[0] = NS_MAC_ADDRESS_BYTE_1;
mac[1] = hash[1];
@ -562,7 +562,7 @@ IPTABLES_STATE *StartAddIpTablesEntryForNativeStack(void *seed, UINT seed_size)
ret->EntryList = NewListFast(NULL);
HashSha1(ret->SeedHash, seed, seed_size);
Sha1(ret->SeedHash, seed, seed_size);
// Create a pair of entry
e = ZeroMalloc(sizeof(IPTABLES_ENTRY));