OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/ssl/openssl_ssl_util.h" | 5 #include "net/ssl/openssl_ssl_util.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include <openssl/err.h> | 9 #include <openssl/err.h> |
10 #include <openssl/ssl.h> | 10 #include <openssl/ssl.h> |
(...skipping 25 matching lines...) Expand all Loading... |
36 public: | 36 public: |
37 OpenSSLNetErrorLibSingleton() { | 37 OpenSSLNetErrorLibSingleton() { |
38 crypto::EnsureOpenSSLInit(); | 38 crypto::EnsureOpenSSLInit(); |
39 | 39 |
40 // Allocate a new error library value for inserting net errors into | 40 // Allocate a new error library value for inserting net errors into |
41 // OpenSSL. This does not register any ERR_STRING_DATA for the errors, so | 41 // OpenSSL. This does not register any ERR_STRING_DATA for the errors, so |
42 // stringifying error codes through OpenSSL will return NULL. | 42 // stringifying error codes through OpenSSL will return NULL. |
43 net_error_lib_ = ERR_get_next_error_library(); | 43 net_error_lib_ = ERR_get_next_error_library(); |
44 } | 44 } |
45 | 45 |
46 unsigned net_error_lib() const { return net_error_lib_; } | 46 int net_error_lib() const { return net_error_lib_; } |
47 | 47 |
48 private: | 48 private: |
49 unsigned net_error_lib_; | 49 int net_error_lib_; |
50 }; | 50 }; |
51 | 51 |
52 base::LazyInstance<OpenSSLNetErrorLibSingleton>::Leaky g_openssl_net_error_lib = | 52 base::LazyInstance<OpenSSLNetErrorLibSingleton>::Leaky g_openssl_net_error_lib = |
53 LAZY_INSTANCE_INITIALIZER; | 53 LAZY_INSTANCE_INITIALIZER; |
54 | 54 |
55 unsigned OpenSSLNetErrorLib() { | 55 int OpenSSLNetErrorLib() { |
56 return g_openssl_net_error_lib.Get().net_error_lib(); | 56 return g_openssl_net_error_lib.Get().net_error_lib(); |
57 } | 57 } |
58 | 58 |
59 int MapOpenSSLErrorSSL(uint32_t error_code) { | 59 int MapOpenSSLErrorSSL(uint32_t error_code) { |
60 DCHECK_EQ(ERR_LIB_SSL, ERR_GET_LIB(error_code)); | 60 DCHECK_EQ(ERR_LIB_SSL, ERR_GET_LIB(error_code)); |
61 | 61 |
62 DVLOG(1) << "OpenSSL SSL error, reason: " << ERR_GET_REASON(error_code) | 62 DVLOG(1) << "OpenSSL SSL error, reason: " << ERR_GET_REASON(error_code) |
63 << ", name: " << ERR_error_string(error_code, NULL); | 63 << ", name: " << ERR_error_string(error_code, NULL); |
64 switch (ERR_GET_REASON(error_code)) { | 64 switch (ERR_GET_REASON(error_code)) { |
65 case SSL_R_READ_TIMEOUT_EXPIRED: | 65 case SSL_R_READ_TIMEOUT_EXPIRED: |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 NetLog::ParametersCallback CreateNetLogOpenSSLErrorCallback( | 230 NetLog::ParametersCallback CreateNetLogOpenSSLErrorCallback( |
231 int net_error, | 231 int net_error, |
232 int ssl_error, | 232 int ssl_error, |
233 const OpenSSLErrorInfo& error_info) { | 233 const OpenSSLErrorInfo& error_info) { |
234 return base::Bind(&NetLogOpenSSLErrorCallback, | 234 return base::Bind(&NetLogOpenSSLErrorCallback, |
235 net_error, ssl_error, error_info); | 235 net_error, ssl_error, error_info); |
236 } | 236 } |
237 | 237 |
238 } // namespace net | 238 } // namespace net |
OLD | NEW |