| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/cert_compressor.h" | 5 #include "net/quic/crypto/cert_compressor.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "net/quic/quic_utils.h" | 9 #include "net/quic/quic_utils.h" |
| 10 #include "third_party/zlib/zlib.h" | 10 #include "third_party/zlib/zlib.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 for (vector<string>::const_iterator i = certs.begin(); | 189 for (vector<string>::const_iterator i = certs.begin(); |
| 190 i != certs.end(); ++i) { | 190 i != certs.end(); ++i) { |
| 191 CertEntry entry; | 191 CertEntry entry; |
| 192 | 192 |
| 193 if (cached_valid) { | 193 if (cached_valid) { |
| 194 bool cached = false; | 194 bool cached = false; |
| 195 | 195 |
| 196 uint64 hash = QuicUtils::FNV1a_64_Hash(i->data(), i->size()); | 196 uint64 hash = QuicUtils::FNV1a_64_Hash(i->data(), i->size()); |
| 197 // This assumes that the machine is little-endian. | 197 // This assumes that the machine is little-endian. |
| 198 for (size_t i = 0; i < client_cached_cert_hashes.size(); | 198 for (size_t j = 0; j < client_cached_cert_hashes.size(); |
| 199 i += sizeof(uint64)) { | 199 j += sizeof(uint64)) { |
| 200 uint64 cached_hash; | 200 uint64 cached_hash; |
| 201 memcpy(&cached_hash, client_cached_cert_hashes.data() + i, | 201 memcpy(&cached_hash, client_cached_cert_hashes.data() + j, |
| 202 sizeof(uint64)); | 202 sizeof(uint64)); |
| 203 if (hash != cached_hash) { | 203 if (hash != cached_hash) { |
| 204 continue; | 204 continue; |
| 205 } | 205 } |
| 206 | 206 |
| 207 entry.type = CertEntry::CACHED; | 207 entry.type = CertEntry::CACHED; |
| 208 entry.hash = hash; | 208 entry.hash = hash; |
| 209 entries.push_back(entry); | 209 entries.push_back(entry); |
| 210 cached = true; | 210 cached = true; |
| 211 break; | 211 break; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 } | 637 } |
| 638 | 638 |
| 639 if (!uncompressed.empty()) { | 639 if (!uncompressed.empty()) { |
| 640 return false; | 640 return false; |
| 641 } | 641 } |
| 642 | 642 |
| 643 return true; | 643 return true; |
| 644 } | 644 } |
| 645 | 645 |
| 646 } // namespace net | 646 } // namespace net |
| OLD | NEW |