| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cert/crl_set_storage.h" | 5 #include "net/cert/crl_set_storage.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| 11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 12 #include "base/numerics/safe_conversions.h" | 12 #include "base/numerics/safe_conversions.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "crypto/sha2.h" | 16 #include "crypto/sha2.h" |
| 17 #include "net/base/trace_constants.h" |
| 17 #include "third_party/zlib/zlib.h" | 18 #include "third_party/zlib/zlib.h" |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 | 21 |
| 21 // Decompress zlib decompressed |in| into |out|. |out_len| is the number of | 22 // Decompress zlib decompressed |in| into |out|. |out_len| is the number of |
| 22 // bytes at |out| and must be exactly equal to the size of the decompressed | 23 // bytes at |out| and must be exactly equal to the size of the decompressed |
| 23 // data. | 24 // data. |
| 24 static bool DecompressZlib(uint8_t* out, int out_len, base::StringPiece in) { | 25 static bool DecompressZlib(uint8_t* out, int out_len, base::StringPiece in) { |
| 25 z_stream z; | 26 z_stream z; |
| 26 memset(&z, 0, sizeof(z)); | 27 memset(&z, 0, sizeof(z)); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 } | 288 } |
| 288 | 289 |
| 289 if (i != old_serials.size()) | 290 if (i != old_serials.size()) |
| 290 return false; | 291 return false; |
| 291 return true; | 292 return true; |
| 292 } | 293 } |
| 293 | 294 |
| 294 // static | 295 // static |
| 295 bool CRLSetStorage::Parse(base::StringPiece data, | 296 bool CRLSetStorage::Parse(base::StringPiece data, |
| 296 scoped_refptr<CRLSet>* out_crl_set) { | 297 scoped_refptr<CRLSet>* out_crl_set) { |
| 297 TRACE_EVENT0("net", "CRLSetStorage::Parse"); | 298 TRACE_EVENT0(kNetTracingCategory, "CRLSetStorage::Parse"); |
| 298 // Other parts of Chrome assume that we're little endian, so we don't lose | 299 // Other parts of Chrome assume that we're little endian, so we don't lose |
| 299 // anything by doing this. | 300 // anything by doing this. |
| 300 #if defined(__BYTE_ORDER) | 301 #if defined(__BYTE_ORDER) |
| 301 // Linux check | 302 // Linux check |
| 302 static_assert(__BYTE_ORDER == __LITTLE_ENDIAN, "assumes little endian"); | 303 static_assert(__BYTE_ORDER == __LITTLE_ENDIAN, "assumes little endian"); |
| 303 #elif defined(__BIG_ENDIAN__) | 304 #elif defined(__BIG_ENDIAN__) |
| 304 // Mac check | 305 // Mac check |
| 305 #error assumes little endian | 306 #error assumes little endian |
| 306 #endif | 307 #endif |
| 307 | 308 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 memcpy(out + off, j->data(), j->size()); | 546 memcpy(out + off, j->data(), j->size()); |
| 546 off += j->size(); | 547 off += j->size(); |
| 547 } | 548 } |
| 548 } | 549 } |
| 549 | 550 |
| 550 CHECK_EQ(off, len); | 551 CHECK_EQ(off, len); |
| 551 return ret; | 552 return ret; |
| 552 } | 553 } |
| 553 | 554 |
| 554 } // namespace net | 555 } // namespace net |
| OLD | NEW |