mirror of
https://github.com/AxioDL/nod.git
synced 2025-12-08 21:17:51 +00:00
MSVC AES-NI support
This commit is contained in:
10
lib/aes.cpp
10
lib/aes.cpp
@@ -478,7 +478,7 @@ void SoftwareAES::encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outb
|
||||
}
|
||||
}
|
||||
|
||||
#if __AES__
|
||||
#if __AES__ || _MSC_VER >= 1800
|
||||
|
||||
#include <wmmintrin.h>
|
||||
|
||||
@@ -598,12 +598,18 @@ public:
|
||||
static int HAS_AES_NI = -1;
|
||||
std::unique_ptr<IAES> NewAES()
|
||||
{
|
||||
#if __AES__
|
||||
#if __AES__ || _MSC_VER >= 1800
|
||||
if (HAS_AES_NI == -1)
|
||||
{
|
||||
#if _MSC_VER
|
||||
int info[4];
|
||||
__cpuid(info, 1);
|
||||
HAS_AES_NI = ((info[2] & 0x2000000) != 0);
|
||||
#else
|
||||
unsigned int a,b,c,d;
|
||||
__cpuid(1, a,b,c,d);
|
||||
HAS_AES_NI = ((c & 0x2000000) != 0);
|
||||
#endif
|
||||
}
|
||||
if (HAS_AES_NI)
|
||||
return std::unique_ptr<IAES>(new NiAES);
|
||||
|
||||
Reference in New Issue
Block a user