OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |