summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/crypto.gyp3
-rw-r--r--crypto/openssl_util.cc12
2 files changed, 15 insertions, 0 deletions
diff --git a/crypto/crypto.gyp b/crypto/crypto.gyp
index 2f38aee..fd80fa5 100644
--- a/crypto/crypto.gyp
+++ b/crypto/crypto.gyp
@@ -75,6 +75,9 @@
['exclude', 'signature_verifier_nss\.cc$'],
['exclude', 'symmetric_key_nss\.cc$'],
],
+ 'includes': [
+ '../build/android/cpufeatures.gypi',
+ ],
}],
[ 'os_bsd==1', {
'link_settings': {
diff --git a/crypto/openssl_util.cc b/crypto/openssl_util.cc
index 5bc3ce5..34af810 100644
--- a/crypto/openssl_util.cc
+++ b/crypto/openssl_util.cc
@@ -12,6 +12,11 @@
#include "base/memory/singleton.h"
#include "base/strings/string_piece.h"
#include "base/synchronization/lock.h"
+#include "build/build_config.h"
+
+#if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
+#include <cpu-features.h>
+#endif
namespace crypto {
@@ -49,6 +54,13 @@ class OpenSSLInitSingleton {
locks_.push_back(new base::Lock());
CRYPTO_set_locking_callback(LockingCallback);
CRYPTO_set_id_callback(CurrentThreadId);
+
+#if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
+ const bool has_neon =
+ (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
+ if (has_neon)
+ CRYPTO_set_NEON_capable(1);
+#endif
}
~OpenSSLInitSingleton() {