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/base/transport_security_state.h" | 5 #include "net/base/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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 static std::string HashHost(const std::string& canonicalized_host) { | 47 static std::string HashHost(const std::string& canonicalized_host) { |
48 char hashed[crypto::kSHA256Length]; | 48 char hashed[crypto::kSHA256Length]; |
49 crypto::SHA256HashString(canonicalized_host, hashed, sizeof(hashed)); | 49 crypto::SHA256HashString(canonicalized_host, hashed, sizeof(hashed)); |
50 return std::string(hashed, sizeof(hashed)); | 50 return std::string(hashed, sizeof(hashed)); |
51 } | 51 } |
52 | 52 |
53 TransportSecurityState::TransportSecurityState() | 53 TransportSecurityState::TransportSecurityState() |
54 : delegate_(NULL) { | 54 : delegate_(NULL) { |
55 } | 55 } |
56 | 56 |
| 57 TransportSecurityState::Iterator::Iterator(const TransportSecurityState& state) |
| 58 : iterator_(state.enabled_hosts_.begin()), |
| 59 end_(state.enabled_hosts_.end()) { |
| 60 } |
| 61 |
| 62 TransportSecurityState::Iterator::~Iterator() {} |
| 63 |
57 void TransportSecurityState::SetDelegate( | 64 void TransportSecurityState::SetDelegate( |
58 TransportSecurityState::Delegate* delegate) { | 65 TransportSecurityState::Delegate* delegate) { |
59 delegate_ = delegate; | 66 delegate_ = delegate; |
60 } | 67 } |
61 | 68 |
62 void TransportSecurityState::EnableHost(const std::string& host, | 69 void TransportSecurityState::EnableHost(const std::string& host, |
63 const DomainState& state) { | 70 const DomainState& state) { |
64 DCHECK(CalledOnValidThread()); | 71 DCHECK(CalledOnValidThread()); |
65 | 72 |
66 const std::string canonicalized_host = CanonicalizeHost(host); | 73 const std::string canonicalized_host = CanonicalizeHost(host); |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 return true; | 808 return true; |
802 } | 809 } |
803 | 810 |
804 bool TransportSecurityState::DomainState::HasPins() const { | 811 bool TransportSecurityState::DomainState::HasPins() const { |
805 return static_spki_hashes.size() > 0 || | 812 return static_spki_hashes.size() > 0 || |
806 bad_static_spki_hashes.size() > 0 || | 813 bad_static_spki_hashes.size() > 0 || |
807 dynamic_spki_hashes.size() > 0; | 814 dynamic_spki_hashes.size() > 0; |
808 } | 815 } |
809 | 816 |
810 } // namespace | 817 } // namespace |
OLD | NEW |