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

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

Issue 213363003: Delete some dead code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « net/cert/x509_certificate_mac.cc ('k') | tools/gn/builder_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 // 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 326
327 // Returns the current certificate chain as a vector of DER-encoded 327 // Returns the current certificate chain as a vector of DER-encoded
328 // base::StringPieces. The returned vector remains valid until Reset is 328 // base::StringPieces. The returned vector remains valid until Reset is
329 // called. 329 // called.
330 std::vector<base::StringPiece> AsStringPieceVector() const; 330 std::vector<base::StringPiece> AsStringPieceVector() const;
331 331
332 bool empty() const { return certs_.empty(); } 332 bool empty() const { return certs_.empty(); }
333 size_t size() const { return certs_.size(); } 333 size_t size() const { return certs_.size(); }
334 334
335 CERTCertificate* operator[](size_t index) const { 335 CERTCertificate* operator[](size_t index) const {
336 DCHECK_LT(index, certs_.size()); 336 DCHECK_LT(index, size());
337 return certs_[index]; 337 return certs_[index];
338 } 338 }
339 339
340 private: 340 private:
341 std::vector<CERTCertificate*> certs_; 341 std::vector<CERTCertificate*> certs_;
342 }; 342 };
343 343
344 PeerCertificateChain::PeerCertificateChain( 344 PeerCertificateChain::PeerCertificateChain(
345 const PeerCertificateChain& other) { 345 const PeerCertificateChain& other) {
346 *this = other; 346 *this = other;
347 } 347 }
348 348
349 PeerCertificateChain::~PeerCertificateChain() { 349 PeerCertificateChain::~PeerCertificateChain() {
350 Reset(NULL); 350 Reset(NULL);
351 } 351 }
352 352
353 PeerCertificateChain& PeerCertificateChain::operator=( 353 PeerCertificateChain& PeerCertificateChain::operator=(
354 const PeerCertificateChain& other) { 354 const PeerCertificateChain& other) {
355 if (this == &other) 355 if (this == &other)
356 return *this; 356 return *this;
357 357
358 Reset(NULL); 358 Reset(NULL);
359 certs_.reserve(other.certs_.size()); 359 certs_.reserve(other.size());
360 for (size_t i = 0; i < other.certs_.size(); ++i) 360 for (size_t i = 0; i < other.size(); ++i)
Ryan Sleevi 2014/03/26 21:22:45 This = not lgtm Not sure why Clang griped about t
Nico 2014/03/26 21:35:12 Why is this? It calls others.size(), not this->siz
Ryan Sleevi 2014/03/26 21:42:20 Because it's inconsistently coupling implementatio
Nico 2014/03/26 21:43:52 Ok, deleted size() instead.
361 certs_.push_back(CERT_DupCertificate(other.certs_[i])); 361 certs_.push_back(CERT_DupCertificate(other.certs_[i]));
362 362
363 return *this; 363 return *this;
364 } 364 }
365 365
366 void PeerCertificateChain::Reset(PRFileDesc* nss_fd) { 366 void PeerCertificateChain::Reset(PRFileDesc* nss_fd) {
367 for (size_t i = 0; i < certs_.size(); ++i) 367 for (size_t i = 0; i < size(); ++i)
368 CERT_DestroyCertificate(certs_[i]); 368 CERT_DestroyCertificate(certs_[i]);
369 certs_.clear(); 369 certs_.clear();
370 370
371 if (nss_fd == NULL) 371 if (nss_fd == NULL)
372 return; 372 return;
373 373
374 CERTCertList* list = SSL_PeerCertificateChain(nss_fd); 374 CERTCertList* list = SSL_PeerCertificateChain(nss_fd);
375 // The handshake on |nss_fd| may not have completed. 375 // The handshake on |nss_fd| may not have completed.
376 if (list == NULL) 376 if (list == NULL)
377 return; 377 return;
378 378
379 for (CERTCertListNode* node = CERT_LIST_HEAD(list); 379 for (CERTCertListNode* node = CERT_LIST_HEAD(list);
380 !CERT_LIST_END(node, list); node = CERT_LIST_NEXT(node)) { 380 !CERT_LIST_END(node, list); node = CERT_LIST_NEXT(node)) {
381 certs_.push_back(CERT_DupCertificate(node->cert)); 381 certs_.push_back(CERT_DupCertificate(node->cert));
382 } 382 }
383 CERT_DestroyCertList(list); 383 CERT_DestroyCertList(list);
384 } 384 }
385 385
386 std::vector<base::StringPiece> 386 std::vector<base::StringPiece>
387 PeerCertificateChain::AsStringPieceVector() const { 387 PeerCertificateChain::AsStringPieceVector() const {
388 std::vector<base::StringPiece> v(certs_.size()); 388 std::vector<base::StringPiece> v(size());
389 for (unsigned i = 0; i < certs_.size(); i++) { 389 for (unsigned i = 0; i < size(); i++) {
Ryan Sleevi 2014/03/26 21:22:45 Ditto this - inconsistent with using certs_[i] imm
Nico 2014/03/26 21:35:12 Ditto "I don't understand" :-)
390 v[i] = base::StringPiece( 390 v[i] = base::StringPiece(
391 reinterpret_cast<const char*>(certs_[i]->derCert.data), 391 reinterpret_cast<const char*>(certs_[i]->derCert.data),
392 certs_[i]->derCert.len); 392 certs_[i]->derCert.len);
393 } 393 }
394 394
395 return v; 395 return v;
396 } 396 }
397 397
398 // HandshakeState is a helper struct used to pass handshake state between 398 // HandshakeState is a helper struct used to pass handshake state between
399 // the NSS task runner and the network task runner. 399 // the NSS task runner and the network task runner.
(...skipping 3192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3592 scoped_refptr<X509Certificate> 3592 scoped_refptr<X509Certificate>
3593 SSLClientSocketNSS::GetUnverifiedServerCertificateChain() const { 3593 SSLClientSocketNSS::GetUnverifiedServerCertificateChain() const {
3594 return core_->state().server_cert.get(); 3594 return core_->state().server_cert.get();
3595 } 3595 }
3596 3596
3597 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { 3597 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const {
3598 return server_bound_cert_service_; 3598 return server_bound_cert_service_;
3599 } 3599 }
3600 3600
3601 } // namespace net 3601 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_mac.cc ('k') | tools/gn/builder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698