summaryrefslogtreecommitdiff
path: root/node/Identity.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-07-25 13:24:39 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-07-25 13:24:39 -0400
commit9cf734b74a750b8af0c628809c16be57eef1ff21 (patch)
tree30170edf778919d7097fd007e1a0ff73cdfa9c32 /node/Identity.cpp
parent083ae2d0974394862735bf1ceff6a71f5e4dac64 (diff)
downloadinfinitytier-9cf734b74a750b8af0c628809c16be57eef1ff21.tar.gz
infinitytier-9cf734b74a750b8af0c628809c16be57eef1ff21.zip
Sane-ify Address, get rid of goofy union thingy.
Diffstat (limited to 'node/Identity.cpp')
-rw-r--r--node/Identity.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/node/Identity.cpp b/node/Identity.cpp
index f16947a0..a7ef403d 100644
--- a/node/Identity.cpp
+++ b/node/Identity.cpp
@@ -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);