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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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: |
66 return ERR_TIMED_OUT; | 66 return ERR_TIMED_OUT; |
67 case SSL_R_UNKNOWN_CERTIFICATE_TYPE: | 67 case SSL_R_UNKNOWN_CERTIFICATE_TYPE: |
68 case SSL_R_UNKNOWN_CIPHER_TYPE: | 68 case SSL_R_UNKNOWN_CIPHER_TYPE: |
69 case SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE: | 69 case SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE: |
70 case SSL_R_UNKNOWN_PKEY_TYPE: | |
71 case SSL_R_UNKNOWN_SSL_VERSION: | 70 case SSL_R_UNKNOWN_SSL_VERSION: |
72 return ERR_NOT_IMPLEMENTED; | 71 return ERR_NOT_IMPLEMENTED; |
73 case SSL_R_UNSUPPORTED_SSL_VERSION: | 72 case SSL_R_UNSUPPORTED_SSL_VERSION: |
74 case SSL_R_NO_CIPHER_MATCH: | 73 case SSL_R_NO_CIPHER_MATCH: |
75 case SSL_R_NO_SHARED_CIPHER: | 74 case SSL_R_NO_SHARED_CIPHER: |
76 case SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY: | 75 case SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY: |
77 case SSL_R_TLSV1_ALERT_PROTOCOL_VERSION: | 76 case SSL_R_TLSV1_ALERT_PROTOCOL_VERSION: |
78 case SSL_R_UNSUPPORTED_PROTOCOL: | 77 case SSL_R_UNSUPPORTED_PROTOCOL: |
79 return ERR_SSL_VERSION_OR_CIPHER_MISMATCH; | 78 return ERR_SSL_VERSION_OR_CIPHER_MISMATCH; |
80 case SSL_R_SSLV3_ALERT_BAD_CERTIFICATE: | 79 case SSL_R_SSLV3_ALERT_BAD_CERTIFICATE: |
(...skipping 26 matching lines...) Expand all Loading... |
107 case SSL_R_DECRYPTION_FAILED: | 106 case SSL_R_DECRYPTION_FAILED: |
108 case SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC: | 107 case SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC: |
109 case SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG: | 108 case SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG: |
110 case SSL_R_DIGEST_CHECK_FAILED: | 109 case SSL_R_DIGEST_CHECK_FAILED: |
111 case SSL_R_ENCRYPTED_LENGTH_TOO_LONG: | 110 case SSL_R_ENCRYPTED_LENGTH_TOO_LONG: |
112 case SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST: | 111 case SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST: |
113 case SSL_R_EXCESSIVE_MESSAGE_SIZE: | 112 case SSL_R_EXCESSIVE_MESSAGE_SIZE: |
114 case SSL_R_EXTRA_DATA_IN_MESSAGE: | 113 case SSL_R_EXTRA_DATA_IN_MESSAGE: |
115 case SSL_R_GOT_A_FIN_BEFORE_A_CCS: | 114 case SSL_R_GOT_A_FIN_BEFORE_A_CCS: |
116 case SSL_R_INVALID_COMMAND: | 115 case SSL_R_INVALID_COMMAND: |
117 case SSL_R_INVALID_STATUS_RESPONSE: | |
118 case SSL_R_INVALID_TICKET_KEYS_LENGTH: | 116 case SSL_R_INVALID_TICKET_KEYS_LENGTH: |
119 // SSL_do_handshake reports this error when the server responds to a | 117 // SSL_do_handshake reports this error when the server responds to a |
120 // ClientHello with a fatal close_notify alert. | 118 // ClientHello with a fatal close_notify alert. |
121 case SSL_R_SSLV3_ALERT_CLOSE_NOTIFY: | 119 case SSL_R_SSLV3_ALERT_CLOSE_NOTIFY: |
122 case SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE: | 120 case SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE: |
123 case SSL_R_SSLV3_ALERT_NO_CERTIFICATE: | 121 case SSL_R_SSLV3_ALERT_NO_CERTIFICATE: |
124 case SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER: | 122 case SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER: |
125 case SSL_R_TLSV1_ALERT_DECODE_ERROR: | 123 case SSL_R_TLSV1_ALERT_DECODE_ERROR: |
126 case SSL_R_TLSV1_ALERT_DECRYPTION_FAILED: | 124 case SSL_R_TLSV1_ALERT_DECRYPTION_FAILED: |
127 case SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION: | 125 case SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 234 |
237 NetLog::ParametersCallback CreateNetLogOpenSSLErrorCallback( | 235 NetLog::ParametersCallback CreateNetLogOpenSSLErrorCallback( |
238 int net_error, | 236 int net_error, |
239 int ssl_error, | 237 int ssl_error, |
240 const OpenSSLErrorInfo& error_info) { | 238 const OpenSSLErrorInfo& error_info) { |
241 return base::Bind(&NetLogOpenSSLErrorCallback, | 239 return base::Bind(&NetLogOpenSSLErrorCallback, |
242 net_error, ssl_error, error_info); | 240 net_error, ssl_error, error_info); |
243 } | 241 } |
244 | 242 |
245 } // namespace net | 243 } // namespace net |
OLD | NEW |