mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-19 09:40:29 +00:00
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
@ -33,10 +33,12 @@
|
||||
#if defined(MBEDTLS_AESNI_HAVE_CODE)
|
||||
|
||||
#if MBEDTLS_AESNI_HAVE_CODE == 2
|
||||
#if !defined(_WIN32)
|
||||
#if defined(__GNUC__)
|
||||
#include <cpuid.h>
|
||||
#else
|
||||
#elif defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#error "`__cpuid` required by MBEDTLS_AESNI_C is not supported by the compiler"
|
||||
#endif
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
@ -53,7 +55,7 @@ int mbedtls_aesni_has_support(unsigned int what)
|
||||
if (!done) {
|
||||
#if MBEDTLS_AESNI_HAVE_CODE == 2
|
||||
static int info[4] = { 0, 0, 0, 0 };
|
||||
#if defined(_WIN32)
|
||||
#if defined(_MSC_VER)
|
||||
__cpuid(info, 1);
|
||||
#else
|
||||
__cpuid(1, info[0], info[1], info[2], info[3]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user