X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Farmcap.c;h=b55a71ee78d45905a8c4895f5d78413c6245914d;hp=1afbc9fcd036771dd694d0dbfa42df4d839d382b;hb=4871fa49cdd0d4473b6a815fc01fbde3e6ced339;hpb=313e6ec11fb8a7bda1676ce5804bee8755664141 diff --git a/crypto/armcap.c b/crypto/armcap.c index 1afbc9fcd0..b55a71ee78 100644 --- a/crypto/armcap.c +++ b/crypto/armcap.c @@ -1,3 +1,12 @@ +/* + * Copyright 2011-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + #include #include #include @@ -60,7 +69,7 @@ static unsigned long (*getauxval) (unsigned long) = NULL; # endif /* - * ARM puts the the feature bits for Crypto Extensions in AT_HWCAP2, whereas + * ARM puts the feature bits for Crypto Extensions in AT_HWCAP2, whereas * AArch64 used AT_HWCAP. */ # if defined(__arm__) || defined (__arm) @@ -88,7 +97,7 @@ static unsigned long (*getauxval) (unsigned long) = NULL; void OPENSSL_cpuid_setup(void) { - char *e; + const char *e; struct sigaction ill_oact, ill_act; sigset_t oset; static int trigger = 0; @@ -102,6 +111,24 @@ void OPENSSL_cpuid_setup(void) return; } +# if defined(__APPLE__) && !defined(__aarch64__) + /* + * Capability probing by catching SIGILL appears to be problematic + * on iOS. But since Apple universe is "monocultural", it's actually + * possible to simply set pre-defined processor capability mask. + */ + if (1) { + OPENSSL_armcap_P = ARMV7_NEON; + return; + } + /* + * One could do same even for __aarch64__ iOS builds. It's not done + * exclusively for reasons of keeping code unified across platforms. + * Unified code works because it never triggers SIGILL on Apple + * devices... + */ +# endif + sigfillset(&all_masked); sigdelset(&all_masked, SIGILL); sigdelset(&all_masked, SIGTRAP);