OLD | NEW |
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 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 for (int i = 0; i < num_locks; ++i) | 55 for (int i = 0; i < num_locks; ++i) |
56 locks_.push_back(new base::Lock()); | 56 locks_.push_back(new base::Lock()); |
57 CRYPTO_set_locking_callback(LockingCallback); | 57 CRYPTO_set_locking_callback(LockingCallback); |
58 CRYPTO_THREADID_set_callback(CurrentThreadId); | 58 CRYPTO_THREADID_set_callback(CurrentThreadId); |
59 | 59 |
60 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 60 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
61 const bool has_neon = | 61 const bool has_neon = |
62 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; | 62 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
63 if (has_neon) | 63 if (has_neon) |
64 CRYPTO_set_NEON_capable(1); | 64 CRYPTO_set_NEON_capable(1); |
| 65 // In all cases, currently, mark the NEON unit as broken because some |
| 66 // phones can't execute the Poly1305 code correctly. See |
| 67 // https://code.google.com/p/chromium/issues/detail?id=341598 |
| 68 CRYPTO_set_NEON_functional(0); |
65 #endif | 69 #endif |
66 } | 70 } |
67 | 71 |
68 ~OpenSSLInitSingleton() { | 72 ~OpenSSLInitSingleton() { |
69 CRYPTO_set_locking_callback(NULL); | 73 CRYPTO_set_locking_callback(NULL); |
70 EVP_cleanup(); | 74 EVP_cleanup(); |
71 ERR_free_strings(); | 75 ERR_free_strings(); |
72 } | 76 } |
73 | 77 |
74 static void LockingCallback(int mode, int n, const char* file, int line) { | 78 static void LockingCallback(int mode, int n, const char* file, int line) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 std::string message; | 122 std::string message; |
119 location.Write(true, true, &message); | 123 location.Write(true, true, &message); |
120 DVLOG(1) << "OpenSSL ERR_get_error stack from " << message; | 124 DVLOG(1) << "OpenSSL ERR_get_error stack from " << message; |
121 ERR_print_errors_cb(&OpenSSLErrorCallback, NULL); | 125 ERR_print_errors_cb(&OpenSSLErrorCallback, NULL); |
122 } else { | 126 } else { |
123 ERR_clear_error(); | 127 ERR_clear_error(); |
124 } | 128 } |
125 } | 129 } |
126 | 130 |
127 } // namespace crypto | 131 } // namespace crypto |
OLD | NEW |