| 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/socket/openssl_ssl_util.h" | 5 #include "net/socket/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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 case SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION: | 141 case SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION: |
| 142 case SSL_R_TLSV1_ALERT_INTERNAL_ERROR: | 142 case SSL_R_TLSV1_ALERT_INTERNAL_ERROR: |
| 143 case SSL_R_TLSV1_ALERT_NO_RENEGOTIATION: | 143 case SSL_R_TLSV1_ALERT_NO_RENEGOTIATION: |
| 144 case SSL_R_TLSV1_ALERT_RECORD_OVERFLOW: | 144 case SSL_R_TLSV1_ALERT_RECORD_OVERFLOW: |
| 145 case SSL_R_TLSV1_ALERT_USER_CANCELLED: | 145 case SSL_R_TLSV1_ALERT_USER_CANCELLED: |
| 146 return ERR_SSL_PROTOCOL_ERROR; | 146 return ERR_SSL_PROTOCOL_ERROR; |
| 147 case SSL_R_CERTIFICATE_VERIFY_FAILED: | 147 case SSL_R_CERTIFICATE_VERIFY_FAILED: |
| 148 // The only way that the certificate verify callback can fail is if | 148 // The only way that the certificate verify callback can fail is if |
| 149 // the leaf certificate changed during a renegotiation. | 149 // the leaf certificate changed during a renegotiation. |
| 150 return ERR_SSL_SERVER_CERT_CHANGED; | 150 return ERR_SSL_SERVER_CERT_CHANGED; |
| 151 case SSL_AD_REASON_OFFSET + SSL3_AD_INAPPROPRIATE_FALLBACK: |
| 152 return ERR_SSL_INAPPROPRIATE_FALLBACK; |
| 151 default: | 153 default: |
| 152 LOG(WARNING) << "Unmapped error reason: " << ERR_GET_REASON(error_code); | 154 LOG(WARNING) << "Unmapped error reason: " << ERR_GET_REASON(error_code); |
| 153 return ERR_FAILED; | 155 return ERR_FAILED; |
| 154 } | 156 } |
| 155 } | 157 } |
| 156 | 158 |
| 157 } // namespace | 159 } // namespace |
| 158 | 160 |
| 159 void OpenSSLPutNetError(const tracked_objects::Location& location, int err) { | 161 void OpenSSLPutNetError(const tracked_objects::Location& location, int err) { |
| 160 // Net error codes are negative. Encode them as positive numbers. | 162 // Net error codes are negative. Encode them as positive numbers. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } while (error_code != 0); | 195 } while (error_code != 0); |
| 194 return ERR_SSL_PROTOCOL_ERROR; | 196 return ERR_SSL_PROTOCOL_ERROR; |
| 195 default: | 197 default: |
| 196 // TODO(joth): Implement full mapping. | 198 // TODO(joth): Implement full mapping. |
| 197 LOG(WARNING) << "Unknown OpenSSL error " << err; | 199 LOG(WARNING) << "Unknown OpenSSL error " << err; |
| 198 return ERR_SSL_PROTOCOL_ERROR; | 200 return ERR_SSL_PROTOCOL_ERROR; |
| 199 } | 201 } |
| 200 } | 202 } |
| 201 | 203 |
| 202 } // namespace net | 204 } // namespace net |
| OLD | NEW |