Chromium Code Reviews| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 } // namespace | 172 } // namespace |
| 173 | 173 |
| 174 void OpenSSLPutNetError(const tracked_objects::Location& location, int err) { | 174 void OpenSSLPutNetError(const tracked_objects::Location& location, int err) { |
| 175 // Net error codes are negative. Encode them as positive numbers. | 175 // Net error codes are negative. Encode them as positive numbers. |
| 176 err = -err; | 176 err = -err; |
| 177 if (err < 0 || err > 0xfff) { | 177 if (err < 0 || err > 0xfff) { |
| 178 // OpenSSL reserves 12 bits for the reason code. | 178 // OpenSSL reserves 12 bits for the reason code. |
| 179 NOTREACHED(); | 179 NOTREACHED(); |
| 180 err = ERR_INVALID_ARGUMENT; | 180 err = ERR_INVALID_ARGUMENT; |
| 181 } | 181 } |
| 182 ERR_put_error(OpenSSLNetErrorLib(), 0, err, | 182 ERR_put_error(OpenSSLNetErrorLib(), err, location.function_name(), |
|
achuithb
2015/07/21 21:15:00
../../net/ssl/openssl_ssl_util.cc: In function 'vo
| |
| 183 location.file_name(), location.line_number()); | 183 location.file_name(), location.line_number()); |
| 184 } | 184 } |
| 185 | 185 |
| 186 int MapOpenSSLError(int err, const crypto::OpenSSLErrStackTracer& tracer) { | 186 int MapOpenSSLError(int err, const crypto::OpenSSLErrStackTracer& tracer) { |
| 187 OpenSSLErrorInfo error_info; | 187 OpenSSLErrorInfo error_info; |
| 188 return MapOpenSSLErrorWithDetails(err, tracer, &error_info); | 188 return MapOpenSSLErrorWithDetails(err, tracer, &error_info); |
| 189 } | 189 } |
| 190 | 190 |
| 191 int MapOpenSSLErrorWithDetails(int err, | 191 int MapOpenSSLErrorWithDetails(int err, |
| 192 const crypto::OpenSSLErrStackTracer& tracer, | 192 const crypto::OpenSSLErrStackTracer& tracer, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 233 |
| 234 NetLog::ParametersCallback CreateNetLogOpenSSLErrorCallback( | 234 NetLog::ParametersCallback CreateNetLogOpenSSLErrorCallback( |
| 235 int net_error, | 235 int net_error, |
| 236 int ssl_error, | 236 int ssl_error, |
| 237 const OpenSSLErrorInfo& error_info) { | 237 const OpenSSLErrorInfo& error_info) { |
| 238 return base::Bind(&NetLogOpenSSLErrorCallback, | 238 return base::Bind(&NetLogOpenSSLErrorCallback, |
| 239 net_error, ssl_error, error_info); | 239 net_error, ssl_error, error_info); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace net | 242 } // namespace net |
| OLD | NEW |