| 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 | |
| 9 #include <openssl/err.h> | 8 #include <openssl/err.h> |
| 10 #include <openssl/ssl.h> | 9 #include <openssl/ssl.h> |
| 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "crypto/openssl_util.h" | 17 #include "crypto/openssl_util.h" |
| 18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 dict->SetInteger("net_error", net_error); | 125 dict->SetInteger("net_error", net_error); |
| 126 dict->SetInteger("ssl_error", ssl_error); | 126 dict->SetInteger("ssl_error", ssl_error); |
| 127 if (error_info.error_code != 0) { | 127 if (error_info.error_code != 0) { |
| 128 dict->SetInteger("error_lib", ERR_GET_LIB(error_info.error_code)); | 128 dict->SetInteger("error_lib", ERR_GET_LIB(error_info.error_code)); |
| 129 dict->SetInteger("error_reason", ERR_GET_REASON(error_info.error_code)); | 129 dict->SetInteger("error_reason", ERR_GET_REASON(error_info.error_code)); |
| 130 } | 130 } |
| 131 if (error_info.file != NULL) | 131 if (error_info.file != NULL) |
| 132 dict->SetString("file", error_info.file); | 132 dict->SetString("file", error_info.file); |
| 133 if (error_info.line != 0) | 133 if (error_info.line != 0) |
| 134 dict->SetInteger("line", error_info.line); | 134 dict->SetInteger("line", error_info.line); |
| 135 return dict.Pass(); | 135 return std::move(dict); |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace | 138 } // namespace |
| 139 | 139 |
| 140 void OpenSSLPutNetError(const tracked_objects::Location& location, int err) { | 140 void OpenSSLPutNetError(const tracked_objects::Location& location, int err) { |
| 141 // Net error codes are negative. Encode them as positive numbers. | 141 // Net error codes are negative. Encode them as positive numbers. |
| 142 err = -err; | 142 err = -err; |
| 143 if (err < 0 || err > 0xfff) { | 143 if (err < 0 || err > 0xfff) { |
| 144 // OpenSSL reserves 12 bits for the reason code. | 144 // OpenSSL reserves 12 bits for the reason code. |
| 145 NOTREACHED(); | 145 NOTREACHED(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 NetLog::ParametersCallback CreateNetLogOpenSSLErrorCallback( | 200 NetLog::ParametersCallback CreateNetLogOpenSSLErrorCallback( |
| 201 int net_error, | 201 int net_error, |
| 202 int ssl_error, | 202 int ssl_error, |
| 203 const OpenSSLErrorInfo& error_info) { | 203 const OpenSSLErrorInfo& error_info) { |
| 204 return base::Bind(&NetLogOpenSSLErrorCallback, | 204 return base::Bind(&NetLogOpenSSLErrorCallback, |
| 205 net_error, ssl_error, error_info); | 205 net_error, ssl_error, error_info); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace net | 208 } // namespace net |
| OLD | NEW |