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.
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);
__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));
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);
} while (len >= 64);
} while (likely(len >= 64));
}
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);
_mm512_storeu_si512(reinterpret_cast<__m512i *>(out), _mm512_xor_si512(p0, d0));
out += 64;
} while (len >= 64);
} while (likely(len >= 64));
}
#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 + 32), _mm256_xor_si256(d1, p1));
out += 64;
} while (len >= 64);
} while (likely(len >= 64));
}
#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 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);
out += 64;
len -= 64;
} while (len >= 64);
} while (likely(len >= 64));
}
#endif

View file

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

View file

@ -20,6 +20,7 @@ Derived from public domain code by D. J. Bernstein.
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif
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
{
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_outMeter.log(now, len);
return true;

View file

@ -48,8 +48,7 @@ public:
m_lastOut(0),
m_latency(-1),
m_addr(r)
{
}
{}
/**
* 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
{
int lat = m_latency;
if (lat > 0) {
if (likely(lat > 0)) {
m_latency = (lat + newMeasurement) / 2;
} else {
m_latency = newMeasurement;

View file

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

View file

@ -25,24 +25,30 @@ namespace ZeroTier {
class Poly1305
{
public:
ZT_INLINE Poly1305() {}
ZT_INLINE Poly1305(const void *key) { this->init(key); }
ZT_INLINE Poly1305()
{}
ZT_INLINE Poly1305(const void *key)
{ this->init(key); }
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;
static ZT_INLINE void compute(void *const auth, const void *const data, const unsigned int len, const void *const key) noexcept
{
Poly1305 p(key);
p.update(data,len);
p.update(data, len);
p.finish(auth);
}
private:
struct {
size_t aligner;
unsigned char opaque[136];
struct
{
size_t aligner;
unsigned char opaque[136];
} 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
#ifdef ZT_SALSA20_SSE
class _s20sseconsts
{
public:
@ -48,10 +47,8 @@ public:
maskLo32 = _mm_shuffle_epi32(_mm_cvtsi32_si128(-1), _MM_SHUFFLE(1, 0, 1, 0));
maskHi32 = _mm_slli_epi64(maskLo32, 32);
}
__m128i maskLo32, maskHi32;
};
static const _s20sseconsts s_S20SSECONSTANTS;
#endif

View file

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