Various cleanup...

This commit is contained in:
Adam Ierymenko 2021-01-12 15:23:35 -05:00
parent d6969c41f0
commit 053452b4a0
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
2 changed files with 177 additions and 337 deletions

File diff suppressed because it is too large Load diff

View file

@ -27,6 +27,8 @@ namespace ZeroTier {
namespace {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// This is the memory-intensive hash function used to compute v0 identities from v0 public keys.
#define ZT_V0_IDENTITY_GEN_MEMORY 2097152
@ -80,12 +82,15 @@ struct identityV0ProofOfWorkCriteria
char *genmem;
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define ZT_IDENTITY_V1_POW_MEMORY_SIZE 131072
struct p_CompareLittleEndian
{
#if __BYTE_ORDER == __BIG_ENDIAN
ZT_INLINE bool operator()(const uint64_t a,const uint64_t b) const noexcept { return Utils::swapBytes(a) < Utils::swapBytes(b); }
ZT_INLINE bool operator()(const uint64_t a,const uint64_t b) const noexcept
{ return Utils::swapBytes(a) < Utils::swapBytes(b); }
#else
ZT_INLINE bool operator()(const uint64_t a, const uint64_t b) const noexcept
{ return a < b; }
@ -136,6 +141,8 @@ bool identityV1ProofOfWorkCriteria(const void *in, const unsigned int len, uint6
return (Utils::ntoh(w[0]) % 1000U) == 0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} // anonymous namespace
const Identity Identity::NIL;