summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorLars Immisch <immisch@adobe.com>2020-03-05 11:26:06 +0100
committerPauli <pauli@openssl.org>2021-06-29 19:06:57 +1000
commit2357e6e94a46362dbf56eecfec6ffbaa8bd76a68 (patch)
tree1d90e95488aed47860d45f8481d1a93bc33c85b9 /crypto
parentb2dea4d5f22ec146373324c282fb1bcecd5a7d90 (diff)
Use getauxval on Android with API level > 18
We received analytics that devices of the device family Oppo A37x are crashing with SIGILL when trying to load libcrypto.so. These crashes were fixed by using the system-supplied getauxval function. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15763)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/armcap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/armcap.c b/crypto/armcap.c
index 9e209f36aa..c5685bde58 100644
--- a/crypto/armcap.c
+++ b/crypto/armcap.c
@@ -94,6 +94,15 @@ static unsigned long getauxval(unsigned long key)
# endif
/*
+ * Android: according to https://developer.android.com/ndk/guides/cpu-features,
+ * getauxval is supported starting with API level 18
+ */
+# if defined(__ANDROID__) && defined(__ANDROID_API__) && __ANDROID_API__ >= 18
+# include <sys/auxv.h>
+# define OSSL_IMPLEMENT_GETAUXVAL
+# endif
+
+/*
* ARM puts the feature bits for Crypto Extensions in AT_HWCAP2, whereas
* AArch64 used AT_HWCAP.
*/