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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 } // namespace | 35 } // namespace |
36 | 36 |
37 void EnsureOpenSSLInit() { | 37 void EnsureOpenSSLInit() { |
38 // CRYPTO_library_init may be safely called concurrently. | 38 // CRYPTO_library_init may be safely called concurrently. |
39 CRYPTO_library_init(); | 39 CRYPTO_library_init(); |
40 } | 40 } |
41 | 41 |
42 void ClearOpenSSLERRStack(const tracked_objects::Location& location) { | 42 void ClearOpenSSLERRStack(const tracked_objects::Location& location) { |
43 if (logging::DEBUG_MODE && VLOG_IS_ON(1)) { | 43 if (DCHECK_IS_ON() && VLOG_IS_ON(1)) { |
44 uint32_t error_num = ERR_peek_error(); | 44 uint32_t error_num = ERR_peek_error(); |
45 if (error_num == 0) | 45 if (error_num == 0) |
46 return; | 46 return; |
47 | 47 |
48 std::string message; | 48 std::string message; |
49 location.Write(true, true, &message); | 49 location.Write(true, true, &message); |
50 DVLOG(1) << "OpenSSL ERR_get_error stack from " << message; | 50 DVLOG(1) << "OpenSSL ERR_get_error stack from " << message; |
51 ERR_print_errors_cb(&OpenSSLErrorCallback, NULL); | 51 ERR_print_errors_cb(&OpenSSLErrorCallback, NULL); |
52 } else { | 52 } else { |
53 ERR_clear_error(); | 53 ERR_clear_error(); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 } // namespace crypto | 57 } // namespace crypto |
OLD | NEW |