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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 | 416 |
417 int SSLClientSocketOpenSSL::ExportKeyingMaterial( | 417 int SSLClientSocketOpenSSL::ExportKeyingMaterial( |
418 const base::StringPiece& label, | 418 const base::StringPiece& label, |
419 bool has_context, const base::StringPiece& context, | 419 bool has_context, const base::StringPiece& context, |
420 unsigned char* out, unsigned int outlen) { | 420 unsigned char* out, unsigned int outlen) { |
421 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); | 421 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); |
422 | 422 |
423 int rv = SSL_export_keying_material( | 423 int rv = SSL_export_keying_material( |
424 ssl_, out, outlen, label.data(), label.size(), | 424 ssl_, out, outlen, label.data(), label.size(), |
425 reinterpret_cast<const unsigned char*>(context.data()), | 425 reinterpret_cast<const unsigned char*>(context.data()), context.length(), |
426 context.length(), context.length() > 0); | 426 has_context ? 1 : 0); |
427 | 427 |
428 if (rv != 1) { | 428 if (rv != 1) { |
429 int ssl_error = SSL_get_error(ssl_, rv); | 429 int ssl_error = SSL_get_error(ssl_, rv); |
430 LOG(ERROR) << "Failed to export keying material;" | 430 LOG(ERROR) << "Failed to export keying material;" |
431 << " returned " << rv | 431 << " returned " << rv |
432 << ", SSL error code " << ssl_error; | 432 << ", SSL error code " << ssl_error; |
433 return MapOpenSSLError(ssl_error, err_tracer); | 433 return MapOpenSSLError(ssl_error, err_tracer); |
434 } | 434 } |
435 return OK; | 435 return OK; |
436 } | 436 } |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 | 1947 |
1948 return result; | 1948 return result; |
1949 } | 1949 } |
1950 | 1950 |
1951 scoped_refptr<X509Certificate> | 1951 scoped_refptr<X509Certificate> |
1952 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { | 1952 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { |
1953 return server_cert_; | 1953 return server_cert_; |
1954 } | 1954 } |
1955 | 1955 |
1956 } // namespace net | 1956 } // namespace net |
OLD | NEW |