| 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 "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 const base::StringPiece header_bytes(data->data(), header_len); | 125 const base::StringPiece header_bytes(data->data(), header_len); |
| 126 data->remove_prefix(header_len); | 126 data->remove_prefix(header_len); |
| 127 | 127 |
| 128 scoped_ptr<base::Value> header = | 128 scoped_ptr<base::Value> header = |
| 129 base::JSONReader::Read(header_bytes, base::JSON_ALLOW_TRAILING_COMMAS); | 129 base::JSONReader::Read(header_bytes, base::JSON_ALLOW_TRAILING_COMMAS); |
| 130 if (header.get() == NULL) | 130 if (header.get() == NULL) |
| 131 return NULL; | 131 return NULL; |
| 132 | 132 |
| 133 if (!header->IsType(base::Value::TYPE_DICTIONARY)) | 133 if (!header->IsType(base::Value::TYPE_DICTIONARY)) |
| 134 return NULL; | 134 return NULL; |
| 135 return reinterpret_cast<base::DictionaryValue*>(header.release()); | 135 return static_cast<base::DictionaryValue*>(header.release()); |
| 136 } | 136 } |
| 137 | 137 |
| 138 // kCurrentFileVersion is the version of the CRLSet file format that we | 138 // kCurrentFileVersion is the version of the CRLSet file format that we |
| 139 // currently implement. | 139 // currently implement. |
| 140 static const int kCurrentFileVersion = 0; | 140 static const int kCurrentFileVersion = 0; |
| 141 | 141 |
| 142 static bool ReadCRL(base::StringPiece* data, std::string* out_parent_spki_hash, | 142 static bool ReadCRL(base::StringPiece* data, std::string* out_parent_spki_hash, |
| 143 std::vector<std::string>* out_serials) { | 143 std::vector<std::string>* out_serials) { |
| 144 if (data->size() < crypto::kSHA256Length) | 144 if (data->size() < crypto::kSHA256Length) |
| 145 return false; | 145 return false; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 memcpy(out + off, j->data(), j->size()); | 543 memcpy(out + off, j->data(), j->size()); |
| 544 off += j->size(); | 544 off += j->size(); |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 | 547 |
| 548 CHECK_EQ(off, len); | 548 CHECK_EQ(off, len); |
| 549 return ret; | 549 return ret; |
| 550 } | 550 } |
| 551 | 551 |
| 552 } // namespace net | 552 } // namespace net |
| OLD | NEW |