Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: net/socket/ssl_client_socket_openssl.cc

Issue 1053233003: Fix the OpenSSL implementation of ExportKeyingMaterial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698