This commit is contained in:
Adam Ierymenko 2019-08-12 15:37:55 -07:00
commit af137fd5d3
No known key found for this signature in database
GPG Key ID: 1657198823E52A61
2 changed files with 20 additions and 3 deletions

View File

@ -2,6 +2,11 @@
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
set(ZEROTIER_ONE_VERSION_MAJOR 1)

View File

@ -26,15 +26,26 @@
#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 {
#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()
{
#ifdef WIN32
int regs[4];
__cpuid(regs, 1);
return (regs[2] >> 25) & 1;
#else
uint32_t eax,ebx,ecx,edx;
__asm__ __volatile__ (
"cpuid"
@ -42,6 +53,7 @@ static inline bool _zt_aesni_supported()
: "a"(1), "c"(0)
);
return ((ecx & (1 << 25)) != 0);
#endif
}
const bool AES::HW_ACCEL = _zt_aesni_supported();