OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/quic/crypto/proof_verifier_chromium.h" | 5 #include "net/quic/crypto/proof_verifier_chromium.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // will notify the ProofVerifier upon completion. | 48 // will notify the ProofVerifier upon completion. |
49 class ProofVerifierChromium::Job { | 49 class ProofVerifierChromium::Job { |
50 public: | 50 public: |
51 Job(ProofVerifierChromium* proof_verifier, | 51 Job(ProofVerifierChromium* proof_verifier, |
52 CertVerifier* cert_verifier, | 52 CertVerifier* cert_verifier, |
53 CertPolicyEnforcer* cert_policy_enforcer, | 53 CertPolicyEnforcer* cert_policy_enforcer, |
54 TransportSecurityState* transport_security_state, | 54 TransportSecurityState* transport_security_state, |
55 CTVerifier* cert_transparency_verifier, | 55 CTVerifier* cert_transparency_verifier, |
56 int cert_verify_flags, | 56 int cert_verify_flags, |
57 const BoundNetLog& net_log); | 57 const BoundNetLog& net_log); |
| 58 ~Job(); |
58 | 59 |
59 // Starts the proof verification. If |QUIC_PENDING| is returned, then | 60 // Starts the proof verification. If |QUIC_PENDING| is returned, then |
60 // |callback| will be invoked asynchronously when the verification completes. | 61 // |callback| will be invoked asynchronously when the verification completes. |
61 QuicAsyncStatus VerifyProof(const std::string& hostname, | 62 QuicAsyncStatus VerifyProof(const std::string& hostname, |
62 const std::string& server_config, | 63 const std::string& server_config, |
63 const std::vector<std::string>& certs, | 64 const std::vector<std::string>& certs, |
64 const std::string& cert_sct, | 65 const std::string& cert_sct, |
65 const std::string& signature, | 66 const std::string& signature, |
66 std::string* error_details, | 67 std::string* error_details, |
67 scoped_ptr<ProofVerifyDetails>* verify_details, | 68 scoped_ptr<ProofVerifyDetails>* verify_details, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 // X509Certificate from a chain of DER encoded certificates. | 107 // X509Certificate from a chain of DER encoded certificates. |
107 scoped_refptr<X509Certificate> cert_; | 108 scoped_refptr<X509Certificate> cert_; |
108 | 109 |
109 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is | 110 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is |
110 // passed to CertVerifier::Verify. | 111 // passed to CertVerifier::Verify. |
111 int cert_verify_flags_; | 112 int cert_verify_flags_; |
112 | 113 |
113 State next_state_; | 114 State next_state_; |
114 | 115 |
| 116 base::TimeTicks start_time_; |
| 117 |
115 BoundNetLog net_log_; | 118 BoundNetLog net_log_; |
116 | 119 |
117 DISALLOW_COPY_AND_ASSIGN(Job); | 120 DISALLOW_COPY_AND_ASSIGN(Job); |
118 }; | 121 }; |
119 | 122 |
120 ProofVerifierChromium::Job::Job( | 123 ProofVerifierChromium::Job::Job( |
121 ProofVerifierChromium* proof_verifier, | 124 ProofVerifierChromium* proof_verifier, |
122 CertVerifier* cert_verifier, | 125 CertVerifier* cert_verifier, |
123 CertPolicyEnforcer* cert_policy_enforcer, | 126 CertPolicyEnforcer* cert_policy_enforcer, |
124 TransportSecurityState* transport_security_state, | 127 TransportSecurityState* transport_security_state, |
125 CTVerifier* cert_transparency_verifier, | 128 CTVerifier* cert_transparency_verifier, |
126 int cert_verify_flags, | 129 int cert_verify_flags, |
127 const BoundNetLog& net_log) | 130 const BoundNetLog& net_log) |
128 : proof_verifier_(proof_verifier), | 131 : proof_verifier_(proof_verifier), |
129 verifier_(cert_verifier), | 132 verifier_(cert_verifier), |
130 policy_enforcer_(cert_policy_enforcer), | 133 policy_enforcer_(cert_policy_enforcer), |
131 transport_security_state_(transport_security_state), | 134 transport_security_state_(transport_security_state), |
132 cert_transparency_verifier_(cert_transparency_verifier), | 135 cert_transparency_verifier_(cert_transparency_verifier), |
133 cert_verify_flags_(cert_verify_flags), | 136 cert_verify_flags_(cert_verify_flags), |
134 next_state_(STATE_NONE), | 137 next_state_(STATE_NONE), |
| 138 start_time_(base::TimeTicks::Now()), |
135 net_log_(net_log) {} | 139 net_log_(net_log) {} |
136 | 140 |
| 141 ProofVerifierChromium::Job::~Job() { |
| 142 base::TimeTicks end_time = base::TimeTicks::Now(); |
| 143 UMA_HISTOGRAM_TIMES("Net.QuicSession.VerifyProofTime", |
| 144 end_time - start_time_); |
| 145 // |hostname_| will always be canonicalized to lowercase. |
| 146 if (hostname_.compare("www.google.com") == 0) { |
| 147 UMA_HISTOGRAM_TIMES("Net.QuicSession.VerifyProofTime.google", |
| 148 end_time - start_time_); |
| 149 } |
| 150 } |
| 151 |
137 QuicAsyncStatus ProofVerifierChromium::Job::VerifyProof( | 152 QuicAsyncStatus ProofVerifierChromium::Job::VerifyProof( |
138 const string& hostname, | 153 const string& hostname, |
139 const string& server_config, | 154 const string& server_config, |
140 const vector<string>& certs, | 155 const vector<string>& certs, |
141 const std::string& cert_sct, | 156 const std::string& cert_sct, |
142 const string& signature, | 157 const string& signature, |
143 std::string* error_details, | 158 std::string* error_details, |
144 scoped_ptr<ProofVerifyDetails>* verify_details, | 159 scoped_ptr<ProofVerifyDetails>* verify_details, |
145 ProofVerifierCallback* callback) { | 160 ProofVerifierCallback* callback) { |
146 DCHECK(error_details); | 161 DCHECK(error_details); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 434 } |
420 return status; | 435 return status; |
421 } | 436 } |
422 | 437 |
423 void ProofVerifierChromium::OnJobComplete(Job* job) { | 438 void ProofVerifierChromium::OnJobComplete(Job* job) { |
424 active_jobs_.erase(job); | 439 active_jobs_.erase(job); |
425 delete job; | 440 delete job; |
426 } | 441 } |
427 | 442 |
428 } // namespace net | 443 } // namespace net |
OLD | NEW |