Revert "Use a faster method of fingerprinting identities."

This reverts commit b72e5e8386.
This commit is contained in:
Adam Ierymenko 2021-09-20 22:05:39 -04:00 committed by Grant Limberg
parent 30d5d5a892
commit b403f106fb
No known key found for this signature in database
GPG key ID: 2BA62CCABBB4095A
2 changed files with 15 additions and 17 deletions

View file

@ -23,7 +23,6 @@
#include "C25519.hpp"
#include "Buffer.hpp"
#include "SHA512.hpp"
#include "AES.hpp"
#define ZT_IDENTITY_STRING_BUFFER_LENGTH 384
@ -110,6 +109,18 @@ public:
*/
inline bool hasPrivate() const { return (_privateKey != (C25519::Private *)0); }
/**
* Compute a SHA384 hash of this identity's address and public key(s).
*
* @param sha384buf Buffer with 48 bytes of space to receive hash
*/
inline void publicKeyHash(void *sha384buf) const
{
uint8_t address[ZT_ADDRESS_LENGTH];
_address.copyTo(address, ZT_ADDRESS_LENGTH);
SHA384(sha384buf, address, ZT_ADDRESS_LENGTH, _publicKey.data, ZT_C25519_PUBLIC_KEY_LEN);
}
/**
* Compute the SHA512 hash of our private key (if we have one)
*
@ -125,19 +136,6 @@ public:
return false;
}
/**
* Get a 256-bit hash of this identity's public key(s)
*
* @param buf 256-bit (32-byte) buffer
*/
inline void keyFingerprint(void *buf) const
{
// This is much faster than SHA384, which matters on heavily loaded controllers.
AES c(_publicKey.data);
c.encrypt(_publicKey.data + 32, buf);
c.encrypt(_publicKey.data + 48, reinterpret_cast<uint8_t *>(buf) + 16);
}
/**
* Sign a message with this identity (private key required)
*