OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // OpenSSL binding for SSLClientSocket. The class layout and general principle | 5 // OpenSSL binding for SSLClientSocket. The class layout and general principle |
6 // of operation is derived from SSLClientSocketNSS. | 6 // of operation is derived from SSLClientSocketNSS. |
7 | 7 |
8 #include "net/socket/ssl_client_socket_openssl.h" | 8 #include "net/socket/ssl_client_socket_openssl.h" |
9 | 9 |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 host_and_port_.host(), &channel_id_key_, | 1250 host_and_port_.host(), &channel_id_key_, |
1251 base::Bind(&SSLClientSocketOpenSSL::OnHandshakeIOComplete, | 1251 base::Bind(&SSLClientSocketOpenSSL::OnHandshakeIOComplete, |
1252 base::Unretained(this)), | 1252 base::Unretained(this)), |
1253 &channel_id_request_); | 1253 &channel_id_request_); |
1254 } | 1254 } |
1255 | 1255 |
1256 int SSLClientSocketOpenSSL::DoChannelIDLookupComplete(int result) { | 1256 int SSLClientSocketOpenSSL::DoChannelIDLookupComplete(int result) { |
1257 if (result < 0) | 1257 if (result < 0) |
1258 return result; | 1258 return result; |
1259 | 1259 |
1260 if (!channel_id_key_) { | |
1261 LOG(ERROR) << "Failed to import Channel ID."; | |
1262 return ERR_CHANNEL_ID_IMPORT_FAILED; | |
1263 } | |
1264 | |
1265 // Hand the key to OpenSSL. Check for error in case OpenSSL rejects the key | 1260 // Hand the key to OpenSSL. Check for error in case OpenSSL rejects the key |
1266 // type. | 1261 // type. |
| 1262 DCHECK(channel_id_key_); |
1267 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); | 1263 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); |
1268 int rv = SSL_set1_tls_channel_id(ssl_, channel_id_key_->key()); | 1264 int rv = SSL_set1_tls_channel_id(ssl_, channel_id_key_->key()); |
1269 if (!rv) { | 1265 if (!rv) { |
1270 LOG(ERROR) << "Failed to set Channel ID."; | 1266 LOG(ERROR) << "Failed to set Channel ID."; |
1271 int err = SSL_get_error(ssl_, rv); | 1267 int err = SSL_get_error(ssl_, rv); |
1272 return MapOpenSSLError(err, err_tracer); | 1268 return MapOpenSSLError(err, err_tracer); |
1273 } | 1269 } |
1274 | 1270 |
1275 // Return to the handshake. | 1271 // Return to the handshake. |
1276 channel_id_sent_ = true; | 1272 channel_id_sent_ = true; |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2304 tb_was_negotiated_ = true; | 2300 tb_was_negotiated_ = true; |
2305 return 1; | 2301 return 1; |
2306 } | 2302 } |
2307 } | 2303 } |
2308 | 2304 |
2309 *out_alert_value = SSL_AD_ILLEGAL_PARAMETER; | 2305 *out_alert_value = SSL_AD_ILLEGAL_PARAMETER; |
2310 return 0; | 2306 return 0; |
2311 } | 2307 } |
2312 | 2308 |
2313 } // namespace net | 2309 } // namespace net |
OLD | NEW |