Index: net/base/multi_threaded_cert_verifier.h |
diff --git a/net/base/multi_threaded_cert_verifier.h b/net/base/multi_threaded_cert_verifier.h |
index 632ae443370f5a3fa1180dd830db63518f284ab4..d901bfcbcfb042dd6cd5a2fe569b5b7a4be0454f 100644 |
--- a/net/base/multi_threaded_cert_verifier.h |
+++ b/net/base/multi_threaded_cert_verifier.h |
@@ -108,6 +108,31 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier |
CertVerifyResult result; // The output of CertVerifier::Verify. |
}; |
+ // Rather than having a single validity point along a monotonically increasing |
+ // timeline, certificate verification is based on falling within a range of |
+ // the certificate's NotBefore and NotAfter and based on what the current |
+ // system clock says (which may advance forwards or backwards as users correct |
+ // clock skew). CacheValidityPeriod and CacheExpirationFunctor are helpers to |
+ // ensure that expiration is measured both by the 'general' case (now + cache |
+ // TTL) and by whether or not significant enough clock skew was introduced |
+ // since the last verification. |
+ struct CacheValidityPeriod { |
+ explicit CacheValidityPeriod(const base::Time& now); |
+ CacheValidityPeriod(const base::Time& now, const base::Time& expiration); |
+ |
+ base::Time verification_time; |
+ base::Time expiration_time; |
+ }; |
+ |
+ struct CacheExpirationFunctor { |
+ // Returns true iff |now| is within the validity period of |expiration|. |
+ bool operator()(const CacheValidityPeriod& now, |
+ const CacheValidityPeriod& expiration) const; |
+ }; |
+ |
+ typedef ExpiringCache<RequestParams, CachedResult, CacheValidityPeriod, |
+ CacheExpirationFunctor> CertVerifierCache; |
+ |
void HandleResult(X509Certificate* cert, |
const std::string& hostname, |
int flags, |
@@ -126,7 +151,6 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier |
void SetCertVerifyProc(CertVerifyProc* verify_proc); |
// cache_ maps from a request to a cached result. |
- typedef ExpiringCache<RequestParams, CachedResult> CertVerifierCache; |
CertVerifierCache cache_; |
// inflight_ maps from a request to an active verification which is taking |