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

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

Issue 8787011: Log server advertised protos and the selected (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 reinterpret_cast<const unsigned char*>(context.data()), 549 reinterpret_cast<const unsigned char*>(context.data()),
550 context.length(), out, outlen); 550 context.length(), out, outlen);
551 if (result != SECSuccess) { 551 if (result != SECSuccess) {
552 LogFailedNSSFunction(net_log_, "SSL_ExportKeyingMaterial", ""); 552 LogFailedNSSFunction(net_log_, "SSL_ExportKeyingMaterial", "");
553 return MapNSSError(PORT_GetError()); 553 return MapNSSError(PORT_GetError());
554 } 554 }
555 return OK; 555 return OK;
556 } 556 }
557 557
558 SSLClientSocket::NextProtoStatus 558 SSLClientSocket::NextProtoStatus
559 SSLClientSocketNSS::GetNextProto(std::string* proto) { 559 SSLClientSocketNSS::GetNextProto(std::string* proto,
560 std::string* server_proto) {
agl 2011/12/05 16:38:10 s
ramant (doing other things) 2011/12/05 19:03:28 Done.
560 *proto = next_proto_; 561 *proto = next_proto_;
562 *server_proto = protos_;
561 return next_proto_status_; 563 return next_proto_status_;
562 } 564 }
563 565
564 int SSLClientSocketNSS::Connect(OldCompletionCallback* callback) { 566 int SSLClientSocketNSS::Connect(OldCompletionCallback* callback) {
565 EnterFunction(""); 567 EnterFunction("");
566 DCHECK(transport_.get()); 568 DCHECK(transport_.get());
567 DCHECK(next_handshake_state_ == STATE_NONE); 569 DCHECK(next_handshake_state_ == STATE_NONE);
568 DCHECK(!user_read_callback_); 570 DCHECK(!user_read_callback_);
569 DCHECK(!user_write_callback_); 571 DCHECK(!user_write_callback_);
570 DCHECK(!user_connect_callback_); 572 DCHECK(!user_connect_callback_);
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 } 2593 }
2592 2594
2593 if (that->next_proto_status_ == kNextProtoNegotiated) 2595 if (that->next_proto_status_ == kNextProtoNegotiated)
2594 break; 2596 break;
2595 2597
2596 // NSS checks that the data in |protos| is well formed, so we know that 2598 // NSS checks that the data in |protos| is well formed, so we know that
2597 // this doesn't cause us to jump off the end of the buffer. 2599 // this doesn't cause us to jump off the end of the buffer.
2598 i += len + 1; 2600 i += len + 1;
2599 } 2601 }
2600 2602
2603 that->protos_.assign(reinterpret_cast<const char*>(protos), protos_len);
2604
2601 // If we didn't find a protocol, we select the first one from our list. 2605 // If we didn't find a protocol, we select the first one from our list.
2602 if (that->next_proto_status_ != kNextProtoNegotiated) { 2606 if (that->next_proto_status_ != kNextProtoNegotiated) {
2603 that->next_proto_status_ = kNextProtoNoOverlap; 2607 that->next_proto_status_ = kNextProtoNoOverlap;
2604 that->next_proto_ = that->ssl_config_.next_protos[0]; 2608 that->next_proto_ = that->ssl_config_.next_protos[0];
2605 } 2609 }
2606 2610
2607 memcpy(proto_out, that->next_proto_.data(), that->next_proto_.size()); 2611 memcpy(proto_out, that->next_proto_.data(), that->next_proto_.size());
2608 *proto_out_len = that->next_proto_.size(); 2612 *proto_out_len = that->next_proto_.size();
2609 return SECSuccess; 2613 return SECSuccess;
2610 } 2614 }
2611 2615
2612 void SSLClientSocketNSS::EnsureThreadIdAssigned() const { 2616 void SSLClientSocketNSS::EnsureThreadIdAssigned() const {
2613 base::AutoLock auto_lock(lock_); 2617 base::AutoLock auto_lock(lock_);
2614 if (valid_thread_id_ != base::kInvalidThreadId) 2618 if (valid_thread_id_ != base::kInvalidThreadId)
2615 return; 2619 return;
2616 valid_thread_id_ = base::PlatformThread::CurrentId(); 2620 valid_thread_id_ = base::PlatformThread::CurrentId();
2617 } 2621 }
2618 2622
2619 bool SSLClientSocketNSS::CalledOnValidThread() const { 2623 bool SSLClientSocketNSS::CalledOnValidThread() const {
2620 EnsureThreadIdAssigned(); 2624 EnsureThreadIdAssigned();
2621 base::AutoLock auto_lock(lock_); 2625 base::AutoLock auto_lock(lock_);
2622 return valid_thread_id_ == base::PlatformThread::CurrentId(); 2626 return valid_thread_id_ == base::PlatformThread::CurrentId();
2623 } 2627 }
2624 2628
2625 } // namespace net 2629 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698