Index: net/cert/cert_verifier.cc |
diff --git a/net/cert/cert_verifier.cc b/net/cert/cert_verifier.cc |
index 054edb561ff1826357a63c7a88532ccb9e710995..c308e93ebbdd61bd7d7c9f17c26302e06a706f62 100644 |
--- a/net/cert/cert_verifier.cc |
+++ b/net/cert/cert_verifier.cc |
@@ -4,9 +4,11 @@ |
#include "net/cert/cert_verifier.h" |
+#include <algorithm> |
#include <memory> |
#include "base/memory/ptr_util.h" |
+#include "base/sha1.h" |
#include "build/build_config.h" |
#include "net/cert/cert_verify_proc.h" |
@@ -18,6 +20,43 @@ |
namespace net { |
+CertVerifier::RequestParams::RequestParams( |
+ X509Certificate* certificate, |
+ const std::string& hostname, |
+ int flags, |
+ const std::string& ocsp_response, |
+ const CertificateList& additional_trust_anchors) |
+ : hostname_(hostname), flags_(flags) { |
+ // Rather than store all of the original data, create a fingerprint based |
+ // on the hash of the request data. |
+ SHA1HashValue ocsp_hash; |
+ base::SHA1HashBytes( |
+ reinterpret_cast<const unsigned char*>(ocsp_response.data()), |
+ ocsp_response.size(), ocsp_hash.data); |
+ |
+ request_data_.reserve(additional_trust_anchors.size() + 3); |
+ request_data_.push_back(ocsp_hash); |
+ request_data_.push_back(certificate->fingerprint()); |
+ request_data_.push_back(certificate->ca_fingerprint()); |
+ for (const auto& trust_anchor : additional_trust_anchors) |
+ request_data_.push_back(trust_anchor->fingerprint()); |
+} |
+ |
+CertVerifier::RequestParams::RequestParams(const RequestParams& other) = |
+ default; |
+CertVerifier::RequestParams::~RequestParams() {} |
+ |
+bool CertVerifier::RequestParams::operator<( |
+ const CertVerifier::RequestParams& other) const { |
+ if (flags_ != other.flags_) |
+ return flags_ < other.flags_; |
+ if (hostname_ != other.hostname_) |
+ return hostname_ < other.hostname_; |
+ return std::lexicographical_compare( |
+ request_data_.begin(), request_data_.end(), other.request_data_.begin(), |
+ other.request_data_.end(), SHA1HashValueLessThan()); |
+} |
+ |
bool CertVerifier::SupportsOCSPStapling() { |
return false; |
} |