mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Linux build fixes
This commit is contained in:
parent
0c58901469
commit
782b75a64e
8 changed files with 12 additions and 9 deletions
|
@ -45,6 +45,8 @@
|
||||||
|
|
||||||
using namespace ZeroTier;
|
using namespace ZeroTier;
|
||||||
|
|
||||||
|
static volatile uint8_t foo = 0;
|
||||||
|
|
||||||
#define KNOWN_GOOD_IDENTITY_0 "8e4df28b72:0:ac3d46abe0c21f3cfe7a6c8d6a85cfcffcb82fbd55af6a4d6350657c68200843fa2e16f9418bbd9702cae365f2af5fb4c420908b803a681d4daef6114d78a2d7:bd8dd6e4ce7022d2f812797a80c6ee8ad180dc4ebf301dec8b06d1be08832bddd63a2f1cfa7b2c504474c75bdc8898ba476ef92e8e2d0509f8441985171ff16e"
|
#define KNOWN_GOOD_IDENTITY_0 "8e4df28b72:0:ac3d46abe0c21f3cfe7a6c8d6a85cfcffcb82fbd55af6a4d6350657c68200843fa2e16f9418bbd9702cae365f2af5fb4c420908b803a681d4daef6114d78a2d7:bd8dd6e4ce7022d2f812797a80c6ee8ad180dc4ebf301dec8b06d1be08832bddd63a2f1cfa7b2c504474c75bdc8898ba476ef92e8e2d0509f8441985171ff16e"
|
||||||
#define KNOWN_BAD_IDENTITY_0 "9e4df28b72:0:ac3d46abe0c21f3cfe7a6c8d6a85cfcffcb82fbd55af6a4d6350657c68200843fa2e16f9418bbd9702cae365f2af5fb4c420908b803a681d4daef6114d78a2d7:bd8dd6e4ce7022d2f812797a80c6ee8ad180dc4ebf301dec8b06d1be08832bddd63a2f1cfa7b2c504474c75bdc8898ba476ef92e8e2d0509f8441985171ff16e"
|
#define KNOWN_BAD_IDENTITY_0 "9e4df28b72:0:ac3d46abe0c21f3cfe7a6c8d6a85cfcffcb82fbd55af6a4d6350657c68200843fa2e16f9418bbd9702cae365f2af5fb4c420908b803a681d4daef6114d78a2d7:bd8dd6e4ce7022d2f812797a80c6ee8ad180dc4ebf301dec8b06d1be08832bddd63a2f1cfa7b2c504474c75bdc8898ba476ef92e8e2d0509f8441985171ff16e"
|
||||||
|
|
||||||
|
@ -147,7 +149,6 @@ extern "C" int ZT_TestCrypto()
|
||||||
{
|
{
|
||||||
static uint8_t buf1[16384],buf2[16384],buf3[16384];
|
static uint8_t buf1[16384],buf2[16384],buf3[16384];
|
||||||
static char hexbuf[1024];
|
static char hexbuf[1024];
|
||||||
volatile unsigned char *dummy = (volatile unsigned char *)&(buf1[100]);
|
|
||||||
|
|
||||||
for(int i=0;i<3;++i) {
|
for(int i=0;i<3;++i) {
|
||||||
Utils::getSecureRandom(buf1,64);
|
Utils::getSecureRandom(buf1,64);
|
||||||
|
@ -385,7 +386,6 @@ extern "C" int ZT_TestCrypto()
|
||||||
std::cout << "[crypto] Benchmarking asymmetric crypto..." ZT_EOL_S;
|
std::cout << "[crypto] Benchmarking asymmetric crypto..." ZT_EOL_S;
|
||||||
{
|
{
|
||||||
uint8_t pub[128],priv[128],hash[128],sig[128];
|
uint8_t pub[128],priv[128],hash[128],sig[128];
|
||||||
volatile uint8_t foo = 0;
|
|
||||||
Utils::getSecureRandom(hash,sizeof(hash));
|
Utils::getSecureRandom(hash,sizeof(hash));
|
||||||
|
|
||||||
C25519::generate(pub,priv);
|
C25519::generate(pub,priv);
|
||||||
|
|
|
@ -380,7 +380,7 @@ void AES::_gmacSW(const uint8_t iv[12],const uint8_t *in,unsigned int len,uint8_
|
||||||
|
|
||||||
#ifdef ZT_AES_AESNI
|
#ifdef ZT_AES_AESNI
|
||||||
|
|
||||||
static ZT_ALWAYS_INLINE inline __m128i _mult_block_aesni(__m128i shuf,__m128i h,__m128i y)
|
static ZT_ALWAYS_INLINE __m128i _mult_block_aesni(__m128i shuf,__m128i h,__m128i y)
|
||||||
{
|
{
|
||||||
y = _mm_shuffle_epi8(y,shuf);
|
y = _mm_shuffle_epi8(y,shuf);
|
||||||
__m128i t1 = _mm_clmulepi64_si128(h,y,0x00);
|
__m128i t1 = _mm_clmulepi64_si128(h,y,0x00);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "Constants.hpp"
|
#include "Constants.hpp"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,7 @@ public:
|
||||||
_hasPrivate = true;
|
_hasPrivate = true;
|
||||||
memcpy(&_priv,data + ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1,ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE);
|
memcpy(&_priv,data + ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1,ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE);
|
||||||
privlen = data[ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1 + ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE];
|
privlen = data[ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1 + ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE];
|
||||||
if (len < (privlen + (ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1 + ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE + 1)))
|
if (len < (int)(privlen + (ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1 + ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE + 1)))
|
||||||
return -1;
|
return -1;
|
||||||
return (int)(privlen + (unsigned int)(ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1 + ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE + 1));
|
return (int)(privlen + (unsigned int)(ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1 + ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE + 1));
|
||||||
} else if (privlen == 0) {
|
} else if (privlen == 0) {
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
|
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
|
||||||
#define ZT_ALWAYS_INLINE __attribute__((always_inline))
|
#define ZT_ALWAYS_INLINE __attribute__((always_inline)) inline
|
||||||
#ifndef restrict
|
#ifndef restrict
|
||||||
#define restrict __restrict__
|
#define restrict __restrict__
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -415,7 +415,7 @@ void LinuxEthernetTap::scanMulticastGroups(std::vector<MulticastGroup> &added,st
|
||||||
mcastmac = f;
|
mcastmac = f;
|
||||||
++fno;
|
++fno;
|
||||||
}
|
}
|
||||||
if ((devname)&&(!strcmp(devname,_dev.c_str()))&&(mcastmac)&&(Utils::unhex(mcastmac,mac,6) == 6))
|
if ((devname)&&(!strcmp(devname,_dev.c_str()))&&(mcastmac)&&(Utils::unhex(mcastmac,strlen(mcastmac),mac,6) == 6))
|
||||||
newGroups.push_back(MulticastGroup(MAC(mac,6),0));
|
newGroups.push_back(MulticastGroup(MAC(mac,6),0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
#include "NeighborDiscovery.hpp"
|
#include "NeighborDiscovery.hpp"
|
||||||
#include "OSUtils.hpp"
|
#include "OSUtils.hpp"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
|
@ -175,8 +176,8 @@ void NeighborDiscovery::remove(const sockaddr_storage &address)
|
||||||
|
|
||||||
sockaddr_storage NeighborDiscovery::processIncomingND(const uint8_t *nd, unsigned int len, const sockaddr_storage &localIp, uint8_t *response, unsigned int &responseLen, MAC &responseDest)
|
sockaddr_storage NeighborDiscovery::processIncomingND(const uint8_t *nd, unsigned int len, const sockaddr_storage &localIp, uint8_t *response, unsigned int &responseLen, MAC &responseDest)
|
||||||
{
|
{
|
||||||
assert(sizeof(_neighbor_solicitation) == 28);
|
// assert(sizeof(_neighbor_solicitation) == 28);
|
||||||
assert(sizeof(_neighbor_advertisement) == 32);
|
// assert(sizeof(_neighbor_advertisement) == 32);
|
||||||
|
|
||||||
const uint64_t now = OSUtils::now();
|
const uint64_t now = OSUtils::now();
|
||||||
sockaddr_storage ip = {0};
|
sockaddr_storage ip = {0};
|
||||||
|
|
|
@ -92,6 +92,7 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
Loading…
Add table
Reference in a new issue