Add CRYPTO_needs_hwcap2_workaround.

Bug: 203
Change-Id: I50384cce14509ab1ca36e6f0e9f192f9e458b313
Reviewed-on: https://boringssl-review.googlesource.com/20404
Commit-Queue: Steven Valdez <svaldez@google.com>
Reviewed-by: Steven Valdez <svaldez@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
David Benjamin 2017-09-15 20:30:07 -04:00 committed by CQ bot account: commit-bot@chromium.org
parent 82dfea8d9e
commit 9a127b43b8
2 changed files with 8 additions and 1 deletions

View File

@ -288,7 +288,7 @@ static int has_broken_neon(const STRING_PIECE *cpuinfo) {
extern uint32_t OPENSSL_armcap_P;
static int g_has_broken_neon;
static int g_has_broken_neon, g_needs_hwcap2_workaround;
void OPENSSL_cpuid_setup(void) {
char *cpuinfo_data;
@ -336,6 +336,7 @@ void OPENSSL_cpuid_setup(void) {
}
if (hwcap2 == 0) {
hwcap2 = get_hwcap2_cpuinfo(&cpuinfo);
g_needs_hwcap2_workaround = hwcap2 != 0;
}
if (hwcap2 & HWCAP2_AES) {
@ -357,4 +358,6 @@ void OPENSSL_cpuid_setup(void) {
int CRYPTO_has_broken_NEON(void) { return g_has_broken_neon; }
int CRYPTO_needs_hwcap2_workaround(void) { return g_needs_hwcap2_workaround; }
#endif // OPENSSL_ARM && !OPENSSL_STATIC_ARMCAP

View File

@ -135,6 +135,10 @@ static inline int CRYPTO_is_NEON_capable(void) {
// CRYPTO_has_broken_NEON returns one if the current CPU is known to have a
// broken NEON unit. See https://crbug.com/341598.
OPENSSL_EXPORT int CRYPTO_has_broken_NEON(void);
// CRYPTO_needs_hwcap2_workaround returns one if the ARMv8 AArch32 AT_HWCAP2
// workaround was needed. See https://crbug.com/boringssl/46.
OPENSSL_EXPORT int CRYPTO_needs_hwcap2_workaround(void);
#endif
// CRYPTO_is_ARMv8_AES_capable returns true if the current CPU supports the