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

Side by Side Diff: net/http/transport_security_state.cc

Issue 663903002: net: fix bug in compact HSTS representation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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/http/transport_security_state_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 #include "net/http/transport_security_state.h" 5 #include "net/http/transport_security_state.h"
6 6
7 #if defined(USE_OPENSSL) 7 #if defined(USE_OPENSSL)
8 #include <openssl/ecdsa.h> 8 #include <openssl/ecdsa.h>
9 #include <openssl/ssl.h> 9 #include <openssl/ssl.h>
10 #else // !defined(USE_OPENSSL) 10 #else // !defined(USE_OPENSSL)
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 545
546 if (is_first_offset) { 546 if (is_first_offset) {
547 // The first offset is backwards from the current position. 547 // The first offset is backwards from the current position.
548 uint32 jump_delta_bits; 548 uint32 jump_delta_bits;
549 uint32 jump_delta; 549 uint32 jump_delta;
550 if (!reader.Read(5, &jump_delta_bits) || 550 if (!reader.Read(5, &jump_delta_bits) ||
551 !reader.Read(jump_delta_bits, &jump_delta)) { 551 !reader.Read(jump_delta_bits, &jump_delta)) {
552 return false; 552 return false;
553 } 553 }
554 554
555 if (bit_offset <= jump_delta) { 555 if (bit_offset < jump_delta) {
556 return false; 556 return false;
557 } 557 }
558 558
559 current_offset = bit_offset - jump_delta; 559 current_offset = bit_offset - jump_delta;
560 is_first_offset = false; 560 is_first_offset = false;
561 } else { 561 } else {
562 // Subsequent offsets are forward from the target of the first offset. 562 // Subsequent offsets are forward from the target of the first offset.
563 uint32 is_long_jump; 563 uint32 is_long_jump;
564 if (!reader.Read(1, &is_long_jump)) { 564 if (!reader.Read(1, &is_long_jump)) {
565 return false; 565 return false;
(...skipping 25 matching lines...) Expand all
591 break; 591 break;
592 } 592 }
593 } 593 }
594 } 594 }
595 } 595 }
596 596
597 bool DecodeHSTSPreload(const std::string& hostname, 597 bool DecodeHSTSPreload(const std::string& hostname,
598 PreloadResult* out) { 598 PreloadResult* out) {
599 bool found; 599 bool found;
600 if (!DecodeHSTSPreloadRaw(hostname, &found, out)) { 600 if (!DecodeHSTSPreloadRaw(hostname, &found, out)) {
601 LOG(ERROR) << "Internal error in DecodeHSTSPreloadRaw for hostname " 601 DCHECK(false) << "Internal error in DecodeHSTSPreloadRaw for hostname "
602 << hostname; 602 << hostname;
603 return false; 603 return false;
604 } 604 }
605 605
606 return found; 606 return found;
607 } 607 }
608 608
609 bool TransportSecurityState::AddHSTSHeader(const std::string& host, 609 bool TransportSecurityState::AddHSTSHeader(const std::string& host,
610 const std::string& value) { 610 const std::string& value) {
611 DCHECK(CalledOnValidThread()); 611 DCHECK(CalledOnValidThread());
612 612
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 return pkp.spki_hashes.size() > 0 || pkp.bad_spki_hashes.size() > 0; 899 return pkp.spki_hashes.size() > 0 || pkp.bad_spki_hashes.size() > 0;
900 } 900 }
901 901
902 TransportSecurityState::DomainState::PKPState::PKPState() { 902 TransportSecurityState::DomainState::PKPState::PKPState() {
903 } 903 }
904 904
905 TransportSecurityState::DomainState::PKPState::~PKPState() { 905 TransportSecurityState::DomainState::PKPState::~PKPState() {
906 } 906 }
907 907
908 } // namespace 908 } // namespace
OLDNEW
« no previous file with comments | « no previous file | net/http/transport_security_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698