aesni: select __cpuid
impl based on compiler type
MinGW provides both kinds of implementations of `__cpuid`, but since `cpuid.h` is provided by GNUC, so we should choose the implementation by the compiler type instead of OS type. Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
parent
e8c4bf180b
commit
0ecb635ca5
1 changed files with 5 additions and 3 deletions
|
@ -33,10 +33,12 @@
|
||||||
#if defined(MBEDTLS_AESNI_HAVE_CODE)
|
#if defined(MBEDTLS_AESNI_HAVE_CODE)
|
||||||
|
|
||||||
#if MBEDTLS_AESNI_HAVE_CODE == 2
|
#if MBEDTLS_AESNI_HAVE_CODE == 2
|
||||||
#if !defined(_WIN32)
|
#if defined(__GNUC__)
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
#else
|
#elif defined(_MSC_VER)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
|
#else
|
||||||
|
#error "`__cpuid` required by MBEDTLS_AESNI_C is not supported by the compiler"
|
||||||
#endif
|
#endif
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +55,7 @@ int mbedtls_aesni_has_support(unsigned int what)
|
||||||
if (!done) {
|
if (!done) {
|
||||||
#if MBEDTLS_AESNI_HAVE_CODE == 2
|
#if MBEDTLS_AESNI_HAVE_CODE == 2
|
||||||
static int info[4] = { 0, 0, 0, 0 };
|
static int info[4] = { 0, 0, 0, 0 };
|
||||||
#if defined(_WIN32)
|
#if defined(_MSC_VER)
|
||||||
__cpuid(info, 1);
|
__cpuid(info, 1);
|
||||||
#else
|
#else
|
||||||
__cpuid(1, info[0], info[1], info[2], info[3]);
|
__cpuid(1, info[0], info[1], info[2], info[3]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue