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

Side by Side Diff: net/cert/multi_threaded_cert_verifier.h

Issue 1994353002: Update CertVerifier::Verify to use RequestParams instead (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@request_params
Patch Set: Rebased Created 4 years, 6 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 | « net/cert/mock_cert_verifier.cc ('k') | net/cert/multi_threaded_cert_verifier.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 #ifndef NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ 5 #ifndef NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_
6 #define NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ 6 #define NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // trust anchors during verification, provided that the underlying 51 // trust anchors during verification, provided that the underlying
52 // CertVerifyProc supports additional trust beyond the default implementation. 52 // CertVerifyProc supports additional trust beyond the default implementation.
53 // The CertTrustAnchorProvider will only be accessed on the same 53 // The CertTrustAnchorProvider will only be accessed on the same
54 // thread that Verify() is called on; that is, it will not be 54 // thread that Verify() is called on; that is, it will not be
55 // accessed from worker threads. 55 // accessed from worker threads.
56 // It must outlive the MultiThreadedCertVerifier. 56 // It must outlive the MultiThreadedCertVerifier.
57 void SetCertTrustAnchorProvider( 57 void SetCertTrustAnchorProvider(
58 CertTrustAnchorProvider* trust_anchor_provider); 58 CertTrustAnchorProvider* trust_anchor_provider);
59 59
60 // CertVerifier implementation 60 // CertVerifier implementation
61 int Verify(X509Certificate* cert, 61 int Verify(const RequestParams& params,
62 const std::string& hostname,
63 const std::string& ocsp_response,
64 int flags,
65 CRLSet* crl_set, 62 CRLSet* crl_set,
66 CertVerifyResult* verify_result, 63 CertVerifyResult* verify_result,
67 const CompletionCallback& callback, 64 const CompletionCallback& callback,
68 std::unique_ptr<Request>* out_req, 65 std::unique_ptr<Request>* out_req,
69 const BoundNetLog& net_log) override; 66 const BoundNetLog& net_log) override;
70 67
71 bool SupportsOCSPStapling() override; 68 bool SupportsOCSPStapling() override;
72 69
73 private: 70 private:
74 struct JobToRequestParamsComparator; 71 struct JobToRequestParamsComparator;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 bool operator()(const CacheValidityPeriod& now, 112 bool operator()(const CacheValidityPeriod& now,
116 const CacheValidityPeriod& expiration) const; 113 const CacheValidityPeriod& expiration) const;
117 }; 114 };
118 115
119 struct JobComparator { 116 struct JobComparator {
120 bool operator()(const CertVerifierJob* job1, 117 bool operator()(const CertVerifierJob* job1,
121 const CertVerifierJob* job2) const; 118 const CertVerifierJob* job2) const;
122 }; 119 };
123 120
124 using JobSet = std::set<CertVerifierJob*, JobComparator>; 121 using JobSet = std::set<CertVerifierJob*, JobComparator>;
125 using CertVerifierCache = ExpiringCache<CertVerifier::RequestParams, 122 using CertVerifierCache = ExpiringCache<RequestParams,
126 CachedResult, 123 CachedResult,
127 CacheValidityPeriod, 124 CacheValidityPeriod,
128 CacheExpirationFunctor>; 125 CacheExpirationFunctor>;
129 126
130 // Saves |result| into the cache, keyed by |key|, which began validation at 127 // Saves |result| into the cache, keyed by |key|, which began validation at
131 // |start_time|. 128 // |start_time|.
132 void SaveResultToCache(const CertVerifier::RequestParams& key, 129 void SaveResultToCache(const RequestParams& key,
133 const base::Time& start_time, 130 const base::Time& start_time,
134 const CachedResult& result); 131 const CachedResult& result);
135 132
136 // CertDatabase::Observer methods: 133 // CertDatabase::Observer methods:
137 void OnCACertChanged(const X509Certificate* cert) override; 134 void OnCACertChanged(const X509Certificate* cert) override;
138 135
139 // Returns an inflight job for |key|. If there is no such job then returns 136 // Returns an inflight job for |key|. If there is no such job then returns
140 // null. 137 // null.
141 CertVerifierJob* FindJob(const CertVerifier::RequestParams& key); 138 CertVerifierJob* FindJob(const RequestParams& key);
142 139
143 // Removes |job| from the inflight set, and passes ownership back to the 140 // Removes |job| from the inflight set, and passes ownership back to the
144 // caller. |job| must already be |inflight_|. 141 // caller. |job| must already be |inflight_|.
145 std::unique_ptr<CertVerifierJob> RemoveJob(CertVerifierJob* job); 142 std::unique_ptr<CertVerifierJob> RemoveJob(CertVerifierJob* job);
146 143
147 // For unit testing. 144 // For unit testing.
148 void ClearCache() { cache_.Clear(); } 145 void ClearCache() { cache_.Clear(); }
149 size_t GetCacheSize() const { return cache_.size(); } 146 size_t GetCacheSize() const { return cache_.size(); }
150 uint64_t cache_hits() const { return cache_hits_; } 147 uint64_t cache_hits() const { return cache_hits_; }
151 uint64_t requests() const { return requests_; } 148 uint64_t requests() const { return requests_; }
(...skipping 12 matching lines...) Expand all
164 scoped_refptr<CertVerifyProc> verify_proc_; 161 scoped_refptr<CertVerifyProc> verify_proc_;
165 162
166 CertTrustAnchorProvider* trust_anchor_provider_; 163 CertTrustAnchorProvider* trust_anchor_provider_;
167 164
168 DISALLOW_COPY_AND_ASSIGN(MultiThreadedCertVerifier); 165 DISALLOW_COPY_AND_ASSIGN(MultiThreadedCertVerifier);
169 }; 166 };
170 167
171 } // namespace net 168 } // namespace net
172 169
173 #endif // NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ 170 #endif // NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_
OLDNEW
« no previous file with comments | « net/cert/mock_cert_verifier.cc ('k') | net/cert/multi_threaded_cert_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698