diff options
author | agl <agl@chromium.org> | 2015-02-02 14:31:11 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-02 22:32:24 +0000 |
commit | fa9063829e638aeb72ede79e5d0396a81a0211d1 (patch) | |
tree | 30899b57de7c0417c459b20aca0a0f2047bf6b16 /crypto | |
parent | a2a2970d72e7856444896600874fca9594f55437 (diff) | |
download | chromium_src-fa9063829e638aeb72ede79e5d0396a81a0211d1.zip chromium_src-fa9063829e638aeb72ede79e5d0396a81a0211d1.tar.gz chromium_src-fa9063829e638aeb72ede79e5d0396a81a0211d1.tar.bz2 |
Move the call to CRYPTO_set_NEON_capable up.
BoringSSL needs to probe for NEON support via SIGILL in cases where
getauxval isn't provided and the application doesn't do explicit
initialisation.
However, Chromium might have gone multithreaded by the time that we
initialise BoringSSL and, although it doesn't look like we'll race the
disposition of SIGILL with anything, it's best not to test that hope.
So this change causes CRYPTO_set_NEON_capable to always be called, and
to be called before SSL_library_init. BoringSSL will take that as a
signal that probing for NEON support isn't needed.
BUG=none
Review URL: https://codereview.chromium.org/899463002
Cr-Commit-Position: refs/heads/master@{#314201}
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/openssl_util.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/crypto/openssl_util.cc b/crypto/openssl_util.cc index f41b55a..8ea1232 100644 --- a/crypto/openssl_util.cc +++ b/crypto/openssl_util.cc @@ -48,6 +48,18 @@ class OpenSSLInitSingleton { private: friend struct DefaultSingletonTraits<OpenSSLInitSingleton>; OpenSSLInitSingleton() { +#if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) + const bool has_neon = + (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; + // CRYPTO_set_NEON_capable is called before |SSL_library_init| because this + // stops BoringSSL from probing for NEON support via SIGILL in the case + // that getauxval isn't present. + CRYPTO_set_NEON_capable(has_neon); + // See https://code.google.com/p/chromium/issues/detail?id=341598 + base::CPU cpu; + CRYPTO_set_NEON_functional(!cpu.has_broken_neon()); +#endif + SSL_load_error_strings(); SSL_library_init(); int num_locks = CRYPTO_num_locks(); @@ -56,16 +68,6 @@ class OpenSSLInitSingleton { locks_.push_back(new base::Lock()); CRYPTO_set_locking_callback(LockingCallback); CRYPTO_THREADID_set_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); - // See https://code.google.com/p/chromium/issues/detail?id=341598 - base::CPU cpu; - CRYPTO_set_NEON_functional(!cpu.has_broken_neon()); -#endif } ~OpenSSLInitSingleton() { |