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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 ScopedX509Stack OSCertHandlesToOpenSSL( | 144 ScopedX509Stack OSCertHandlesToOpenSSL( |
145 const X509Certificate::OSCertHandles& os_handles) { | 145 const X509Certificate::OSCertHandles& os_handles) { |
146 ScopedX509Stack stack(sk_X509_new_null()); | 146 ScopedX509Stack stack(sk_X509_new_null()); |
147 for (size_t i = 0; i < os_handles.size(); i++) { | 147 for (size_t i = 0; i < os_handles.size(); i++) { |
148 ScopedX509 x509 = OSCertHandleToOpenSSL(os_handles[i]); | 148 ScopedX509 x509 = OSCertHandleToOpenSSL(os_handles[i]); |
149 if (!x509) | 149 if (!x509) |
150 return ScopedX509Stack(); | 150 return ScopedX509Stack(); |
151 sk_X509_push(stack.get(), x509.release()); | 151 sk_X509_push(stack.get(), x509.release()); |
152 } | 152 } |
153 return stack.Pass(); | 153 return stack; |
154 } | 154 } |
155 | 155 |
156 bool EVP_MDToPrivateKeyHash(const EVP_MD* md, SSLPrivateKey::Hash* hash) { | 156 bool EVP_MDToPrivateKeyHash(const EVP_MD* md, SSLPrivateKey::Hash* hash) { |
157 switch (EVP_MD_type(md)) { | 157 switch (EVP_MD_type(md)) { |
158 case NID_md5_sha1: | 158 case NID_md5_sha1: |
159 *hash = SSLPrivateKey::Hash::MD5_SHA1; | 159 *hash = SSLPrivateKey::Hash::MD5_SHA1; |
160 return true; | 160 return true; |
161 case NID_sha1: | 161 case NID_sha1: |
162 *hash = SSLPrivateKey::Hash::SHA1; | 162 *hash = SSLPrivateKey::Hash::SHA1; |
163 return true; | 163 return true; |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 server_cert_chain_(new PeerCertificateChain(NULL)), | 521 server_cert_chain_(new PeerCertificateChain(NULL)), |
522 completed_connect_(false), | 522 completed_connect_(false), |
523 was_ever_used_(false), | 523 was_ever_used_(false), |
524 cert_verifier_(context.cert_verifier), | 524 cert_verifier_(context.cert_verifier), |
525 cert_transparency_verifier_(context.cert_transparency_verifier), | 525 cert_transparency_verifier_(context.cert_transparency_verifier), |
526 channel_id_service_(context.channel_id_service), | 526 channel_id_service_(context.channel_id_service), |
527 tb_was_negotiated_(false), | 527 tb_was_negotiated_(false), |
528 tb_negotiated_param_(TB_PARAM_ECDSAP256), | 528 tb_negotiated_param_(TB_PARAM_ECDSAP256), |
529 ssl_(NULL), | 529 ssl_(NULL), |
530 transport_bio_(NULL), | 530 transport_bio_(NULL), |
531 transport_(transport_socket.Pass()), | 531 transport_(std::move(transport_socket)), |
532 host_and_port_(host_and_port), | 532 host_and_port_(host_and_port), |
533 ssl_config_(ssl_config), | 533 ssl_config_(ssl_config), |
534 ssl_session_cache_shard_(context.ssl_session_cache_shard), | 534 ssl_session_cache_shard_(context.ssl_session_cache_shard), |
535 next_handshake_state_(STATE_NONE), | 535 next_handshake_state_(STATE_NONE), |
536 disconnected_(false), | 536 disconnected_(false), |
537 npn_status_(kNextProtoUnsupported), | 537 npn_status_(kNextProtoUnsupported), |
538 channel_id_sent_(false), | 538 channel_id_sent_(false), |
539 session_pending_(false), | 539 session_pending_(false), |
540 certificate_verified_(false), | 540 certificate_verified_(false), |
541 ssl_failure_state_(SSL_FAILURE_NONE), | 541 ssl_failure_state_(SSL_FAILURE_NONE), |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 tb_was_negotiated_ = true; | 2310 tb_was_negotiated_ = true; |
2311 return 1; | 2311 return 1; |
2312 } | 2312 } |
2313 } | 2313 } |
2314 | 2314 |
2315 *out_alert_value = SSL_AD_ILLEGAL_PARAMETER; | 2315 *out_alert_value = SSL_AD_ILLEGAL_PARAMETER; |
2316 return 0; | 2316 return 0; |
2317 } | 2317 } |
2318 | 2318 |
2319 } // namespace net | 2319 } // namespace net |
OLD | NEW |