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

Unified Diff: net/cert/cert_verifier.cc

Issue 1987113002: Introduce CertVerifier::RequestParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add NET_EXPORT Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/cert_verifier.h ('k') | net/cert/cert_verifier_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « net/cert/cert_verifier.h ('k') | net/cert/cert_verifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698