#include <openssl/err.h>
#include <openssl/ssl.h>
+#include <openssl/cpu.h>
#include "base/logging.h"
#include "base/memory/scoped_vector.h"
#if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
#include <cpu-features.h>
+#include "base/cpu.h"
#endif
namespace crypto {
namespace {
-unsigned long CurrentThreadId() {
- return static_cast<unsigned long>(base::PlatformThread::CurrentId());
+void CurrentThreadId(CRYPTO_THREADID* id) {
+ CRYPTO_THREADID_set_numeric(
+ id, static_cast<unsigned long>(base::PlatformThread::CurrentId()));
}
// Singleton for initializing and cleaning up the OpenSSL library.
for (int i = 0; i < num_locks; ++i)
locks_.push_back(new base::Lock());
CRYPTO_set_locking_callback(LockingCallback);
- CRYPTO_set_id_callback(CurrentThreadId);
+ 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
}