Separate Aarch32 and Aarch64 guards

Also see https://sourceware.org/ml/libc-help/2017-08/msg00012.html
pull/461/head
Jeffrey Walton 2017-08-07 10:37:02 -04:00
parent 9161443f6d
commit a04dda56fa
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
4 changed files with 39 additions and 5 deletions

View File

@ -20,6 +20,9 @@
# ifndef HWCAP_CRC32
# define HWCAP_CRC32 (1 << 7)
# endif
# ifndef HWCAP2_CRC32
# define HWCAP2_CRC32 (1 << 4)
# endif
#endif
#if (CRYPTOPP_SSE42_AVAILABLE)
@ -78,9 +81,13 @@ bool CPU_TryCRC32_ARMV8()
}
return result;
#else
# if defined(__linux__) && (defined(__aarch32__) || defined(__aarch64__))
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
# if defined(__linux__) && defined(__aarch64__)
if (getauxval(AT_HWCAP) & HWCAP_CRC32)
return true;
# elif defined(__linux__) && defined(__aarch32__)
if (getauxval(AT_HWCAP2) & HWCAP2_CRC32)
return true;
# endif
// longjmp and clobber warnings. Volatile is required.

View File

@ -20,6 +20,9 @@
# ifndef HWCAP_PMULL
# define HWCAP_PMULL (1 << 4)
# endif
# ifndef HWCAP2_PMULL
# define HWCAP2_PMULL (1 << 1)
# endif
#endif
#if (CRYPTOPP_CLMUL_AVAILABLE)
@ -211,9 +214,13 @@ bool CPU_TryPMULL_ARMV8()
}
return result;
# else
# if defined(__linux__) && (defined(__aarch32__) || defined(__aarch64__))
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
# if defined(__linux__) && defined(__aarch64__)
if (getauxval(AT_HWCAP) & HWCAP_PMULL)
return true;
# elif defined(__linux__) && defined(__aarch32__)
if (getauxval(AT_HWCAP2) & HWCAP2_PMULL)
return true;
# endif
// longjmp and clobber warnings. Volatile is required.

View File

@ -25,6 +25,9 @@
# ifndef HWCAP_AES
# define HWCAP_AES (1 << 3)
# endif
# ifndef HWCAP2_AES
# define HWCAP2_AES (1 << 0)
# endif
#endif
#if (CRYPTOPP_SSE41_AVAILABLE)
@ -101,9 +104,13 @@ bool CPU_TryAES_ARMV8()
}
return result;
# else
# if defined(__linux__) && (defined(__aarch32__) || defined(__aarch64__))
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
# if defined(__linux__) && defined(__aarch64__)
if (getauxval(AT_HWCAP) & HWCAP_AES)
return true;
# elif defined(__linux__) && defined(__aarch32__)
if (getauxval(AT_HWCAP2) & HWCAP2_AES)
return true;
# endif
// longjmp and clobber warnings. Volatile is required.

View File

@ -23,6 +23,12 @@
# ifndef HWCAP_SHA2
# define HWCAP_SHA2 (1 << 6)
# endif
# ifndef HWCAP2_SHA1
# define HWCAP2_SHA1 (1 << 2)
# endif
# ifndef HWCAP2_SHA2
# define HWCAP2_SHA2 (1 << 3)
# endif
#endif
#if (CRYPTOPP_SSE42_AVAILABLE)
@ -85,9 +91,13 @@ bool CPU_TrySHA1_ARMV8()
}
return result;
# else
# if defined(__linux__) && (defined(__aarch32__) || defined(__aarch64__))
// https://sourceware.org/ml/libc-help/2017-08/msg00012.html
# if defined(__linux__) && defined(__aarch64__)
if (getauxval(AT_HWCAP) & HWCAP_SHA1)
return true;
# elif defined(__linux__) && defined(__aarch32__)
if (getauxval(AT_HWCAP2) & HWCAP2_SHA1)
return true;
# endif
// longjmp and clobber warnings. Volatile is required.
@ -148,7 +158,10 @@ bool CPU_TrySHA2_ARMV8()
}
return result;
#else
# if defined(__linux__) && (defined(__aarch32__) || defined(__aarch64__))
# if defined(__linux__) && defined(__aarch64__)
if (getauxval(AT_HWCAP) & HWCAP_SHA2)
return true;
# elif defined(__linux__) && defined(__aarch32__)
if (getauxval(AT_HWCAP) & HWCAP_SHA2)
return true;
# endif