Warning removal.

This commit is contained in:
Adam Ierymenko 2020-07-02 15:03:12 -07:00
parent 404b7a5493
commit 727aa8e71f
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
9 changed files with 35 additions and 34 deletions

View file

@ -170,7 +170,7 @@ void s_gfmul(const uint64_t h_high,const uint64_t h_low,uint64_t &y0,uint64_t &y
// SSE shuffle parameter to reverse bytes in a 128-bit vector. // SSE shuffle parameter to reverse bytes in a 128-bit vector.
static const __m128i s_sseSwapBytes = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); static const __m128i s_sseSwapBytes = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
static ZT_INLINE __m128i p_gmacPCLMUL128(const __m128i h, __m128i y) noexcept static __m128i p_gmacPCLMUL128(const __m128i h, __m128i y) noexcept
{ {
y = _mm_shuffle_epi8(y, s_sseSwapBytes); y = _mm_shuffle_epi8(y, s_sseSwapBytes);
__m128i t1 = _mm_clmulepi64_si128(h, y, 0x00); __m128i t1 = _mm_clmulepi64_si128(h, y, 0x00);
@ -317,7 +317,7 @@ void AES::GMAC::update(const void *const data, unsigned int len) noexcept
t3 = _mm_xor_si128(t3, _mm_slli_si128(t7, 12)); t3 = _mm_xor_si128(t3, _mm_slli_si128(t7, 12));
t6 = _mm_xor_si128(t6, _mm_xor_si128(t3, _mm_xor_si128(_mm_xor_si128(_mm_srli_epi32(t3, 1), t8), _mm_xor_si128(_mm_srli_epi32(t3, 2), _mm_srli_epi32(t3, 7))))); t6 = _mm_xor_si128(t6, _mm_xor_si128(t3, _mm_xor_si128(_mm_xor_si128(_mm_srli_epi32(t3, 1), t8), _mm_xor_si128(_mm_srli_epi32(t3, 2), _mm_srli_epi32(t3, 7)))));
y = _mm_shuffle_epi8(t6, s_sseSwapBytes); y = _mm_shuffle_epi8(t6, s_sseSwapBytes);
} while (len >= 64); } while (likely(len >= 64));
} }
while (len >= 16) { while (len >= 16) {
@ -565,7 +565,7 @@ void p_aesCtrInnerVAES512(unsigned int &len, const uint64_t c0, uint64_t &c1, co
d0 = _mm512_aesenclast_epi128(d0, kk14); d0 = _mm512_aesenclast_epi128(d0, kk14);
_mm512_storeu_si512(reinterpret_cast<__m512i *>(out), _mm512_xor_si512(p0, d0)); _mm512_storeu_si512(reinterpret_cast<__m512i *>(out), _mm512_xor_si512(p0, d0));
out += 64; out += 64;
} while (len >= 64); } while (likely(len >= 64));
} }
#define ZT_AES_VAES256 #define ZT_AES_VAES256
@ -634,12 +634,12 @@ void p_aesCtrInnerVAES256(unsigned int &len, uint64_t &c0, uint64_t &c1, const u
_mm256_storeu_si256(reinterpret_cast<__m256i *>(out), _mm256_xor_si256(d0, p0)); _mm256_storeu_si256(reinterpret_cast<__m256i *>(out), _mm256_xor_si256(d0, p0));
_mm256_storeu_si256(reinterpret_cast<__m256i *>(out + 32), _mm256_xor_si256(d1, p1)); _mm256_storeu_si256(reinterpret_cast<__m256i *>(out + 32), _mm256_xor_si256(d1, p1));
out += 64; out += 64;
} while (len >= 64); } while (likely(len >= 64));
} }
#endif #endif
static void p_aesCtrInner128(unsigned int &len, uint64_t &c0, uint64_t &c1, const uint8_t *&in, uint8_t *&out, const __m128i *const k) noexcept static ZT_INLINE void p_aesCtrInner128(unsigned int &len, uint64_t &c0, uint64_t &c1, const uint8_t *&in, uint8_t *&out, const __m128i *const k) noexcept
{ {
const __m128i k0 = k[0]; const __m128i k0 = k[0];
const __m128i k1 = k[1]; const __m128i k1 = k[1];
@ -739,7 +739,7 @@ static void p_aesCtrInner128(unsigned int &len, uint64_t &c0, uint64_t &c1, cons
_mm_prefetch(in, _MM_HINT_T0); _mm_prefetch(in, _MM_HINT_T0);
out += 64; out += 64;
len -= 64; len -= 64;
} while (len >= 64); } while (likely(len >= 64));
} }
#endif #endif

View file

@ -32,7 +32,7 @@ struct SHA384Hash
uint64_t data[6]; uint64_t data[6];
ZT_INLINE SHA384Hash() noexcept ZT_INLINE SHA384Hash() noexcept
{ Utils::zero< 48 >(data); } { Utils::zero<sizeof(data)>(data); }
explicit ZT_INLINE SHA384Hash(const void *const d) noexcept explicit ZT_INLINE SHA384Hash(const void *const d) noexcept
{ Utils::copy< 48 >(data, d); } { Utils::copy< 48 >(data, d); }
@ -73,7 +73,7 @@ struct UniqueID
uint64_t data[2]; uint64_t data[2];
ZT_INLINE UniqueID() noexcept ZT_INLINE UniqueID() noexcept
{} { Utils::zero<sizeof(data)>(data); }
ZT_INLINE UniqueID(const uint64_t a, const uint64_t b) noexcept ZT_INLINE UniqueID(const uint64_t a, const uint64_t b) noexcept
{ {
@ -93,22 +93,22 @@ struct UniqueID
ZT_INLINE operator bool() const noexcept ZT_INLINE operator bool() const noexcept
{ return ((data[0] != 0) && (data[1] != 0)); } { return ((data[0] != 0) && (data[1] != 0)); }
ZT_INLINE bool operator==(const SHA384Hash &b) const noexcept ZT_INLINE bool operator==(const UniqueID &b) const noexcept
{ return ((data[0] == b.data[0]) && (data[1] == b.data[1])); } { return ((data[0] == b.data[0]) && (data[1] == b.data[1])); }
ZT_INLINE bool operator!=(const SHA384Hash &b) const noexcept ZT_INLINE bool operator!=(const UniqueID &b) const noexcept
{ return !(*this == b); } { return !(*this == b); }
ZT_INLINE bool operator<(const SHA384Hash &b) const noexcept ZT_INLINE bool operator<(const UniqueID &b) const noexcept
{ return (memcmp(data, b.data, 16) < 0); } { return (memcmp(data, b.data, 16) < 0); }
ZT_INLINE bool operator>(const SHA384Hash &b) const noexcept ZT_INLINE bool operator>(const UniqueID &b) const noexcept
{ return (memcmp(data, b.data, 16) > 0); } { return (memcmp(data, b.data, 16) > 0); }
ZT_INLINE bool operator<=(const SHA384Hash &b) const noexcept ZT_INLINE bool operator<=(const UniqueID &b) const noexcept
{ return (memcmp(data, b.data, 16) <= 0); } { return (memcmp(data, b.data, 16) <= 0); }
ZT_INLINE bool operator>=(const SHA384Hash &b) const noexcept ZT_INLINE bool operator>=(const UniqueID &b) const noexcept
{ return (memcmp(data, b.data, 16) >= 0); } { return (memcmp(data, b.data, 16) >= 0); }
}; };

View file

@ -20,6 +20,7 @@ Derived from public domain code by D. J. Bernstein.
#ifdef __GNUC__ #ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif #endif
using namespace ZeroTier; using namespace ZeroTier;

View file

@ -19,7 +19,7 @@ namespace ZeroTier {
bool Path::send(const RuntimeEnvironment *const RR, void *const tPtr, const void *const data, const unsigned int len, const int64_t now) noexcept bool Path::send(const RuntimeEnvironment *const RR, void *const tPtr, const void *const data, const unsigned int len, const int64_t now) noexcept
{ {
if (RR->node->putPacket(tPtr, m_localSocket, m_addr, data, len)) { if (likely(RR->node->putPacket(tPtr, m_localSocket, m_addr, data, len))) {
m_lastOut = now; m_lastOut = now;
m_outMeter.log(now, len); m_outMeter.log(now, len);
return true; return true;

View file

@ -48,8 +48,7 @@ public:
m_lastOut(0), m_lastOut(0),
m_latency(-1), m_latency(-1),
m_addr(r) m_addr(r)
{ {}
}
/** /**
* Send a packet via this path (last out time is also updated) * Send a packet via this path (last out time is also updated)
@ -95,7 +94,7 @@ public:
ZT_INLINE void updateLatency(const unsigned int newMeasurement) noexcept ZT_INLINE void updateLatency(const unsigned int newMeasurement) noexcept
{ {
int lat = m_latency; int lat = m_latency;
if (lat > 0) { if (likely(lat > 0)) {
m_latency = (lat + newMeasurement) / 2; m_latency = (lat + newMeasurement) / 2;
} else { } else {
m_latency = newMeasurement; m_latency = newMeasurement;

View file

@ -29,7 +29,7 @@ Peer::Peer(const RuntimeEnvironment *renv) :
m_ephemeralPairTimestamp(0), m_ephemeralPairTimestamp(0),
m_lastReceive(0), m_lastReceive(0),
m_lastSend(0), m_lastSend(0),
m_lastSentHello(), m_lastSentHello(0),
m_lastWhoisRequestReceived(0), m_lastWhoisRequestReceived(0),
m_lastEchoRequestReceived(0), m_lastEchoRequestReceived(0),
m_lastPrioritizedPaths(0), m_lastPrioritizedPaths(0),
@ -40,13 +40,10 @@ Peer::Peer(const RuntimeEnvironment *renv) :
m_vMajor(0), m_vMajor(0),
m_vMinor(0), m_vMinor(0),
m_vRevision(0) m_vRevision(0)
{ {}
}
Peer::~Peer() Peer::~Peer()
{ { Utils::burn(m_helloMacKey, sizeof(m_helloMacKey)); }
Utils::burn(m_helloMacKey, sizeof(m_helloMacKey));
}
bool Peer::init(const Identity &peerIdentity) bool Peer::init(const Identity &peerIdentity)
{ {

View file

@ -25,11 +25,16 @@ namespace ZeroTier {
class Poly1305 class Poly1305
{ {
public: public:
ZT_INLINE Poly1305() {} ZT_INLINE Poly1305()
ZT_INLINE Poly1305(const void *key) { this->init(key); } {}
ZT_INLINE Poly1305(const void *key)
{ this->init(key); }
void init(const void *key) noexcept; void init(const void *key) noexcept;
void update(const void *data, unsigned int len) noexcept; void update(const void *data, unsigned int len) noexcept;
void finish(void *auth) noexcept; void finish(void *auth) noexcept;
static ZT_INLINE void compute(void *const auth, const void *const data, const unsigned int len, const void *const key) noexcept static ZT_INLINE void compute(void *const auth, const void *const data, const unsigned int len, const void *const key) noexcept
@ -40,7 +45,8 @@ public:
} }
private: private:
struct { struct
{
size_t aligner; size_t aligner;
unsigned char opaque[136]; unsigned char opaque[136];
} ctx; } ctx;

View file

@ -39,7 +39,6 @@ static ZT_INLINE void U32TO8_LITTLE(uint8_t *const c,const uint32_t v) { c[0] =
#endif // !ZT_SALSA20_SSE #endif // !ZT_SALSA20_SSE
#ifdef ZT_SALSA20_SSE #ifdef ZT_SALSA20_SSE
class _s20sseconsts class _s20sseconsts
{ {
public: public:
@ -48,10 +47,8 @@ public:
maskLo32 = _mm_shuffle_epi32(_mm_cvtsi32_si128(-1), _MM_SHUFFLE(1, 0, 1, 0)); maskLo32 = _mm_shuffle_epi32(_mm_cvtsi32_si128(-1), _MM_SHUFFLE(1, 0, 1, 0));
maskHi32 = _mm_slli_epi64(maskLo32, 32); maskHi32 = _mm_slli_epi64(maskLo32, 32);
} }
__m128i maskLo32, maskHi32; __m128i maskLo32, maskHi32;
}; };
static const _s20sseconsts s_S20SSECONSTANTS; static const _s20sseconsts s_S20SSECONSTANTS;
#endif #endif

View file

@ -131,6 +131,7 @@ struct p_RootRankingComparisonOperator
return true; return true;
return bb < a->latency(); return bb < a->latency();
} }
return false;
} }
}; };