mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 20:43:44 +02:00
cleanup
This commit is contained in:
parent
b9ef09dd58
commit
e1dd413266
1 changed files with 3 additions and 9 deletions
12
node/AES.cpp
12
node/AES.cpp
|
@ -24,8 +24,6 @@
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
#ifdef ZT_NO_TYPE_PUNNING
|
#ifdef ZT_NO_TYPE_PUNNING
|
||||||
static ZT_ALWAYS_INLINE uint32_t readuint32_t(const void *in)
|
static ZT_ALWAYS_INLINE uint32_t readuint32_t(const void *in)
|
||||||
{
|
{
|
||||||
|
@ -50,8 +48,6 @@ static ZT_ALWAYS_INLINE void writeuint32_t(void *out,const uint32_t v)
|
||||||
#define writeuint32_t(o,v) (*((uint32_t *)(o)) = Utils::hton(v))
|
#define writeuint32_t(o,v) (*((uint32_t *)(o)) = Utils::hton(v))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // anonymous namespace
|
|
||||||
|
|
||||||
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64))
|
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64))
|
||||||
static bool _zt_aesni_supported()
|
static bool _zt_aesni_supported()
|
||||||
{
|
{
|
||||||
|
@ -69,7 +65,7 @@ static bool _zt_aesni_supported()
|
||||||
return ((ecx & (1 << 25)) != 0);
|
return ((ecx & (1 << 25)) != 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
const bool AES::HW_ACCEL = false; //_zt_aesni_supported();
|
const bool AES::HW_ACCEL = _zt_aesni_supported();
|
||||||
#else
|
#else
|
||||||
const bool AES::HW_ACCEL = false;
|
const bool AES::HW_ACCEL = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -351,8 +347,7 @@ void AES::_gmacSW(const uint8_t iv[12],const uint8_t *in,unsigned int len,uint8_
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
uint64_t last[2] = { 0,0 };
|
uint64_t last[2] = { 0,0 };
|
||||||
for(unsigned int i=0;i<len;++i)
|
for(unsigned int i=0;i<len;++i) ((uint8_t *)last)[i] = in[i];
|
||||||
((uint8_t *)last)[i] = in[i];
|
|
||||||
y0 ^= last[0];
|
y0 ^= last[0];
|
||||||
y1 ^= last[1];
|
y1 ^= last[1];
|
||||||
s_gfmul(h0,h1,y0,y1);
|
s_gfmul(h0,h1,y0,y1);
|
||||||
|
@ -362,8 +357,7 @@ void AES::_gmacSW(const uint8_t iv[12],const uint8_t *in,unsigned int len,uint8_
|
||||||
s_gfmul(h0,h1,y0,y1);
|
s_gfmul(h0,h1,y0,y1);
|
||||||
|
|
||||||
uint64_t iv2[2];
|
uint64_t iv2[2];
|
||||||
for(unsigned int i=0;i<12;++i)
|
for(unsigned int i=0;i<12;++i) ((uint8_t *)iv2)[i] = iv[i];
|
||||||
((uint8_t *)iv2)[i] = iv[i];
|
|
||||||
((uint8_t *)iv2)[12] = 0;
|
((uint8_t *)iv2)[12] = 0;
|
||||||
((uint8_t *)iv2)[13] = 0;
|
((uint8_t *)iv2)[13] = 0;
|
||||||
((uint8_t *)iv2)[14] = 0;
|
((uint8_t *)iv2)[14] = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue