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

Side by Side Diff: crypto/openssl_util.cc

Issue 1739403002: Cut down on usage of deprecated APIs in //crypto. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: grumble grumble string vector char uint8_t grumble Created 4 years, 9 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 | « crypto/ec_signature_creator_openssl.cc ('k') | crypto/rsa_private_key_openssl.cc » ('j') | 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>
9 #include <openssl/cpu.h> 8 #include <openssl/cpu.h>
9 #include <openssl/crypto.h>
10 #include <stddef.h> 10 #include <stddef.h>
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 18
19 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) 19 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
(...skipping 22 matching lines...) Expand all
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 base::CPU cpu;
52 // CRYPTO_set_NEON_capable is called before |SSL_library_init| because this 52 // CRYPTO_set_NEON_capable is called before |CRYPTO_library_init| because
53 // stops BoringSSL from probing for NEON support via SIGILL in the case that 53 // this stops BoringSSL from probing for NEON support via SIGILL in the case
54 // getauxval isn't present. Also workaround a CPU with broken NEON 54 // that getauxval isn't present. Also workaround a CPU with broken NEON
55 // support. See https://code.google.com/p/chromium/issues/detail?id=341598 55 // support. See https://code.google.com/p/chromium/issues/detail?id=341598
56 CRYPTO_set_NEON_capable(has_neon && !cpu.has_broken_neon()); 56 CRYPTO_set_NEON_capable(has_neon && !cpu.has_broken_neon());
57 #endif 57 #endif
58 58
59 SSL_library_init(); 59 CRYPTO_library_init();
60 } 60 }
61 61
62 ~OpenSSLInitSingleton() {} 62 ~OpenSSLInitSingleton() {}
63 63
64 DISALLOW_COPY_AND_ASSIGN(OpenSSLInitSingleton); 64 DISALLOW_COPY_AND_ASSIGN(OpenSSLInitSingleton);
65 }; 65 };
66 66
67 // Callback routine for OpenSSL to print error messages. |str| is a 67 // Callback routine for OpenSSL to print error messages. |str| is a
68 // NULL-terminated string of length |len| containing diagnostic information 68 // NULL-terminated string of length |len| containing diagnostic information
69 // such as the library, function and reason for the error, the file and line 69 // such as the library, function and reason for the error, the file and line
(...skipping 23 matching lines...) Expand all
93 std::string message; 93 std::string message;
94 location.Write(true, true, &message); 94 location.Write(true, true, &message);
95 DVLOG(1) << "OpenSSL ERR_get_error stack from " << message; 95 DVLOG(1) << "OpenSSL ERR_get_error stack from " << message;
96 ERR_print_errors_cb(&OpenSSLErrorCallback, NULL); 96 ERR_print_errors_cb(&OpenSSLErrorCallback, NULL);
97 } else { 97 } else {
98 ERR_clear_error(); 98 ERR_clear_error();
99 } 99 }
100 } 100 }
101 101
102 } // namespace crypto 102 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/ec_signature_creator_openssl.cc ('k') | crypto/rsa_private_key_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698