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

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

Issue 10823084: Add a new GetTlsUniqueChannelBinding method to SSLSocket, and implement nss version. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix wtc comments Created 8 years, 4 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 | Annotate | Revision Log
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 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived
6 // from AuthCertificateCallback() in 6 // from AuthCertificateCallback() in
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp.
8 8
9 /* ***** BEGIN LICENSE BLOCK ***** 9 /* ***** BEGIN LICENSE BLOCK *****
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
(...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 nss_fd_, label.data(), label.size(), has_context, 2817 nss_fd_, label.data(), label.size(), has_context,
2818 reinterpret_cast<const unsigned char*>(context.data()), 2818 reinterpret_cast<const unsigned char*>(context.data()),
2819 context.length(), out, outlen); 2819 context.length(), out, outlen);
2820 if (result != SECSuccess) { 2820 if (result != SECSuccess) {
2821 LogFailedNSSFunction(net_log_, "SSL_ExportKeyingMaterial", ""); 2821 LogFailedNSSFunction(net_log_, "SSL_ExportKeyingMaterial", "");
2822 return MapNSSError(PORT_GetError()); 2822 return MapNSSError(PORT_GetError());
2823 } 2823 }
2824 return OK; 2824 return OK;
2825 } 2825 }
2826 2826
2827 int SSLClientSocketNSS::GetTLSUniqueChannelBinding(std::string* out) {
2828 if (!IsConnected())
2829 return ERR_SOCKET_NOT_CONNECTED;
2830 unsigned char buf[64];
2831 unsigned int len;
2832 SECStatus result = SSL_GetChannelBinding(nss_fd_,
2833 SSL_CHANNEL_BINDING_TLS_UNIQUE,
2834 buf, &len, arraysize(buf));
2835 if (result != SECSuccess) {
2836 LogFailedNSSFunction(net_log_, "SSL_GetChannelBinding", "");
2837 return MapNSSError(PORT_GetError());
2838 }
2839 out->assign(reinterpret_cast<char*>(buf), len);
2840 return OK;
2841 }
2842
2827 SSLClientSocket::NextProtoStatus 2843 SSLClientSocket::NextProtoStatus
2828 SSLClientSocketNSS::GetNextProto(std::string* proto, 2844 SSLClientSocketNSS::GetNextProto(std::string* proto,
2829 std::string* server_protos) { 2845 std::string* server_protos) {
2830 *proto = core_->state().next_proto; 2846 *proto = core_->state().next_proto;
2831 *server_protos = core_->state().server_protos; 2847 *server_protos = core_->state().server_protos;
2832 return core_->state().next_proto_status; 2848 return core_->state().next_proto_status;
2833 } 2849 }
2834 2850
2835 int SSLClientSocketNSS::Connect(const CompletionCallback& callback) { 2851 int SSLClientSocketNSS::Connect(const CompletionCallback& callback) {
2836 EnterFunction(""); 2852 EnterFunction("");
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
3503 EnsureThreadIdAssigned(); 3519 EnsureThreadIdAssigned();
3504 base::AutoLock auto_lock(lock_); 3520 base::AutoLock auto_lock(lock_);
3505 return valid_thread_id_ == base::PlatformThread::CurrentId(); 3521 return valid_thread_id_ == base::PlatformThread::CurrentId();
3506 } 3522 }
3507 3523
3508 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { 3524 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const {
3509 return server_bound_cert_service_; 3525 return server_bound_cert_service_;
3510 } 3526 }
3511 3527
3512 } // namespace net 3528 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698