Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorAdam Langley <agl@chromium.org>2015-02-03 22:47:10 +0300
committerAdam Langley <agl@google.com>2015-02-03 22:56:25 +0300
commit8f5e2ebcee628ef02add9b21955402b0c6256624 (patch)
treefe9f27e1a5c4af7f9576fc76f56a2fca3598ad07 /crypto
parent0ea8dda93efadce14f7a95f84d3d9f2509434fb0 (diff)
Don't probe for NEON with SIGILL on aarch64.
We assume that AArch64 systems are modern enough to have getauxval. Change-Id: I4cc74f04ca5ed50b8ca1cfd00afeaaa01c6caca0 Reviewed-on: https://boringssl-review.googlesource.com/3280 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/cpu-arm-asm.S4
-rw-r--r--crypto/cpu-arm.c21
2 files changed, 18 insertions, 7 deletions
diff --git a/crypto/cpu-arm-asm.S b/crypto/cpu-arm-asm.S
index 7941f5f0..faf3ad89 100644
--- a/crypto/cpu-arm-asm.S
+++ b/crypto/cpu-arm-asm.S
@@ -12,7 +12,7 @@
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#if !defined(OPENSSL_NO_ASM)
+#if !defined(OPENSSL_NO_ASM) && defined(__arm__)
.syntax unified
.cpu cortex-a8
@@ -29,4 +29,4 @@ CRYPTO_arm_neon_probe:
bx lr
.section .note.GNU-stack,"",%progbits
-#endif /* !OPENSSL_NO_ASM */
+#endif /* !OPENSSL_NO_ASM && __arm__ */
diff --git a/crypto/cpu-arm.c b/crypto/cpu-arm.c
index 5ecdb1a3..8ca60fbf 100644
--- a/crypto/cpu-arm.c
+++ b/crypto/cpu-arm.c
@@ -62,6 +62,8 @@ void CRYPTO_set_NEON_functional(char neon_functional) {
}
}
+#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_ARM)
+
static sigjmp_buf sigill_jmp;
static void sigill_handler(int signal) {
@@ -76,7 +78,6 @@ void CRYPTO_arm_neon_probe();
static int probe_for_NEON() {
int supported = 0;
-#if !defined(OPENSSL_NO_ASM)
sigset_t sigmask;
sigfillset(&sigmask);
sigdelset(&sigmask, SIGILL);
@@ -109,16 +110,26 @@ static int probe_for_NEON() {
sigaction(SIGILL, &sigill_original_action, NULL);
sigprocmask(SIG_SETMASK, &original_sigmask, NULL);
-#endif
return supported;
}
+#else
+
+static int probe_for_NEON() {
+ return 0;
+}
+
+#endif /* !OPENSSL_NO_ASM && OPENSSL_ARM */
+
void OPENSSL_cpuid_setup(void) {
if (getauxval == NULL) {
- // |CRYPTO_is_NEON_capable| can be true even if |CRYPTO_set_NEON_capable|
- // has never been called if the code was compiled with NEON support enabled
- // (e.g. -mfpu=neon).
+ // On ARM, but not AArch64, try a NEON instruction and see whether it works
+ // in order to probe for NEON support.
+ //
+ // Note that |CRYPTO_is_NEON_capable| can be true even if
+ // |CRYPTO_set_NEON_capable| has never been called if the code was compiled
+ // with NEON support enabled (e.g. -mfpu=neon).
if (!g_set_neon_called && !CRYPTO_is_NEON_capable() && probe_for_NEON()) {
OPENSSL_armcap_P |= ARMV7_NEON;
}