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/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) |
11 #include <cryptohi.h> | 11 #include <cryptohi.h> |
12 #include <hasht.h> | 12 #include <hasht.h> |
13 #include <keyhi.h> | 13 #include <keyhi.h> |
| 14 #include <nspr.h> |
14 #include <pk11pub.h> | 15 #include <pk11pub.h> |
15 #include <nspr.h> | |
16 #endif | 16 #endif |
17 | 17 |
18 #include <algorithm> | 18 #include <algorithm> |
19 | 19 |
20 #include "base/base64.h" | 20 #include "base/base64.h" |
21 #include "base/build_time.h" | 21 #include "base/build_time.h" |
22 #include "base/logging.h" | 22 #include "base/logging.h" |
23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
24 #include "base/metrics/histogram.h" | 24 #include "base/metrics/histogram.h" |
25 #include "base/sha1.h" | 25 #include "base/sha1.h" |
26 #include "base/string_number_conversions.h" | 26 #include "base/string_number_conversions.h" |
27 #include "base/string_util.h" | 27 #include "base/string_util.h" |
28 #include "base/time.h" | 28 #include "base/time.h" |
29 #include "base/utf_string_conversions.h" | 29 #include "base/utf_string_conversions.h" |
30 #include "base/values.h" | 30 #include "base/values.h" |
31 #include "crypto/sha2.h" | 31 #include "crypto/sha2.h" |
32 #include "googleurl/src/gurl.h" | 32 #include "googleurl/src/gurl.h" |
33 #include "net/base/dns_util.h" | 33 #include "net/base/dns_util.h" |
34 #include "net/base/ssl_info.h" | |
35 #include "net/base/x509_cert_types.h" | 34 #include "net/base/x509_cert_types.h" |
36 #include "net/base/x509_certificate.h" | 35 #include "net/base/x509_certificate.h" |
37 #include "net/http/http_security_headers.h" | 36 #include "net/http/http_security_headers.h" |
| 37 #include "net/ssl/ssl_info.h" |
38 | 38 |
39 #if defined(USE_OPENSSL) | 39 #if defined(USE_OPENSSL) |
40 #include "crypto/openssl_util.h" | 40 #include "crypto/openssl_util.h" |
41 #endif | 41 #endif |
42 | 42 |
43 namespace net { | 43 namespace net { |
44 | 44 |
45 namespace { | 45 namespace { |
46 | 46 |
47 std::string HashesToBase64String(const HashValueVector& hashes) { | 47 std::string HashesToBase64String(const HashValueVector& hashes) { |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 sha1_hash++; | 575 sha1_hash++; |
576 } | 576 } |
577 } | 577 } |
578 } | 578 } |
579 return true; | 579 return true; |
580 } | 580 } |
581 } | 581 } |
582 return false; | 582 return false; |
583 } | 583 } |
584 | 584 |
585 #include "net/base/transport_security_state_static.h" | 585 #include "net/http/transport_security_state_static.h" |
586 | 586 |
587 // Returns the HSTSPreload entry for the |canonicalized_host| in |entries|, | 587 // Returns the HSTSPreload entry for the |canonicalized_host| in |entries|, |
588 // or NULL if there is none. Prefers exact hostname matches to those that | 588 // or NULL if there is none. Prefers exact hostname matches to those that |
589 // match only because HSTSPreload.include_subdomains is true. | 589 // match only because HSTSPreload.include_subdomains is true. |
590 // | 590 // |
591 // |canonicalized_host| should be the hostname as canonicalized by | 591 // |canonicalized_host| should be the hostname as canonicalized by |
592 // CanonicalizeHost. | 592 // CanonicalizeHost. |
593 static const struct HSTSPreload* GetHSTSPreload( | 593 static const struct HSTSPreload* GetHSTSPreload( |
594 const std::string& canonicalized_host, | 594 const std::string& canonicalized_host, |
595 const struct HSTSPreload* entries, | 595 const struct HSTSPreload* entries, |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 return true; | 845 return true; |
846 } | 846 } |
847 | 847 |
848 bool TransportSecurityState::DomainState::HasPublicKeyPins() const { | 848 bool TransportSecurityState::DomainState::HasPublicKeyPins() const { |
849 return static_spki_hashes.size() > 0 || | 849 return static_spki_hashes.size() > 0 || |
850 bad_static_spki_hashes.size() > 0 || | 850 bad_static_spki_hashes.size() > 0 || |
851 dynamic_spki_hashes.size() > 0; | 851 dynamic_spki_hashes.size() > 0; |
852 } | 852 } |
853 | 853 |
854 } // namespace | 854 } // namespace |
OLD | NEW |