| 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 #ifndef NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_ | 5 #ifndef NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_ |
| 6 #define NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_ | 6 #define NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 friend class MultiThreadedCertVerifierTest; | 59 friend class MultiThreadedCertVerifierTest; |
| 60 FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, CacheHit); | 60 FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, CacheHit); |
| 61 FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, DifferentCACerts); | 61 FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, DifferentCACerts); |
| 62 FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, InflightJoin); | 62 FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, InflightJoin); |
| 63 FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, CancelRequest); | 63 FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, CancelRequest); |
| 64 FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, | 64 FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, |
| 65 RequestParamsComparators); | 65 RequestParamsComparators); |
| 66 | 66 |
| 67 // Input parameters of a certificate verification request. | 67 // Input parameters of a certificate verification request. |
| 68 struct NET_EXPORT_PRIVATE RequestParams { | 68 struct NET_EXPORT_PRIVATE RequestParams { |
| 69 RequestParams(const SHA1Fingerprint& cert_fingerprint_arg, | 69 RequestParams(const SHA1HashValue& cert_fingerprint_arg, |
| 70 const SHA1Fingerprint& ca_fingerprint_arg, | 70 const SHA1HashValue& ca_fingerprint_arg, |
| 71 const std::string& hostname_arg, | 71 const std::string& hostname_arg, |
| 72 int flags_arg); | 72 int flags_arg); |
| 73 | 73 |
| 74 bool operator<(const RequestParams& other) const { | 74 bool operator<(const RequestParams& other) const { |
| 75 // |flags| is compared before |cert_fingerprint|, |ca_fingerprint|, and | 75 // |flags| is compared before |cert_fingerprint|, |ca_fingerprint|, and |
| 76 // |hostname| under assumption that integer comparisons are faster than | 76 // |hostname| under assumption that integer comparisons are faster than |
| 77 // memory and string comparisons. | 77 // memory and string comparisons. |
| 78 if (flags != other.flags) | 78 if (flags != other.flags) |
| 79 return flags < other.flags; | 79 return flags < other.flags; |
| 80 int rv = memcmp(cert_fingerprint.data, other.cert_fingerprint.data, | 80 int rv = memcmp(cert_fingerprint.data, other.cert_fingerprint.data, |
| 81 sizeof(cert_fingerprint.data)); | 81 sizeof(cert_fingerprint.data)); |
| 82 if (rv != 0) | 82 if (rv != 0) |
| 83 return rv < 0; | 83 return rv < 0; |
| 84 rv = memcmp(ca_fingerprint.data, other.ca_fingerprint.data, | 84 rv = memcmp(ca_fingerprint.data, other.ca_fingerprint.data, |
| 85 sizeof(ca_fingerprint.data)); | 85 sizeof(ca_fingerprint.data)); |
| 86 if (rv != 0) | 86 if (rv != 0) |
| 87 return rv < 0; | 87 return rv < 0; |
| 88 return hostname < other.hostname; | 88 return hostname < other.hostname; |
| 89 } | 89 } |
| 90 | 90 |
| 91 SHA1Fingerprint cert_fingerprint; | 91 SHA1HashValue cert_fingerprint; |
| 92 SHA1Fingerprint ca_fingerprint; | 92 SHA1HashValue ca_fingerprint; |
| 93 std::string hostname; | 93 std::string hostname; |
| 94 int flags; | 94 int flags; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 // CachedResult contains the result of a certificate verification. | 97 // CachedResult contains the result of a certificate verification. |
| 98 struct CachedResult { | 98 struct CachedResult { |
| 99 CachedResult(); | 99 CachedResult(); |
| 100 ~CachedResult(); | 100 ~CachedResult(); |
| 101 | 101 |
| 102 int error; // The return value of CertVerifier::Verify. | 102 int error; // The return value of CertVerifier::Verify. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 uint64 inflight_joins_; | 157 uint64 inflight_joins_; |
| 158 | 158 |
| 159 scoped_refptr<CertVerifyProc> verify_proc_; | 159 scoped_refptr<CertVerifyProc> verify_proc_; |
| 160 | 160 |
| 161 DISALLOW_COPY_AND_ASSIGN(MultiThreadedCertVerifier); | 161 DISALLOW_COPY_AND_ASSIGN(MultiThreadedCertVerifier); |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 } // namespace net | 164 } // namespace net |
| 165 | 165 |
| 166 #endif // NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_ | 166 #endif // NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_ |
| OLD | NEW |