Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: crypto/openssl_util.cc

Issue 1730823002: Disable all NEON in BoringSSL if has_broken_neon is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: might help to land something that actually compiles... Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "crypto/openssl_util.h" 5 #include "crypto/openssl_util.h"
6 6
7 #include <openssl/err.h> 7 #include <openssl/err.h>
8 #include <openssl/ssl.h> 8 #include <openssl/ssl.h>
9 #include <openssl/cpu.h> 9 #include <openssl/cpu.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 30 matching lines...) Expand all
41 return base::Singleton< 41 return base::Singleton<
42 OpenSSLInitSingleton, 42 OpenSSLInitSingleton,
43 base::LeakySingletonTraits<OpenSSLInitSingleton>>::get(); 43 base::LeakySingletonTraits<OpenSSLInitSingleton>>::get();
44 } 44 }
45 private: 45 private:
46 friend struct base::DefaultSingletonTraits<OpenSSLInitSingleton>; 46 friend struct base::DefaultSingletonTraits<OpenSSLInitSingleton>;
47 OpenSSLInitSingleton() { 47 OpenSSLInitSingleton() {
48 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) 48 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
49 const bool has_neon = 49 const bool has_neon =
50 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; 50 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
51 base::CPU cpu;
51 // CRYPTO_set_NEON_capable is called before |SSL_library_init| because this 52 // CRYPTO_set_NEON_capable is called before |SSL_library_init| because this
52 // stops BoringSSL from probing for NEON support via SIGILL in the case 53 // stops BoringSSL from probing for NEON support via SIGILL in the case that
53 // that getauxval isn't present. 54 // getauxval isn't present. Also workaround a CPU with broken NEON
54 CRYPTO_set_NEON_capable(has_neon); 55 // support. See https://code.google.com/p/chromium/issues/detail?id=341598
55 // See https://code.google.com/p/chromium/issues/detail?id=341598 56 CRYPTO_set_NEON_capable(has_neon && !cpu.has_broken_neon());
56 base::CPU cpu;
57 CRYPTO_set_NEON_functional(!cpu.has_broken_neon());
58 #endif 57 #endif
59 58
60 SSL_library_init(); 59 SSL_library_init();
61 } 60 }
62 61
63 ~OpenSSLInitSingleton() {} 62 ~OpenSSLInitSingleton() {}
64 63
65 DISALLOW_COPY_AND_ASSIGN(OpenSSLInitSingleton); 64 DISALLOW_COPY_AND_ASSIGN(OpenSSLInitSingleton);
66 }; 65 };
67 66
(...skipping 26 matching lines...) Expand all
94 std::string message; 93 std::string message;
95 location.Write(true, true, &message); 94 location.Write(true, true, &message);
96 DVLOG(1) << "OpenSSL ERR_get_error stack from " << message; 95 DVLOG(1) << "OpenSSL ERR_get_error stack from " << message;
97 ERR_print_errors_cb(&OpenSSLErrorCallback, NULL); 96 ERR_print_errors_cb(&OpenSSLErrorCallback, NULL);
98 } else { 97 } else {
99 ERR_clear_error(); 98 ERR_clear_error();
100 } 99 }
101 } 100 }
102 101
103 } // namespace crypto 102 } // namespace crypto
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698