mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-12 07:52:49 +00:00
Merge branch 'edge' of http://git.int.zerotier.com/zerotier/ZeroTierOne into edge
This commit is contained in:
commit
af137fd5d3
@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
cmake_minimum_required (VERSION 3.8)
|
cmake_minimum_required (VERSION 3.8)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# If building on Windows, set minimum target to Windows 7
|
||||||
|
set(CMAKE_SYSTEM_VERSION "7" CACHE STRING INTERNAL FORCE)
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
# ZeroTier One Version Config
|
# ZeroTier One Version Config
|
||||||
|
|
||||||
set(ZEROTIER_ONE_VERSION_MAJOR 1)
|
set(ZEROTIER_ONE_VERSION_MAJOR 1)
|
||||||
|
18
node/AES.cpp
18
node/AES.cpp
@ -26,15 +26,26 @@
|
|||||||
|
|
||||||
#include "AES.hpp"
|
#include "AES.hpp"
|
||||||
|
|
||||||
|
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64))
|
||||||
|
#include <wmmintrin.h>
|
||||||
|
#include <emmintrin.h>
|
||||||
|
#include <smmintrin.h>
|
||||||
|
#endif
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <intrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
#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))
|
||||||
|
|
||||||
#include <wmmintrin.h>
|
|
||||||
#include <emmintrin.h>
|
|
||||||
#include <smmintrin.h>
|
|
||||||
static inline bool _zt_aesni_supported()
|
static inline bool _zt_aesni_supported()
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
int regs[4];
|
||||||
|
__cpuid(regs, 1);
|
||||||
|
return (regs[2] >> 25) & 1;
|
||||||
|
#else
|
||||||
uint32_t eax,ebx,ecx,edx;
|
uint32_t eax,ebx,ecx,edx;
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"cpuid"
|
"cpuid"
|
||||||
@ -42,6 +53,7 @@ static inline bool _zt_aesni_supported()
|
|||||||
: "a"(1), "c"(0)
|
: "a"(1), "c"(0)
|
||||||
);
|
);
|
||||||
return ((ecx & (1 << 25)) != 0);
|
return ((ecx & (1 << 25)) != 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
const bool AES::HW_ACCEL = _zt_aesni_supported();
|
const bool AES::HW_ACCEL = _zt_aesni_supported();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user