| 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/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 343 |
| 344 if (!ReadCRL(&data, &back_pair->first, &back_pair->second)) { | 344 if (!ReadCRL(&data, &back_pair->first, &back_pair->second)) { |
| 345 // Undo the speculative push_back() performed above. | 345 // Undo the speculative push_back() performed above. |
| 346 crl_set->crls_.pop_back(); | 346 crl_set->crls_.pop_back(); |
| 347 return false; | 347 return false; |
| 348 } | 348 } |
| 349 | 349 |
| 350 crl_set->crls_index_by_issuer_[back_pair->first] = crl_index; | 350 crl_set->crls_index_by_issuer_[back_pair->first] = crl_index; |
| 351 } | 351 } |
| 352 | 352 |
| 353 if (!CopyBlockedSPKIsFromHeader(crl_set, header_dict.get())) | 353 if (!CopyBlockedSPKIsFromHeader(crl_set.get(), header_dict.get())) |
| 354 return false; | 354 return false; |
| 355 | 355 |
| 356 *out_crl_set = crl_set; | 356 *out_crl_set = crl_set; |
| 357 return true; | 357 return true; |
| 358 } | 358 } |
| 359 | 359 |
| 360 // static | 360 // static |
| 361 bool CRLSetStorage::ApplyDelta(const CRLSet* in_crl_set, | 361 bool CRLSetStorage::ApplyDelta(const CRLSet* in_crl_set, |
| 362 const base::StringPiece& delta_bytes, | 362 const base::StringPiece& delta_bytes, |
| 363 scoped_refptr<CRLSet>* out_crl_set) { | 363 scoped_refptr<CRLSet>* out_crl_set) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 391 // NotAfter is optional for now. | 391 // NotAfter is optional for now. |
| 392 not_after = 0; | 392 not_after = 0; |
| 393 } | 393 } |
| 394 if (not_after < 0) | 394 if (not_after < 0) |
| 395 return false; | 395 return false; |
| 396 | 396 |
| 397 scoped_refptr<CRLSet> crl_set(new CRLSet); | 397 scoped_refptr<CRLSet> crl_set(new CRLSet); |
| 398 crl_set->sequence_ = static_cast<uint32>(sequence); | 398 crl_set->sequence_ = static_cast<uint32>(sequence); |
| 399 crl_set->not_after_ = static_cast<uint64>(not_after); | 399 crl_set->not_after_ = static_cast<uint64>(not_after); |
| 400 | 400 |
| 401 if (!CopyBlockedSPKIsFromHeader(crl_set, header_dict.get())) | 401 if (!CopyBlockedSPKIsFromHeader(crl_set.get(), header_dict.get())) |
| 402 return false; | 402 return false; |
| 403 | 403 |
| 404 std::vector<uint8> crl_changes; | 404 std::vector<uint8> crl_changes; |
| 405 | 405 |
| 406 if (!ReadChanges(&data, &crl_changes)) | 406 if (!ReadChanges(&data, &crl_changes)) |
| 407 return false; | 407 return false; |
| 408 | 408 |
| 409 size_t i = 0, j = 0; | 409 size_t i = 0, j = 0; |
| 410 for (std::vector<uint8>::const_iterator k = crl_changes.begin(); | 410 for (std::vector<uint8>::const_iterator k = crl_changes.begin(); |
| 411 k != crl_changes.end(); ++k) { | 411 k != crl_changes.end(); ++k) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 memcpy(out + off, j->data(), j->size()); | 538 memcpy(out + off, j->data(), j->size()); |
| 539 off += j->size(); | 539 off += j->size(); |
| 540 } | 540 } |
| 541 } | 541 } |
| 542 | 542 |
| 543 CHECK_EQ(off, len); | 543 CHECK_EQ(off, len); |
| 544 return ret; | 544 return ret; |
| 545 } | 545 } |
| 546 | 546 |
| 547 } // namespace net | 547 } // namespace net |
| OLD | NEW |