mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-16 06:08:15 +00:00
Sane-ify Address, get rid of goofy union thingy.
This commit is contained in:
@ -57,11 +57,13 @@ void Identity::generate()
|
||||
// the address of an identity will be detected as its signature will be
|
||||
// invalid. Of course, deep verification of address/key relationship is
|
||||
// required to cover the more elaborate address claim jump attempt case.
|
||||
unsigned char atmp[ZT_ADDRESS_LENGTH];
|
||||
_address.copyTo(atmp);
|
||||
SHA256_CTX sha;
|
||||
unsigned char dig[32];
|
||||
unsigned char idtype = IDENTITY_TYPE_NIST_P_521,zero = 0;
|
||||
SHA256_Init(&sha);
|
||||
SHA256_Update(&sha,_address.data(),ZT_ADDRESS_LENGTH);
|
||||
SHA256_Update(&sha,atmp,ZT_ADDRESS_LENGTH);
|
||||
SHA256_Update(&sha,&zero,1);
|
||||
SHA256_Update(&sha,&idtype,1);
|
||||
SHA256_Update(&sha,&zero,1);
|
||||
@ -73,11 +75,13 @@ void Identity::generate()
|
||||
|
||||
bool Identity::locallyValidate(bool doAddressDerivationCheck) const
|
||||
{
|
||||
unsigned char atmp[ZT_ADDRESS_LENGTH];
|
||||
_address.copyTo(atmp);
|
||||
SHA256_CTX sha;
|
||||
unsigned char dig[32];
|
||||
unsigned char idtype = IDENTITY_TYPE_NIST_P_521,zero = 0;
|
||||
SHA256_Init(&sha);
|
||||
SHA256_Update(&sha,_address.data(),ZT_ADDRESS_LENGTH);
|
||||
SHA256_Update(&sha,atmp,ZT_ADDRESS_LENGTH);
|
||||
SHA256_Update(&sha,&zero,1);
|
||||
SHA256_Update(&sha,&idtype,1);
|
||||
SHA256_Update(&sha,&zero,1);
|
||||
|
Reference in New Issue
Block a user