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

Unified Diff: net/base/x509_cert_types.cc

Issue 11274032: Separate http_security_headers from transport_security_state (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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/base/x509_cert_types.h ('k') | net/http/http_security_headers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/x509_cert_types.cc
===================================================================
--- net/base/x509_cert_types.cc (revision 175486)
+++ net/base/x509_cert_types.cc (working copy)
@@ -8,7 +8,6 @@
#include <cstring>
#include "base/logging.h"
-#include "base/sha1.h"
#include "base/string_number_conversions.h"
#include "base/string_piece.h"
#include "base/time.h"
@@ -29,24 +28,8 @@
return result;
}
-// CompareSHA1Hashes is a helper function for using bsearch() with an array of
-// SHA1 hashes.
-int CompareSHA1Hashes(const void* a, const void* b) {
- return memcmp(a, b, base::kSHA1Length);
}
-} // namespace
-
-// static
-bool IsSHA1HashInSortedArray(const SHA1HashValue& hash,
- const uint8* array,
- size_t array_byte_len) {
- DCHECK_EQ(0u, array_byte_len % base::kSHA1Length);
- const size_t arraylen = array_byte_len / base::kSHA1Length;
- return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length,
- CompareSHA1Hashes);
-}
-
CertPrincipal::CertPrincipal() {
}
@@ -143,52 +126,4 @@
return true;
}
-bool HashValue::Equals(const HashValue& other) const {
- if (tag != other.tag)
- return false;
- switch (tag) {
- case HASH_VALUE_SHA1:
- return fingerprint.sha1.Equals(other.fingerprint.sha1);
- case HASH_VALUE_SHA256:
- return fingerprint.sha256.Equals(other.fingerprint.sha256);
- default:
- NOTREACHED() << "Unknown HashValueTag " << tag;
- return false;
- }
-}
-
-size_t HashValue::size() const {
- switch (tag) {
- case HASH_VALUE_SHA1:
- return sizeof(fingerprint.sha1.data);
- case HASH_VALUE_SHA256:
- return sizeof(fingerprint.sha256.data);
- default:
- NOTREACHED() << "Unknown HashValueTag " << tag;
- // Although this is NOTREACHED, this function might be inlined and its
- // return value can be passed to memset as the length argument. If we
- // returned 0 here, it might result in what appears (in some stages of
- // compilation) to be a call to to memset with a length argument of 0,
- // which results in a warning. Therefore, we return a dummy value
- // here.
- return sizeof(fingerprint.sha1.data);
- }
-}
-
-unsigned char* HashValue::data() {
- return const_cast<unsigned char*>(const_cast<const HashValue*>(this)->data());
-}
-
-const unsigned char* HashValue::data() const {
- switch (tag) {
- case HASH_VALUE_SHA1:
- return fingerprint.sha1.data;
- case HASH_VALUE_SHA256:
- return fingerprint.sha256.data;
- default:
- NOTREACHED() << "Unknown HashValueTag " << tag;
- return NULL;
- }
-}
-
} // namespace net
« no previous file with comments | « net/base/x509_cert_types.h ('k') | net/http/http_security_headers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698