diff options
author | Adam Langley <agl@google.com> | 2015-10-17 01:46:46 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-10-21 01:40:15 +0300 |
commit | 6a7cfbe06a8832a9a625985bfe8ab86ef98b7931 (patch) | |
tree | 298961eacc29c7fbc01da32c2a9c144c38edcd51 /crypto/cpu-arm.c | |
parent | c2ae53db6dff3b8a773c43e16e3efaf20ff4c7da (diff) |
Allow ARM capabilities to be set at compile time.
Some ARM environments don't support |getauxval| or signals and need to
configure the capabilities of the chip at compile time. This change adds
defines that allow them to do so.
Change-Id: I4e6987f69dd13444029bc7ac7ed4dbf8fb1faa76
Reviewed-on: https://boringssl-review.googlesource.com/6280
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/cpu-arm.c')
-rw-r--r-- | crypto/cpu-arm.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/crypto/cpu-arm.c b/crypto/cpu-arm.c index 6e037ab9..14ad2ee4 100644 --- a/crypto/cpu-arm.c +++ b/crypto/cpu-arm.c @@ -14,15 +14,14 @@ #include <openssl/cpu.h> -#if defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64) +#if (defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)) && \ + !defined(OPENSSL_STATIC_ARMCAP) #include <inttypes.h> #include <string.h> -#if !defined(OPENSSL_TRUSTY) #include <setjmp.h> #include <signal.h> -#endif #include <openssl/arm_arch.h> @@ -33,6 +32,8 @@ unsigned long getauxval(unsigned long type) __attribute__((weak)); +extern uint32_t OPENSSL_armcap_P; + char CRYPTO_is_NEON_capable(void) { return (OPENSSL_armcap_P & ARMV7_NEON) != 0; } @@ -62,7 +63,15 @@ void CRYPTO_set_NEON_functional(char neon_functional) { } } -#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_ARM) && !defined(OPENSSL_TRUSTY) +int CRYPTO_is_ARMv8_AES_capable(void) { + return (OPENSSL_armcap_P & ARMV8_AES) != 0; +} + +int CRYPTO_is_ARMv8_PMULL_capable(void) { + return (OPENSSL_armcap_P & ARMV8_PMULL) != 0; +} + +#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_ARM) static sigjmp_buf sigill_jmp; @@ -120,7 +129,7 @@ static int probe_for_NEON(void) { return 0; } -#endif /* !OPENSSL_NO_ASM && OPENSSL_ARM && !OPENSSL_TRUSTY */ +#endif /* !OPENSSL_NO_ASM && OPENSSL_ARM */ void OPENSSL_cpuid_setup(void) { if (getauxval == NULL) { @@ -186,4 +195,5 @@ void OPENSSL_cpuid_setup(void) { } } -#endif /* defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64) */ +#endif /* (defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)) && + !defined(OPENSSL_STATIC_ARMCAP) */ |